Different intensity value between Bioformats and ImagePlus

Hi guys,

Need your help again. I use the bioformats library to read the image as follows:

IFormatReader imgReader = new ImageReader();
imgReader.setMetadataStore(MetadataTools.createOMEXMLMetadata());
imgReader.setId(filePath);
BufferedImageReader bufferedReader = new BufferedImageReader(imgReader);
BufferedImage[] imgs = new BufferedImage[imgReader.getImageCount()];
for (int i = 0; i < imgs.length; i++)
{
     imgs[i] = bufferedReader.openImage(i);         
}
bufferedReader.close(true);

Afterward, I check the intensity value as follows

BufferedImage tempImg = skullStrippers.get(64).getInputImage();
IJ.log("[100,100] = " + tempImg.getRaster().getSample(100, 100, 0));

Then I tried another way by using the ImagePlus object in the setup(String arg, ImagePlus imgPlus) method.

imgPlus.setSlice(64);
ImageProcessor imgProcessor = imgPlus.getProcessor();
IJ.log("[100,100] = " + imgProcessor.get(100, 100));

Finally, I found that the intensity value is different from the two ways. Did I miss any steps or doing something wrong ? Many thanks.

What are the values you get in the output? What is skullStrippers? Please provide a complete and runnable example if you want to get help quickly.

1 Like

I am so sorry I made a mistake about index

skullStrippers is a List so the index 64 is actually the 65th image.

However, the ImageStack index started from 1 instead of 0.

I modified imgPlus.setSlice(64 -> 65) and get the same result.

Thanks Eglinger.

1 Like

Hi,

Im a developer for Bio-Formats project. Nothing immediately jumps out based on the basic samples provided. However with so many different formats supported, in order to properly test the described behaviour it would really be best to have a sample file.

If you are able to provide a sample file for testing you can upload it to https://www.openmicroscopy.org/qa2/qa/upload/

With Thanks,
David Gault

1 Like