[ome-users] ImageProcessorReader.setId performance
Mohammad Samarah
isamarah at mac.com
Sat Mar 22 03:36:22 GMT 2014
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.
Many thanks for your help,
--
M. Samarah
msamarah at alumni.fit.edu
private ImagePlus readDicomImage(String imagePath)
{
ImagePlus imp = null;
ImagePlus colorizedImage = null;
ImageProcessorReader r = new ImageProcessorReader(new
ChannelSeparator(LociPrefs.makeImageReader()));
try
{
log_message("INFO: Examining file " + imagePath);
// 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
r.setId(imagePath);
log_message("INFO: Setting file path " + imagePath);
int num = r.getImageCount();
log_message("INFO: Image count is" + num);
int width = r.getSizeX();
int height = r.getSizeY();
log_message("INFO: Image Width %d Height %d", width, height);
ImageStack stack = new ImageStack(width, height);
log_message("INFO: After constructing image stack");
byte[][][] lookupTable = new byte[r.getSizeC()][][];
log_message("INFO: After Allocating memmory for image");
for (int i=0; i<num; i++)
{
ImageProcessor ip = r.openProcessors(i)[0];
stack.addSlice("" + (i + 1), ip);
int channel = r.getZCTCoords(i)[1];
lookupTable[channel] = r.get8BitLookupTable();
}
log_message("INFO: After constructing lookup table");
log_message("INFO:Constructing image");
imp = new ImagePlus("Dicom", stack);
colorizedImage = applyLookupTables(r, imp, lookupTable);
r.close();
}
catch(Exception exc)
{
log_message("ERROR an error occurred: " + exc.getMessage());
}
return colorizedImage;
}
Example: Takes 10 to 20 minutes on an 8 core machine with 24GB of memory to
complete setId method
> Data <folder>
>> 0001 <folder>
>> 0002 <folder>
>> 0003 <folder>
>> ...
>> 1000 <folder>
>> 1001 <folder>
>>> File R1.RVG
>> ...
>> 4000 <folder>
Example: Works with no delay
> Data <folder>
>> 0001 <folder>
>> 0002 <folder>
>> 0003 <folder>
>> ...
>> 0050 <folder>
>> 0051 <folder>
>>> File R1.RVG
>> ...
>> 00080 <folder>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20140321/5cdea2c3/attachment.html>
More information about the ome-users
mailing list