glencoesoftware / bioformats2raw

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

32 Bit IMS-MALDI Low Resolutions Looking Odd #52

Closed ilan-gold closed 4 years ago

ilan-gold commented 4 years ago

Hello,

We are running the bioformats2raw -> raw2ometiff pipeline on some imaging mass spectrometry data that is 32 bit float data. The data can sometimes be "sparse" and we see some weird artifacts in the lower resolutions of the pyramid. There are some "stripes" that appear only on lower resolutions:

Screen Shot 2020-07-20 at 1 18 38 PM Screen Shot 2020-07-20 at 1 19 45 PM

Here is the pyramid and original: original: https://storage.googleapis.com/vitessce-demo-data/test-data/hubmap/test/ims_compressed_no_pyramid/VAN0012-RK-103-75-IMS_NegMode_multilayer.ome.tif pyramid: https://storage.googleapis.com/vitessce-demo-data/test-data/hubmap/test/ims_compressed_pyramid/VAN0012-RK-103-75-IMS_NegMode_multilayer.ome.tif

Thanks! If you need more examples, we have a few.

melissalinkert commented 4 years ago

Thanks, @ilan-gold. I definitely see what you mean with the provided test files. The immediate problem seems to be that the pyramid's pixel type is not the same as the original (uint32 vs float). We're working on a fix for that in raw2ometiff now.

ilan-gold commented 4 years ago

@melissalinkert Can you clarify a bit? It sounds like there are two separate things going on there. There is a data issue and also a raw2ometiff issue? Thanks for getting back to me!

ilan-gold commented 4 years ago

The creators of the data have said they intend to use float data so that may be what is throwing me off.

melissalinkert commented 4 years ago

The original file has the pixel type set to float, so there isn't an issue there. The pyramid written by raw2ometiff preserves the float type in the OME-XML metadata, but not in the internal TIFF metadata. When there is a mismatch between the two types, TIFF metadata is preferred. raw2ometiff needs to be fixed to correctly preserve the float type in the TIFF metadata.

melissalinkert commented 4 years ago

https://github.com/glencoesoftware/raw2ometiff/pull/39 should fix the pixel type issue; raw2ometiff will need to be re-run on any affected files.

Unfortunately, I still see the striping issue even with pixel type fixed. My working theory is that the simple downsampling algorithm we use is just poorly suited to this type of data (see https://github.com/ome/ome-common-java/blob/master/src/main/java/loci/common/image/SimpleImageScaler.java). More investigation is required though.

ilan-gold commented 4 years ago

@melissalinkert Thank you for looking into this. That was my initial assumption when we ran into this - I did notice the pure downsampling as well. Perhaps adding a Gaussian Kernel of some other sort of averaging operation would help? Would it be possible to do a release of raw2ometiff for the pixel fix soon?

ngehlenborg commented 4 years ago

@melissalinkert Do you know when https://github.com/glencoesoftware/raw2ometiff/pull/39 will make it into a release? We are trying to decide if we should wait for it to process data for the HuBMAP consortium this week.

melissalinkert commented 4 years ago

raw2ometiff 0.2.7 was just released, and includes https://github.com/glencoesoftware/raw2ometiff/pull/39

melissalinkert commented 4 years ago

Changes proposed in https://github.com/glencoesoftware/bioformats2raw/pull/54 should produce better looking pyramids for this data.