I would like to open only a part of a tif stack using java specified by [xmin,xmax,ymin,ymax,zmin,zmax]
Currently I am using this class for opening:
And my current code, which I basically copied from related classes, looks like below; for instance to only open one slice of a tif stack:
n = 10; // example z-slice that I want to load from the stack FileInfo info = new Opener().getTiffFileInfo(directory+filename); fi = (FileInfo) info; long size = fi.width*fi.height*fi.getBytesPerPixel(); fi.longOffset = fi.getOffset() + (n-1)*(size+fi.gapBetweenImages); fi.offset = 0; fi.nImages = 1; FileOpener fo = new FileOpener(fi); return fo.open(false); // returns an imp
However, I do not know how I could restrict the width and height to a xy-ROI of one tif slice.
The issue is that we have many 2000x2000 pixel images and it takes (too much) time to load all of it into RAM. Is there a way to only open part of a tif slice in a fast way? Or would we have to go for other file formats such as h5?