Creating lung volume from CAT scan?

5 次查看(过去 30 天)
It's going to work amazing in that imageset, but when i try to use mine, i dont know what should i do?
I'm working with DICOM format but also i can work with the jpeg format, if its going to be problem.
This is the code from i get the link but im not sure how to change this for my imageset(link)
Edit: I solved the importing issue, now i can use my own imageset. But now i have another issue on Image Segmentation.
Im going to use this segmentation on volume segmentation as a slice mask.
I thresolded, inverted and cleaned borders and filled holes. But still the base of tomography showing here. Any possibilities to using that mask in that red rectangle region?
And any possibilities have we to export this into a 3D object?
[V,spatial,dim] = dicomreadVolume(fullfile("Seri2"));
V = squeeze(V);
whos V
V = im2single(V);
XY = V(:,:,180);
XZ = squeeze(V(256,:,:));
figure
imshow(XY,[],'Border','tight');
figure
imshow(XZ,[],'Border','tight');
%%
BW = XY > 7.647100e-01;
BW = imcomplement(BW);
BW = imclearborder(BW);
BW = imfill(BW, 'holes');
radius = 3;
decomposition = 0;
se = strel('disk',radius,decomposition);
BW = imerode(BW, se);
maskedImageXY = XY;
maskedImageXY(~BW) = 0;
imshow(maskedImageXY)
%%
BW = XZ > 7.647100e-01;
BW = imcomplement(BW);
BW = imclearborder(BW);
BW = imfill(BW, 'holes');
radius = 3;
decomposition = 0;
se = strel('disk',radius,decomposition);
BW = imerode(BW, se);
maskedImageXZ = XZ;
maskedImageXZ(~BW) = 0;
imshow(maskedImageXZ)
%%
mask = false(size(V));
mask(:,:,160) = maskedImageXY;
mask(256,:,:) = mask(256,:,:)|reshape(maskedImageXZ,[1,512,212]);
V = histeq(V);
%%
BW = activecontour(V,mask,100,'Chan-Vese');
segmentedImage = V.*single(BW);
volumeViewer(segmentedImage)
%%
volLungsPixels = regionprops3(logical(BW),'volume');
spacingx = 0.938;
spacingy = 0.938;
spacingz = 1.26*le-6;
unitvol = spacingx*spacingy*spacingz;
volLungs1 = volLungsPixels.Volume(1)*unitvol;
volLungs2 = volLungsPixels.Volume(2)*unitvol;
volLungsLiters = volLungs1 + volLungs2
%%

采纳的回答

Image Analyst
Image Analyst 2021-1-9
If you have row1, row2, col1, and col2 of your red box, then you can erase the 2-D binary image outside that like this:
mask(1:row1, :) = false;
mask(row2:end, :) = false;
mask(:, 1:col1) = false;
mask(:, col2:end) = false;
  4 个评论
Türker Berk Dönmez
Works like a charm! Thank you so much! I think it is not possible but, could have any chance to exporting this volume as .stl or .obj format?
Image Analyst
Image Analyst 2021-1-10
I don't use those formats, so I don't know. You'll have to figure it out on your own. If my main answer worked, could you please "Accept this Answer". Thanks in advance.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by