Skip to content

Commit

Permalink
Clean up prog/jbrankhaus.c and prog/jbcorrelation.c
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBloomberg committed Sep 23, 2024
1 parent 1a4ba7e commit a60bd16
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
30 changes: 15 additions & 15 deletions prog/jbcorrelation.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* The default size is given in jbclass.c.
* (2) The two output files (for templates and c.c. data)
* are written with the rootname
* /tmp/lept/jb/result
* /tmp/lept/jb_correl/result
*/

#ifdef HAVE_CONFIG_H
Expand All @@ -61,7 +61,7 @@
#define DISPLAY_DIFFERENCE 1
#define DISPLAY_ALL_INSTANCES 0

static const char rootname[] = "/tmp/lept/jb/result";
static const char rootname[] = "/tmp/lept/jb_correl/result";

int main(int argc,
char **argv)
Expand Down Expand Up @@ -94,9 +94,9 @@ PIXA *pixa, *pixadb;
}

setLeptDebugOK(1);
lept_mkdir("lept/jb");
lept_mkdir("lept/jb_correl");

#if 0
#if 0 /* Choose library function or detailed steps */

/*--------------------------------------------------------------*/

Expand All @@ -111,7 +111,6 @@ PIXA *pixa, *pixadb;

safiles = getSortedPathnamesInDirectory(dirin, NULL, firstpage, npages);
nfiles = sarrayGetCount(safiles);

/* sarrayWriteStderr(safiles); */

/* Classify components on requested pages */
Expand All @@ -123,7 +122,8 @@ PIXA *pixa, *pixadb;
/* Save and write out the result */
data = jbDataSave(classer);
jbDataWrite(rootname, data);
lept_stderr("Number of classes: %d\n", classer->nclass);
if (classer)
lept_stderr("Number of classes: %d\n", classer->nclass);

/* Render the pages from the classifier data.
* Use debugflag == FALSE to omit outlines of each component. */
Expand All @@ -141,7 +141,7 @@ PIXA *pixa, *pixadb;
pixDestroy(&pix);
}

#if DISPLAY_DIFFERENCE
#if DISPLAY_DIFFERENCE
{
char *fname;
PIX *pix1, *pix2;
Expand All @@ -153,9 +153,9 @@ PIXA *pixa, *pixadb;
pixDestroy(&pix1);
pixDestroy(&pix2);
}
#endif /* DISPLAY_DIFFERENCE */
#endif /* DISPLAY_DIFFERENCE */

#if DEBUG_TEST_DATA_IO
#if DEBUG_TEST_DATA_IO
{
JBDATA *newdata;
PIX *newpix;
Expand Down Expand Up @@ -185,9 +185,9 @@ PIXA *pixa, *pixadb;
jbDataDestroy(&newdata);
pixaDestroy(&newpixa);
}
#endif /* DEBUG_TEST_DATA_IO */
#endif /* DEBUG_TEST_DATA_IO */

#if RENDER_DEBUG
#if RENDER_DEBUG
/* Use debugflag == TRUE to see outlines of each component. */
pixadb = jbDataRender(data, TRUE);
/* Write the debug pages out */
Expand All @@ -200,15 +200,15 @@ PIXA *pixa, *pixadb;
pixDestroy(&pix);
}
pixaDestroy(&pixadb);
#endif /* RENDER_DEBUG */
#endif /* RENDER_DEBUG */

#if DISPLAY_ALL_INSTANCES
#if DISPLAY_ALL_INSTANCES
/* Display all instances, organized by template.
* The display programs have a lot of trouble with these. */
pix = pixaaDisplayByPixa(classer->pixaa, 5, 1.0, 10, 0, 0);
pixWrite("/tmp/lept/jb/output_instances", pix, IFF_PNG);
pixDestroy(&pix);
#endif /* DISPLAY_ALL_INSTANCES */
#endif /* DISPLAY_ALL_INSTANCES */

pixaDestroy(&pixa);
sarrayDestroy(&safiles);
Expand All @@ -217,7 +217,7 @@ PIXA *pixa, *pixadb;

/*--------------------------------------------------------------*/

#endif
#endif /* Choose library function or detailed steps */

return 0;
}
Expand Down
32 changes: 16 additions & 16 deletions prog/jbrankhaus.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* rank = 0.97
* (3) The two output files (for templates and c.c. data)
* are written with the rootname
* /tmp/lept/jb/result
* /tmp/lept/jb_rankhaus/result
*/

#ifdef HAVE_CONFIG_H
Expand All @@ -64,7 +64,7 @@
#define DISPLAY_DIFFERENCE 1
#define DISPLAY_ALL_INSTANCES 0

static const char rootname[] = "/tmp/lept/jb/result";
static const char rootname[] = "/tmp/lept/jb_rankhaus/result";

