I would like to read a single plane from a multi-plane image (without loading the whole image into memory, and using SCIFIO or BioFormat) and convert it into a Dataset object. The ImgOpener seems to allow to read the whole image but not just a single plane. How can I do this ? Is there a service that already does it ?
I could send you the code I made but I don’t think it would be on any help. I want to use the method dataset.setPlane(int,planarAccess) but I don’t know how to get a planarAccess object from the SCIFIO reader.
reader.openPlane(…) doesn’t seems to return anything helpful/compatible. I’m completly lost T-T
I would advise against using the plane-related API methods of
Dataset, since that class is going to undergo some serious changes within the next few months.
The good news is that you can achieve what you want without worrying about
Dataset at all. There are a few ways:
Alternately, configure SCIFIO to force ImgMode.CELL (1, 2). This will open the full N-dimensional image but only read planes on demand—i.e., when using ImgLib2’s
RandomAccessto access the pixels, cells will be paged in as needed. You can then duplicate only the portions of the image of interest.
You can use SCIFIO’s low-level API to read pixels in tiles. This is very likely more complex than you need, but I bring it up because there is a tutorial illustrating how to do it, and it gives you fine-grained control over the I/O.
Lastly, @hinerm might have more suggestions, since I might be forgetting something.