glencoesoftware / bioformats2raw

Bio-Formats image file format to raw format converter
GNU General Public License v2.0
83 stars 35 forks source link

image shifted when converting #117

Open vladpopovici opened 3 years ago

vladpopovici commented 3 years ago

Hello,

I am using bioformats2raw for converting MRXS files and I noticed a shift in the converted images. More precisely, it looks that the tissue region is shifted such that the bounding box has its top-left corner at (0,0) (see examples, the converted image comes from the ZARR raw format, border added for visualization). The resulting image size matches the original, just the content gets moved. I wonder whether this is linked to openslide's bounding box option which is available for some (including MRXS) image formats.

Would it be possible to either remove the shift altogether or provide a command line option? Or, even better, provide an option to allow converting only a user-specified region (e.g. --roi=(100,100,1024,2048,5) for a region of interest with (100,100) top-left corner, width=1024, height=2048 in level 5 coordinates - or something similar...)

Tried with: bioformats2raw version = 0.3.0-rc4 with Bio-Formats version = 6.5.1

Command line: bioformats2raw --log-level=ERROR --downsample-type=GAUSSIAN --fill-value=255 --max_workers=12 --dimension-order=XYZCT --progress --overwrite ~/tmp/HE.mrxs ~/tmp/HE-raw.zarr

Thanks a lot,

Vlad HE-original HE-converted

melissalinkert commented 3 years ago

If you remove ~/tmp/.HE.mrxs.bfmemo and re-run the conversion with the --options mirax.use_metadata_dimensions=false option, does that help at all?

vladpopovici commented 3 years ago

Thanks @melissalinkert for you answer. Unfortunately, using --options... as suggested does not change the output (still shifted). I also tried with --extra-readers, and this seems to center the region of interest in the image... Any other things I could try? Thanks, V.

melissalinkert commented 3 years ago

Apologies for the delay here. Assuming what you see in OpenSlide matches what you see in 3DHISTECH's CaseViewer software, we'll need to see the problematic dataset or at minimum the Slidedat.ini file in order to further investigate how to remove this shift.

vladpopovici commented 3 years ago

My turn to apologize for late reply. I checked with CaseViewer and it looks like it crops the image around the object of interest. So it looks, again, different from all other results above. If anyone is interested in trying out, here's the slide in the .MRXS format I tried to convert: https://drive.google.com/file/d/1j4m8F2XwjbMV1PcQtAVeki-JKRGh7qQO/view?usp=sharing P.S. My solution is now first to convert + crop, and then work on the images. Like this I am independent on the OpenSlide/Bioformats -> Zarr/OME-Zarr conversion. But it would still be good to achieve consistency. V.