0
$\begingroup$

I am trying to do nuclei detection from a histopathological image. The original image and the mask (ground truth image or segmented image) are as follows: Image vs Mask

The tissue image is (128,128,3) [RGB] and the mask is (128,128). Now, if I visualize with grayscale colormap:

Image vs Mask in gray

My ultimate aim is to get bounding boxes for each nuclei in the mask.

What I have understood till this point: Do segmentation on tissue image, obtain the mask, find the bounding boxes on mask. Then I questioned why to get bounding boxes from mask, why not the original image? Then after some searching it led to conclusion that masks are more refined images only emphasizing required portions and setting remaining to 0.

Now, from my understanding a mask would be a binary image with certain pixels as 255 and rest as 0, so that when it is bitwise AND-ed with the original image we get only the required portions (wherever pixel values were 255).

So, in the given mask, how come there are different intensity values for nuclei? Is it due to the fact that some nuclei are strongly represented and some are weakly represented?

  1. If so, then if I threshold the mask to 255 for every pixel value greater than 0, it should ideally become the mask which I described in my understanding, right?
  2. If not so, then what is the meaning of this multi-intensity valued mask? It can't be applied like a binary mask for AND operations (since it has values like 38,60,110 apart from 255).
  3. Even though it's a one channel image, the default colormap sets nuclei to different colors in the mask. Does it indicate that the mask is a m-ary mask with same color nuclei belonging to a certain class/label and if AND-ed with original image, then would yield only those nuclei of that class?
$\endgroup$

1 Answer 1

1
$\begingroup$

...masks are more refined images only emphasizing required portions and setting remaining to 0.

A mask is usually a binary bitmap that uses 1 at some location $(x,y)$ to indicate that it "selects" or "uses" or "includes" that pixel in the region of interest it defines.

The values that you see in your mask are not so much related to the mask but to its labeling.

...in the given mask, how come there are different intensity values for nuclei?

Each intensity value "tags" a different region. In other words, if your mask is in some $M$, then by evaluating $M == u$ where $u$ is a positive integer (say for example 5), then you would "select" all (connected) pixels that belong to the region of interest that has been labeled as "5".

Is it due to the fact that some nuclei are strongly represented and some are weakly represented?

No.

Also, "no" to #2 and "yes but not exactly" to #3: To get the behaviour described in #3 you would have to first "select" the mask (which casts it to a boolean) and then use it in logic expressions.

So, to get your bounding boxes all you have to do is iterate through the labels of the mask, extract it (with something like "where mask==label, set to 1 else 0" and find the min, max of the $x,y$ components of the pixel location.

Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.