How does MeasureTexture handle a masked image?

Hi,

The documentation of MaskImage states that masked pixels will be ignored by modules that respect masks but I can’t find a list of which modules respect masks and which ones don’t. What will MeasureTexture do if I run it in Images mode on output from MaskImage? Will it:

(a) Compute the texture using only the domain inside the mask, ignoring the big black expanse surrounding them?
(b) Compute the texture of the whole masked image, including the big black perfectly smooth expanse, therefore returning smoother texture values when the mask covers more of the image.

Regards,

John

Regards,

John

The code for MeasureTexture checks for masks, so I think it’s very likely the former (though we should include that in the documentation). An easy test would be to perform MeasureTexture on the same image with and without a pretty big mask and see if the results are similar or wildly different.

That’s correct. I wrote a little matlab script to generate some test images and a corresponding CP project to confirm the expected behavior for anyone who’s curious. The CP project is attached. The .m file is prohibitied so I’ll just paste in the code since it’s short:

John

side = 400; %side length of image
noise = uint8(255rand(side));
mask = zeros(side);
masked_ind = [round(0.4
side) : round(0.6side)];
mask(masked_ind, masked_ind) = 1;
outside = ~logical(mask);
mask = uint8(255
mask);
masked_noise = noise;
masked_noise(outside) = 0;

imwrite(mask, ‘mask.tif’);
imwrite(noise, ‘noise.tif’);
imwrite(masked_noise, ‘masked_noise.tif’)

tester.cpproj (96.9 KB)

Thanks for pointing this out. I’ve created a related issue in Github: https://github.com/CellProfiler/CellProfiler/issues/2245