Ome.tiff file - can't display with colors
Posted: Mon Jun 29, 2015 10:42 am
Hi,
I try to display the different channels contained in an ome.tiff file in a java application with bio-formats.
This file contains 4 channels. When I open it under ImageJ, the image is colorized ; idem if I split the image according to the different channels (see : ftp://ftp.cea.fr/incoming/y2k01/Bio-Formats).
But with my java application, these images are not colorized. Here is my code :
Does someone has an idea ?
Thank you in advance for your help
Céline
I try to display the different channels contained in an ome.tiff file in a java application with bio-formats.
This file contains 4 channels. When I open it under ImageJ, the image is colorized ; idem if I split the image according to the different channels (see : ftp://ftp.cea.fr/incoming/y2k01/Bio-Formats).
But with my java application, these images are not colorized. Here is my code :
- Code: Select all
BufferedImageReader bufferedImageReader = new BufferedImageReader(new ImageReader());
BufferedImage bufferedImage = null;
try {
bufferedImageReader.setId(imagePath);
// imageCount (number of images) = effectiveSizeC x sizeT x sizeZ
int numberOfChannelsPerImage = bufferedImageReader.getEffectiveSizeC();
if (numberOfChannelsPerImage > 1) {
for (int channelNumber = 0; channelNumber < numberOfChannelsPerImage; channelNumber++) {
// Index of the image corresponding to z = 0, t = 0 and c = channelNumber
int indexImage = bufferedImageReader.getIndex(0, channelNumber, 0);
// OpenImage(0) <=> open the image corresponding to the first channel, the first z and the first t
bufferedImage = bufferedImageReader.openImage(indexImage);
}
} else {
bufferedImage = bufferedImageReader.openImage(0);
}
} catch (FormatException ex) {
// Can not read the image
bufferedImage = null;
} catch (IOException ex) {
// Can not read the image
bufferedImage = null;
}
Does someone has an idea ?
Thank you in advance for your help
Céline