在Matlab中分割肺结节的最佳方法 [英] Best Way to Segment Lung Nodules in Matlab
问题描述
我正在使用Matlab中的图像处理。我试图仅分割出恶性(癌性)肺结节。最初我设法分割肺和所有可能的结节。
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.
我使用了以下Matlab代码:
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.
这是分段肺:
更新:
考虑大于3mm的结节大小是恶性的(癌症)。如何从图像中计算mm的大小?
Consider the nodule size greater than 3mm is malignant (cancerous). How to calculate the size in mm from the image?
推荐答案
运行后:
% Segment nodules
BW = im2bw(segM, 0.55);
BW图像中有结节。现在,要根据大小过滤出结节,可以在每个节点上插入一个椭圆并检查主轴长度。为此,您可以使用 regionprops 并要求 MajorAxisLength
。
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
.
区域道具将检测二进制图像的所有像素组(连接组件)并返回有关每个组的信息struct array。
Region props will detect all pixel groups (connected components) of your binary image and return information about each group in a struct array.
尝试这样调用:
nodules = regionprops(BW, 'MajorAxisLength');
它将返回一个struct array nodules
其中您可以像这样访问每个结节:
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
这意味着第一个结节的主要长度为4.6188像素。如果您知道图像与实际数据的比例,则可以将该大小转换为毫米。例如,假设您知道现实世界中每个像素都等于0.4毫米。然后你只需要将该值乘以 MajorAxisLength
以获得mm的值(并过滤你想要的结节)。
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).
了解哪里是您刚刚过滤掉的结节也很有用。您可以询问 regionprops
以获取更多数据,例如 Centroid
或 BoundingBox
。也许最好看一下 MinorAxisLength
以避免将线视为结节,或者偏心
告诉你一组像素圈子如何的值。有关详细信息,请查看文档。
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:
这篇关于在Matlab中分割肺结节的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!