int main(int argc,
char **argv)
Expand Down Expand Up @@ -96,23 +96,22 @@ PIXA *pixa, *pixadb;
}

setLeptDebugOK(1);
lept_mkdir("lept/jb");
lept_mkdir("lept/jb_rankhaus");

#if 0
#if 0 /* Choose library function or detailed steps */

/*--------------------------------------------------------------*/

jbRankHaus(dirin, size, rank, COMPONENTS, rootname, firstpage, npages, 1);

/*--------------------------------------------------------------*/

#else
#else

/*--------------------------------------------------------------*/

safiles = getSortedPathnamesInDirectory(dirin, NULL, firstpage, npages);
nfiles = sarrayGetCount(safiles);

/* sarrayWriteStderr(safiles); */

/* Classify components on requested pages */
Expand All @@ -124,7 +123,8 @@ PIXA *pixa, *pixadb;
/* Save and write out the result */
data = jbDataSave(classer);
jbDataWrite(rootname, data);
lept_stderr("Number of classes: %d\n", classer->nclass);
if (classer)
lept_stderr("Number of classes: %d\n", classer->nclass);

/* Render the pages from the classifier data.
* Use debugflag == FALSE to omit outlines of each component. */
Expand All @@ -142,7 +142,7 @@ PIXA *pixa, *pixadb;
pixDestroy(&pix);
}

#if DISPLAY_DIFFERENCE
#if DISPLAY_DIFFERENCE
{
char *fname;
PIX *pix1, *pix2;
Expand All @@ -154,9 +154,9 @@ PIXA *pixa, *pixadb;
pixDestroy(&pix1);
pixDestroy(&pix2);
}
#endif /* DISPLAY_DIFFERENCE */
#endif /* DISPLAY_DIFFERENCE */

#if DEBUG_TEST_DATA_IO
#if DEBUG_TEST_DATA_IO
{
JBDATA *newdata;
PIX *newpix;
Expand Down Expand Up @@ -186,9 +186,9 @@ PIXA *pixa, *pixadb;
jbDataDestroy(&newdata);
pixaDestroy(&newpixa);
}
#endif /* DEBUG_TEST_DATA_IO */
#endif /* DEBUG_TEST_DATA_IO */

#if RENDER_DEBUG
#if RENDER_DEBUG
/* Use debugflag == TRUE to see outlines of each component. */
pixadb = jbDataRender(data, TRUE);
/* Write the debug pages out */
Expand All @@ -201,15 +201,15 @@ PIXA *pixa, *pixadb;
pixDestroy(&pix);
}
pixaDestroy(&pixadb);
#endif /* RENDER_DEBUG */
#endif /* RENDER_DEBUG */

#if DISPLAY_ALL_INSTANCES
#if DISPLAY_ALL_INSTANCES
/* Display all instances, organized by template
* The display programs have a lot of trouble with these. */
pix = pixaaDisplayByPixa(classer->pixaa, 5, 1.0, 10, 0, 0);
pixWrite("/tmp/lept/jb/output_instances", pix, IFF_PNG);
pixDestroy(&pix);
#endif /* DISPLAY_ALL_INSTANCES */
#endif /* DISPLAY_ALL_INSTANCES */

pixaDestroy(&pixa);
sarrayDestroy(&safiles);
Expand All @@ -218,7 +218,7 @@ PIXA *pixa, *pixadb;

/*--------------------------------------------------------------*/

#endif
#endif /* Choose library function or detailed steps */

return 0;
}
2 changes: 1 addition & 1 deletion src/gifio.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
*
* Limitations:
*
* (1) We do not support animated gif. If the gif has more then one image,
* (1) We do not support animated gif. If the gif has more than one image,
* an error message is returned.
*
* </pre>
Expand Down
4 changes: 2 additions & 2 deletions version-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ <h2 align=center> <IMG SRC="moller52.jpg" border=1 ALIGN_MIDDLE> </h2>
* Prog files changed: alltests_reg.c, binmorph3_reg.c,
blend2_reg.c, blend4_reg.c cleanpdf.c, compressedpdf.c, croppdf.c,
findpattern_reg.c, findpattern1_reg.c findpattern2_reg.c,
htmlviewer.c, jp2kio_reg.c, libre_makefigs.c,
misctest1.c, misctest2.c,
htmlviewer.c, jbcorrelation.c, jbrankhaus.c,
jp2kio_reg.c, libre_makefigs.c, misctest1.c, misctest2.c,
pdfio2_reg.c, printimage.c, printsplitimage.c,
printtiff.c, psioseg_reg.c, splitpdf.c,
string_reg.c, tiffpdftest.c, xtractprotos.c
Expand Down

0 comments on commit a60bd16

Please sign in to comment.