Creating lung volume from CAT scan?

조회 수: 20 (최근 30일)
Türker Berk Dönmez
Türker Berk Dönmez 2021년 1월 8일
댓글: Image Analyst 2021년 1월 10일
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
Türker Berk Dönmez 2021년 1월 9일
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개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by