code

 avatar
user_4319474
plain_text
a year ago
1.6 kB
21
Indexable
Never
% Add CERR to the path
addpath(genpath('/path/to/CERR/folder'));

% Load DICOM RS file to explore the organ structures
RS = dicomread('/path/to/DICOM_RS_file.dcm');
info_RS = dicominfo('/path/to/DICOM_RS_file.dcm');
% Display the organ structures
imshow(RS(:,:,1));

% Load DICOM RT file to explore the beam set-ups
RT = dicomread('/path/to/DICOM_RT_file.dcm');
info_RT = dicominfo('/path/to/DICOM_RT_file.dcm');
% Display the beam set-ups
imshow(RT(:,:,1));

% Load DICOM RD file to explore the dose distributions
RD = dicomread('/path/to/DICOM_RD_file.dcm');
info_RD = dicominfo('/path/to/DICOM_RD_file.dcm');
% Display the dose distribution
imshow(RD(:,:,1));

% Load DRR (digitally reconstructed radiograph) cartoons from the RI files
RI = dicomread('/path/to/DICOM_RI_file.dcm');
info_RI = dicominfo('/path/to/DICOM_RI_file.dcm');
% Display the DRR cartoons
imshow(RI(:,:,1));

% Extract the isocentre position from the DICOM files
isocentre_position = info_RS.ROIContourSequence.Item_1.ROIContourSequence.Item_1.ROIDisplayColor;
% Display a planar dose distribution from one of the beams
beam_index = 1;
dose = RD(:,:,beam_index);
% Reshape the dose distribution into submatrices
n_submatrices = 10;
submatrices = reshape(dose, size(dose,1), size(dose,2)/n_submatrices, n_submatrices);
% Display the contour plot of the planar dose distribution
figure;
contour(submatrices(:,:,5),10);
title('Planar Dose Distribution from Beam 1');
colorbar;

% Explore the structure of the DICOM RS file to understand how ROI structures are stored
ROI_contour_sequence = info_RS.ROIContourSequence;