# Image Processing: Edge detection of the tumor on tomogram. Сalculation area of the tumor

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

I try to use example from documentation centre:

tom1 = Import["http://i.stack.imgur.com/mZ4fR.jpg"];
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:

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

SelectComponents[
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?

-
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 at 20:30

## 1 Answer

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

tom1 = Import["http://i.stack.imgur.com/mZ4fR.jpg"];
smooth = GaussianFilter[tom1, 2];
tumor = SelectComponents[
DeleteBorderComponents[
Opening[Binarize[smooth, {0.8, 1}], 1]], {"Area", "Holes"},
2000 < #1 < 2200 &];

HighlightImage[tom1, tumor]


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

ComponentMeasurements[tumor, "Area"]
(* {1 -> 2062.} *)

-
+1. Should you include something like ComponentMeasurements[tumor, "Area"] to answer the 2nd part of the question? –  bobthechemist Mar 26 at 20:06
@bobthechemist I have missed this completely. Thanks. –  halirutan Mar 26 at 20:18