Closed manthey closed 9 months ago
I think if src mu and sigma are None just before we call detect_nuclei_with_dask
, we could fetch the entire region we are working on at low res (e.g., ts.getRegion(**it_kwargs, output=dict(maxWidth=2048, maxHeight=2048))
, make sure it is in the format expected (e.g., make it three channel and cast it if necessary like we did in segment_wsi_foreground_at_low_res
), then compute mu, sigma = color_conversion.lab_mean_std(image_pixels)
.
If we go inside the detect_nuclei_with_dask
-->detect_tile_nuclei
there is already a checkpoint that stacks a single-channel image to RGB. I have added casting to that code. Now the input for Reinhard normalization will be of the desired dtype and in 3 channel format.
If we go inside the
detect_nuclei_with_dask
-->detect_tile_nuclei
there is already a checkpoint that stacks a single-channel image to RGB. I have added casting to that code. Now the input for Reinhard normalization will be of the desired dtype and in 3 channel format.
I don't think we have to do this cast unless the code is going to use skimage.rgb2lab
; I think the other code handles the floating point values that aren't scaled [0,1], so the cast just uses more time and memory.
After the casting process, the input goes into htk_cnorm.reinhard
that has an inbuild rgb_to_lab
coming from the preprocessing
module. Inside that function, there is a dot product between the log of the image and the array. I believe that the casting could be helpful there.
@subinkitware When we run this on an image where we fail to compute mu and sigma, you can see that the tiles get inconsistent normalization. When I am on master and run this on tcgaextract_rgb.tiff, I can see denser nuclei on the left. I haven't checked if #1005 has any affect.
@subinkitware When we run this on an image where we fail to compute mu and sigma, you can see that the tiles get inconsistent normalization. When I am on master and run this on tcgaextract_rgb.tiff, I can see denser nuclei on the left. I haven't checked if #1005 has any affect.
Let me investigate this issue. I believe the #1005 has some effect since it is casting the images from float to uint16
One of the reasons we want to calculate a whole-image scaling parameter is to avoid processing differences on different tiles.