CellProfiler / python-bioformats

Read and write life sciences file formats
Other
131 stars 45 forks source link

Reading .jp2 files #93

Open jacobpennels opened 6 years ago

jacobpennels commented 6 years ago

I've been trying to use this library to read in a .jp2 image. However, the file is too big for it to handle. Bioformats has a solution for this under the open_bytes (?) function. How can I access this within this library?

Thanks

sbesson commented 6 years ago

Hi @jacobpennels assuming you are using the bioformats.ImageReader.read() API in your code, you should be able to pass a region using the XYWH key/value. This call effectively delegates to the low-level IFormatReader.openBytes API which returns a region of the specified dimensions rather than the entire plane.

NB: in the specific case of jp2 files, there is also a known issue for very large files recorded in https://trac.openmicroscopy.org/ome/ticket/9544.

jacobpennels commented 6 years ago

Thanks for your help, unfortunately the file I want to open falls into the very large category, therefore it leaves me a bit stuck. Thanks for pointing that out to me