<HTML>
<HEAD>
<TITLE>ImageProcessorReader.setId performance</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:10.5pt'>We are using loci_tools.jar to read radiographs in RVG format and extract a thumbnail JPEG image. All works as expected, however if the image in question is in a directory whose parent directory contains several thousands subfolders, then the ImageProcesserReader takes minutes to complete the setId() method. Please see attached code. The same image placed in a folder with its parent directory having much fewer subfolders works with no delay. This behavior can also be seen when using loci_tools.jar UI to open the same image. The issue does not seem to be related to the image itself but rather the fact that the containing folder is a child of a directory with thousands of subfolders. Could you please point us to how we can resolve this issue.<BR>
<BR>
Many thanks for your help,<BR>
<BR>
--<BR>
M. Samarah<BR>
<a href="msamarah@alumni.fit.edu">msamarah@alumni.fit.edu</a></SPAN></FONT><FONT FACE="Times New Roman"><SPAN STYLE='font-size:12pt'> <BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
 <BR>
private ImagePlus readDicomImage(String imagePath)<BR>
    {<BR>
        ImagePlus imp            = null;<BR>
        ImagePlus colorizedImage = null;<BR>
        <BR>
        ImageProcessorReader r = new ImageProcessorReader(new ChannelSeparator(LociPrefs.makeImageReader()));<BR>
        try<BR>
        {<BR>
            log_message("INFO: Examining file " + imagePath);<BR>
<BR>
            // the next line takes 10 to 20 minutes to complete when parent folder contains 4000+ subfolders. It takes no time when parent folder has 100 subfolders<BR>
            <FONT COLOR="#FF0000">r.setId(imagePath);<BR>
</FONT><BR>
            log_message("INFO: Setting file path " + imagePath);<BR>
            int num = r.getImageCount();<BR>
            log_message("INFO: Image count is" + num);<BR>
            int width = r.getSizeX();<BR>
            int height = r.getSizeY();<BR>
            log_message("INFO: Image Width %d Height %d", width, height);<BR>
            ImageStack stack = new ImageStack(width, height);<BR>
            log_message("INFO: After constructing image stack");<BR>
            byte[][][] lookupTable = new byte[r.getSizeC()][][];<BR>
            log_message("INFO: After Allocating memmory for image");<BR>
            for (int i=0; i<num; i++) <BR>
            {<BR>
                ImageProcessor ip = r.openProcessors(i)[0];<BR>
                stack.addSlice("" + (i + 1), ip);<BR>
                int channel = r.getZCTCoords(i)[1];<BR>
                lookupTable[channel] = r.get8BitLookupTable();<BR>
            }<BR>
            log_message("INFO: After constructing lookup table");<BR>
            log_message("INFO:Constructing image");<BR>
            imp = new ImagePlus("Dicom", stack);<BR>
               <BR>
            colorizedImage = applyLookupTables(r, imp, lookupTable);<BR>
            r.close();<BR>
<BR>
        }<BR>
        catch(Exception exc)<BR>
        {<BR>
           log_message("ERROR an error occurred: " + exc.getMessage());<BR>
        }<BR>
       return colorizedImage;       <BR>
    }<BR>
<BR>
<FONT COLOR="#FF0000">Example: Takes 10 to 20 minutes on an 8 core machine with 24GB of memory to complete setId method<BR>
</FONT></SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#FF0000">Data <folder><BR>
</FONT></SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#FF0000">0001 <folder><BR>
0002 <folder><BR>
0003 <folder><BR>
...<BR>
1000 <folder><BR>
1001 <folder><BR>
</FONT></SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#FF0000">File R1.RVG<BR>
</FONT></SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#FF0000">...<BR>
4000 <folder><BR>
</FONT></SPAN></FONT></BLOCKQUOTE></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<FONT COLOR="#008000">Example: Works with no delay<BR>
</FONT></SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#008000">Data <folder><BR>
</FONT></SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#008000">0001 <folder><BR>
0002 <folder><BR>
0003 <folder><BR>
...<BR>
0050 <folder><BR>
0051 <folder><BR>
</FONT></SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#008000">File R1.RVG<BR>
</FONT></SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><FONT COLOR="#008000">...<BR>
00080 <folder><BR>
</FONT></SPAN></FONT></BLOCKQUOTE></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
</SPAN></FONT>
</BODY>
</HTML>