BufferedImageReader - Merging channels
Posted: Wed Jun 24, 2015 2:27 pm
Hi,
I develop a java application to render images : these images are from different formats. In the case where an image has several channels, I would like to create a bufferedImage corresponding to the merged channels. I have looked at the BioFormats documentation but I have found not hints.
Here you can find my code :
Thank you in advance for your help
Céline
I develop a java application to render images : these images are from different formats. In the case where an image has several channels, I would like to create a bufferedImage corresponding to the merged channels. I have looked at the BioFormats documentation but I have found not hints.
Here you can find my code :
- Code: Select all
BufferedImageReader bufferedImageReader = new BufferedImageReader(new ImageReader());
BufferedImage bufferedImage;
try {
bufferedImageReader.setId(imagePath);
// OpenImage(0) <=> open the image corresponding to the first channel, the first z and the first t
bufferedImage = bufferedImageReader.openImage(0);
} catch (FormatException ex) {
// Can not read the image
bufferedImage = null;
} catch (IOException ex) {
// Can not read the image
bufferedImage = null;
}
Thank you in advance for your help
Céline