BodenmillerGroup / ImcSegmentationPipeline

A pixel classification based multiplexed image segmentation pipeline
https://bodenmillergroup.github.io/ImcSegmentationPipeline/
MIT License
83 stars 35 forks source link

Truncates image range to 0-1 for mean image in 1_prepare_ilastik #59

Closed votti closed 3 years ago

votti commented 3 years ago

This addresses issue #57 that was caused by the scaled average images calculated for pixel classification potentially being outside of the allowed range.

I fixed it by truncating the data range using the ImageMath module.

votti commented 3 years ago

Hey team,

This change should not change anything and just fix an out-of-range bug that can happen if channels have extremely high counts.

If this is OK this will now be merged into the 'development' staging branch.

nilseling commented 3 years ago

Hey @votti thanks for fixing this. With "extremely high counts" do you mean counts higher than 65535? I'm fine with this merge for now. Once I'm done going through the details of the main branch, I will start testing the devel branch and modules.

votti commented 3 years ago

Thanks for having a look.

Here "extremely" high counts here means that the averge counts of a pixel from the ilastik stack are > 365.

The explanatory comment that is displayed in CP says: "This calculates an 'average' of all channels and multiplies it with 100.", 'Thus an average count of 0.1 (over all channels) will correspond to 10 in an uint16 image.', '', 'This allows to easily discriminate forground and background.', '', 'These images can be outside of the allowed 0-1 range, thus they will be truncated to the valid range in the following ImageMath module "

nilseling commented 3 years ago

Alright, thanks for the explanation! Depending on the number of channels and Ab concentrations, I don't even find it too unlikely to have an average > 365. So it's good to have this covered.

votti commented 3 years ago

That was definitely an oversight on my part and a bug to not have this covered. So I am also glad that this is fixed now.

On Tue, Feb 16, 2021, 13:51 Nils Eling notifications@github.com wrote:

Alright, thanks for the explanation! Depending on the number of channels and Ab concentrations, I don't even find it too unlikely to have an average

  1. So it's good to have this covered.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BodenmillerGroup/ImcSegmentationPipeline/pull/59#issuecomment-779816467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4R2KHZHBSUYIUA5QXYOF3S7JS4BANCNFSM4W7H6SQQ .