问题
I am working with images processing in Matlab. I am trying to segment out only malignant (cancerous) lung nodules. Initially I managed to segment out Lung and all possible nodules.
I have used following Matlab code:
segM = % Segmented Lung
% Segment nodules
BW = im2bw(segM, 0.55);
Now, I want to apply some filter that will filter all benign (noncancerous) nodules. I am looking for solution from long time but I haven’t found any way to continue it.
Here is the segmented Lung:
Update:
Consider the nodule size greater than 3mm is malignant (cancerous). How to calculate the size in mm from the image?
回答1:
After you run this:
% Segment nodules
BW = im2bw(segM, 0.55);
You have the nodules in a BW image. Now, to filter out nodules based on the size, you could fit an ellipse to every node and check the major axis length. To do that you could use regionprops and ask for the MajorAxisLength
.
Region props will detect all pixel groups (connected components) of your binary image and return information about each group in a struct array.
Try calling it like this:
nodules = regionprops(BW, 'MajorAxisLength');
It will return a struct array nodules
where you can access each nodule like this:
>> nodules(1)
ans =
MajorAxisLength: 4.6188
>> nodules(1).MajorAxisLength
ans =
4.6188
It means the first nodule has a major length of 4.6188 pixels. You can convert that size to millimeters if you know the proportion of your image to the real data. For example, suppose you know that every pixel is equal to 0.4 mm in the real world. Then you just have to multiply that value to MajorAxisLength
to get the value in mm (and filter the nodules you want).
It would also be useful to know where is the nodule you just filtered out. You can ask regionprops
for more data, such as the Centroid
, or BoundingBox
. Perhaps it's also a good idea to take a look at MinorAxisLength
to avoid detecting "lines" as nodules, or the Eccentricity
value which tells you "how circle like" a group of pixels is. Take a look at the documentation for more information.
Also take a look at this other question, it might be useful:
来源:https://stackoverflow.com/questions/23168783/best-way-to-segment-lung-nodules-in-matlab