code1
user_4319474
plain_text
2 years ago
1.7 kB
3
Indexable
% Start CERR package CERR % Import DICOM RT studies pb_dir = 'path/to/pencil-beam/study'; cc_dir = 'path/to/collapsed-cone/study'; importCERR(pb_dir); importCERR(cc_dir); % Load pencil-beam study into viewer viewStructs(planC{end}); % Access dose distribution data global planC dose = zeros(size(planC{end}.dose)); for i = 1:numel(planC{end}.dose) dose = dose + planC{end}.dose{i}; end % Extract dose distributions in three anatomical planes slice = round(size(dose,3)/2); % choose middle slice xy_plane = squeeze(dose(:,:,slice)); xz_plane = squeeze(dose(:,round(size(dose,2)/2),:))'; yz_plane = squeeze(dose(round(size(dose,1)/2),:,:))'; % Calculate and plot DVH for PTV and Rectum ptv_roi_num = 5; rectum_roi_num = 6; ptv_dvh = calcDVH(dose,ptv_roi_num); rectum_dvh = calcDVH(dose,rectum_roi_num); figure; subplot(2,1,1); plot(ptv_dvh.doseBins,ptv_dvh.hist,'LineWidth',2); title('PTV DVH'); subplot(2,1,2); plot(rectum_dvh.doseBins,rectum_dvh.hist,'LineWidth',2); title('Rectum DVH'); % Extract ROI structures ext_roi_num = 1; ptv_roi_num = 5; ext_polygon = planC{end}.structure(ext_roi_num).meshData{end}.polygonData; ptv_polygon = planC{end}.structure(ptv_roi_num).meshData{end}.polygonData; % Plot ROIs figure; fill3(ext_polygon(:,1),ext_polygon(:,2),ext_polygon(:,3),'k','EdgeColor','none','FaceAlpha',0.3); hold on; fill3(ptv_polygon(:,1),ptv_polygon(:,2),ptv_polygon(:,3),'r','EdgeColor','none','FaceAlpha',0.5); % Merge studies and calculate dose distribution mergeStructs([1 2]); % merge pencil-beam and collapsed-cone studies dose = zeros(size(planC{end}.dose)); for i = 1:numel(planC{end}.dose) dose = dose + planC{end}.dose{i}; end
Editor is loading...