labsyspharm / quantification

Quantification module for mcmicro
https://github.com/labsyspharm/mcmicro
9 stars 13 forks source link

Add option to calculate custom skimage properties #30

Closed clemenshug closed 3 years ago

clemenshug commented 3 years ago

Additional regionprops can be calculated using the arguments --mask_props and --intensity_props. This required quite a few changes all over the code unfortunately.

For example, we can calculate the minimum and maximum marker intensity, Gini index, and the equivalent diameter:

python CommandSingleCellExtraction.py \
 --image unmicst-exemplar-001.ome.tif \
 --masks cellMask.tif nucleiMask.tif \
 --intensity_props max_intensity min_intensity gini_index \
 --mask_props equivalent_diameter \
 --channel_names markers.csv \
 --output .

When using mcmicro they can be passed in the --quant-opts argument:

--quant-opts '--intensity_props max_intensity min_intensity gini_index --mask_props equivalent_diameter --masks cellMask.tif nucleiMask.tif'

The issue with different number of cells in the given segmentation mask described in #28 still seems to be fixed.

Also, a recent version of skimage introduced regionprops_table(), which makes getting all properties in a single table much more convenient.

clemenshug commented 3 years ago

I checked that all calculated values (mean marker intensities and all the mask shape properties) are identical to the current master.

They are, except Solidity for some reason. The old version gives consistently slightly larger values than the PR version.

Anybody have an idea why that could be?

image

clemenshug commented 3 years ago

As @ArtemSokolov suggested, the upgraded scikit-image is responsible for the discrepancy between solidity values. I calculated solidity on the current master using either scikit-image 18.1 or 17.2 and see the same difference.