nf-core / mcmicro

An end-to-end processing pipeline that transforms multi-channel whole-slide images into single-cell data.

Home Page:https://nf-co.re/mcmicro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Design a mechanism to pass image pixel size to Mesmer and other tools

jmuhlich opened this issue · comments

Description of the bug

The modules.config entry for Mesmer includes --image-mpp=0.215 in ext.args which is not appropriate. We do need a smart way to pass the pixel size to Mesmer (and other tools that need it), but hard coding it here is definitely wrong. Should this be perhaps extracted from the Ashlar output image and included in the metadata map or in its own separate channel? While we're at it we could extract other useful image metadata too. We could also extract metadata from the raw image data -- this would be particularly useful to cross-check against the samplesheet and markersheet content in the input validation step.

I think that extracting the metadata from ashlar output is a good idea, however I am not sure how complex that is to do.
I think that asking users for that value in the parameter file is also ok.

Looking at your recent code in the tests, what about creating a dictionary as an output from ashlar (or even before ashlar), that contains the relevant image metadata to be accessed by any other step. The question whether it is better to pass this inside the ASHLAR.out.tif or as another ASHLAR.out is up to you.

I think it makes sense to write a module that extracts common useful ome-tiff metadata and into a format that is easily parsed from Nextflow code. This information can then be emitted from the module and collected into a channel.

Some of us discussed this face to face and decided that a separate image metadata extraction module would be best, rather than trying to get the Ashlar module to output the metadata itself. Doing this once in the Ashlar module might be feasible, but it's likely that we'll want image metadata from other tools. Installing the necessary extra tools and scripts for metadata extraction into other "third-party" containers like Mesmer and Cellpose will be difficult.

I agree with a module itself, it would also be much easier to expand if needed.

Just a question here, why don't we implement a general pixel_size parameter that would then get passed to all modules that require it instead of extracting it from the metadata. Especially with how widely different inputs we would be expecting (that we would see in different staging modules), this would by far be the most straightforward approach. Let me know what you think