Why does creatMaks have no images

1 view (last 30 days)
梅花
梅花 on 7 Mar 2024
Answered: UDAYA PEDDIRAJU on 12 Mar 2024
This is my code, the function is to generate mask by dicom RT:
info = dicominfo('G:\2024\FillContourFile\rtst2.dcm');
rtContours = dicomContours(info);
rtContours.ROIs
figure
plotContour(rtContours)
dcmFiles = dir('E:\Desktop\pyDemo\pythonProject\150s_masked\*.dcm');
info = dicominfo(fullfile(dcmFiles(1).folder, dcmFiles(1).name));
imageSize = [info.Rows, info.Columns, numel(dcmFiles)];
pixelSpacing = [info.PixelSpacing', info.SliceThickness];
%Here imageSize=[223 406 181],pixelSpacing=[0.5410 0.5410 1.0000]
referenceInfo = imref3d(imageSize,pixelSpacing(1),pixelSpacing(2),pixelSpacing(3));
for i=1:size(rtContours.ROIs,1)
contourIndex = i;
Name = string(rtContours.ROIs{i, 2}{1});
mask = createMask(rtContours, contourIndex, referenceInfo);
size(mask)
volshow(mask);
end

Answers (1)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU on 12 Mar 2024
Hi 梅花,
The issue with "createMask" producing no images could be due to a spatial mismatch between the RT contours and the DICOM images, or incorrect specifications in "imageSize" or "pixelSpacing'. Ensure the RT contours align with the DICOM series spatially and that "referenceInfo" accurately reflects the image dimensions and resolution. Double-check the contour coordinates and the DICOM series for consistency in anatomical coverage and patient positioning.
If you still face the issue after checking the above, attach the required files for further investigation and debugging.

Categories

Find more on DICOM Format in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!