Creating lung volume from CAT scan?
2 views (last 30 days)
Show older comments
Türker Berk Dönmez
on 8 Jan 2021
Commented: Image Analyst
on 10 Jan 2021
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.
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
%%
0 Comments
Accepted Answer
Image Analyst
on 9 Jan 2021
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 Comments
Image Analyst
on 10 Jan 2021
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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!