Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The task is to identify the image region of the tumor.

tomography of kidneys with tumor (white area on the left kidney)

I try to use example from documentation centre:

tom1 = Import[""];
tumor = SelectComponents[
          DeleteBorderComponents[ Binarize[ tom1, {0.75, 1}]], 
          {"Area", "Holes"}, 2800 < #1 < 2900 && #2 > 0 &];
circle = ComponentMeasurements[ 
           ImageMultiply[ tom1, tumor], 
           {"Centroid", "EquivalentDiskRadius"}][[All, 2]];
Show[ tom1, Graphics[{Red, Thick, Circle @@ # & /@ circle}]]

but get unsatisfactory result:

tumor detection

i try to identify tumor like this but selection was noisy:

  DeleteBorderComponents[ Binarize[ tom1, {0.75, 1}]], 
  {"Area", "Holes"}, 2800 < #1 < 2900 && #2 > 0 &]


So, can you help me to make clearer allocation of the tumor and then calculate the area of ​​selection?

share|improve this question
If this is a tomogram wouldn't it be better to measure the tumor volume in 3D instead of the area of a single slice? – s0rce Mar 26 '14 at 20:30

Your approach is quite good. I would smooth the data a bit and do an Opening to cut one extra part:

tom1 = Import[""];
smooth = GaussianFilter[tom1, 2];
tumor = SelectComponents[
   Opening[Binarize[smooth, {0.8, 1}], 1]], {"Area", "Holes"}, 
  2000 < #1 < 2200 &];

HighlightImage[tom1, tumor]

Mathematica graphics

And for the second part of your question, you can then use, as pointed out by bobthechemist

ComponentMeasurements[tumor, "Area"]
(* {1 -> 2062.} *)
share|improve this answer
+1. Should you include something like ComponentMeasurements[tumor, "Area"] to answer the 2nd part of the question? – bobthechemist Mar 26 '14 at 20:06
@bobthechemist I have missed this completely. Thanks. – halirutan Mar 26 '14 at 20:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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