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.
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/483178/image.png)
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 个评论
采纳的回答
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 个评论
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!