Read a single plane from a multi-dimensional image

On Sun, Sep 27, 2015 at 10:37 AM, Mongis Cyril wrote:

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:

Lastly, @hinerm might have more suggestions, since I might be forgetting something.

1 Like


I’m not sure if this is better off in its own topic, but it seemed to be nice following on from this. I am attempting something similar, and I have chosen to go with “configure SCIFIO to force ImgMode.CELL”. Is there anyway that I can instruct such an image to ditch the cached pixels?

As I iterate over some large images (> 200GB) the amount of RAM consumed keeps increasing as I am iterating over more and more pixels. I would like to free up that ram after I have iterated over certain parts of the image.

P.S New to this forum (first post), sorry if this was a stupid question. Google failed me

Hi @BugzyUK,

you might want to take a look at the following discussion:

There are some new (and very recent) developments with regard to caching.


1 Like


dear Cyril,
If I’ve understood well your problem I think you can use the ImporterOptions ( and BioFormats BF ( classes of Bio-Formats API.
I’ve used it in last months to open specific time point from a confocal multi-acquisition series.

Something like that in jython:

from import ImporterOptions
from loci.plugins import BF

file_path = "path/to/your/exp.lif" 

s = 1 #set the series number you want to read
t = 3 #set the time point you want to read

options = ImporterOptions()
#HERE! you set the time, there are the analogous methods for Channel and Z-plane
options.setTBegin(s, t) 
options.setTEnd(s, t)  

imps = BF.openImagePlus(options)

you can also check here , this jython example from @ctrueden.

hoping to be helpful,
have a nice day