matRad tool function to directly plot a complete slice of a ct with dose including contours and isolines. call [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,alpha) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,contourColorMap) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseColorMap) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseWindow) [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseIsoLevels) ... [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh,alpha,contourColorMap,... doseColorMap,doseWindow,doseIsoLevels,voiSelection,colorBarLabel,boolPlotLegend,...) input (required) axesHandle handle to axes the slice should be displayed in ct matRad ct struct cst matRad cst struct cubeIdx Index of the desired cube in the ct struct dose dose cube plane plane view (coronal=1,sagittal=2,axial=3) slice slice in the selected plane of the 3D cube input (optional / empty) thresh threshold for display of dose values alpha alpha value for the dose overlay contourColorMap colormap for the VOI contours doseColorMap colormap for the dose doseWindow dose value window doseIsoLevels levels defining the isodose contours voiSelection logicals defining the current selection of contours that should be plotted. Can be set to [] to plot all non-ignored contours. colorBarLabel string defining the yLabel of the colorBar boolPlotLegend boolean if legend should be plottet or not varargin additional input parameters that are passed on to individual plotting functions (e.g. 'LineWidth',1.5) output hCMap handle to the colormap hDose handle to the dose plot hCt handle to the ct plot hContour handle to the contour plot hIsoDose handle to iso dose contours References - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright 2015 the matRad development team. This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh,alpha,contourColorMap,... 0002 doseColorMap,doseWindow,doseIsoLevels,voiSelection,colorBarLabel,boolPlotLegend,varargin) 0003 % matRad tool function to directly plot a complete slice of a ct with dose 0004 % including contours and isolines. 0005 % 0006 % call 0007 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice) 0008 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh) 0009 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,alpha) 0010 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,contourColorMap) 0011 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseColorMap) 0012 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseWindow) 0013 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,doseIsoLevels) 0014 % ... 0015 % [hCMap,hDose,hCt,hContour,hIsoDose] = matRad_plotSliceWrapper(axesHandle,ct,cst,cubeIdx,dose,plane,slice,thresh,alpha,contourColorMap,... 0016 % doseColorMap,doseWindow,doseIsoLevels,voiSelection,colorBarLabel,boolPlotLegend,...) 0017 % 0018 % input (required) 0019 % axesHandle handle to axes the slice should be displayed in 0020 % ct matRad ct struct 0021 % cst matRad cst struct 0022 % cubeIdx Index of the desired cube in the ct struct 0023 % dose dose cube 0024 % plane plane view (coronal=1,sagittal=2,axial=3) 0025 % slice slice in the selected plane of the 3D cube 0026 % 0027 % input (optional / empty) 0028 % thresh threshold for display of dose values 0029 % alpha alpha value for the dose overlay 0030 % contourColorMap colormap for the VOI contours 0031 % doseColorMap colormap for the dose 0032 % doseWindow dose value window 0033 % doseIsoLevels levels defining the isodose contours 0034 % voiSelection logicals defining the current selection of contours 0035 % that should be plotted. Can be set to [] to plot 0036 % all non-ignored contours. 0037 % colorBarLabel string defining the yLabel of the colorBar 0038 % boolPlotLegend boolean if legend should be plottet or not 0039 % varargin additional input parameters that are passed on to 0040 % individual plotting functions (e.g. 'LineWidth',1.5) 0041 % 0042 % 0043 % output 0044 % hCMap handle to the colormap 0045 % hDose handle to the dose plot 0046 % hCt handle to the ct plot 0047 % hContour handle to the contour plot 0048 % hIsoDose handle to iso dose contours 0049 % 0050 % References 0051 % - 0052 % 0053 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0054 % 0055 % Copyright 2015 the matRad development team. 0056 % 0057 % This file is part of the matRad project. It is subject to the license 0058 % terms in the LICENSE file found in the top-level directory of this 0059 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0060 % of the matRad project, including this file, may be copied, modified, 0061 % propagated, or distributed except according to the terms contained in the 0062 % LICENSE file. 0063 % 0064 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0065 0066 % Handle the argument list 0067 if ~exist('thresh','var') || isempty(thresh) 0068 thresh = []; 0069 end 0070 if ~exist('alpha','var') || isempty(alpha) 0071 alpha = []; 0072 end 0073 if ~exist('contourColorMap','var') || isempty(contourColorMap) 0074 contourColorMap = []; 0075 end 0076 if ~exist('doseColorMap','var') || isempty(doseColorMap) 0077 doseColorMap = []; 0078 end 0079 if ~exist('doseWindow','var') || isempty(doseWindow) 0080 doseWindow = []; 0081 end 0082 if ~exist('doseIsoLevels','var') || isempty(doseIsoLevels) 0083 doseIsoLevels = []; 0084 end 0085 0086 if ~exist('voiSelection','var') || isempty(voiSelection) 0087 voiSelection = []; 0088 end 0089 0090 if ~exist('colorBarLabel','var') || isempty(colorBarLabel) 0091 colorBarLabel = []; 0092 end 0093 0094 if ~exist('boolPlotLegend','var') || isempty(boolPlotLegend) 0095 boolPlotLegend = false; 0096 end 0097 0098 if ~exist('cst','var') || isempty(cst) 0099 cst = []; 0100 end 0101 0102 set(axesHandle,'YDir','Reverse'); 0103 % plot ct slice 0104 hCt = matRad_plotCtSlice(axesHandle,ct.cubeHU,cubeIdx,plane,slice); 0105 hold on; 0106 0107 % plot dose 0108 [hDose,doseColorMap,doseWindow] = matRad_plotDoseSlice(axesHandle,dose,plane,slice,thresh,alpha,doseColorMap,doseWindow); 0109 0110 % plot iso dose lines 0111 if ~isempty(doseIsoLevels) 0112 hIsoDose = matRad_plotIsoDoseLines(axesHandle,dose,[],doseIsoLevels,false,plane,slice,doseColorMap,doseWindow,varargin{:}); 0113 hold on; 0114 else 0115 hIsoDose = []; 0116 end 0117 0118 %plot VOI contours 0119 if ~isempty(cst) 0120 hContour = matRad_plotVoiContourSlice(axesHandle,cst,ct.cubeHU,cubeIdx,voiSelection,plane,slice,contourColorMap,varargin{:}); 0121 0122 if boolPlotLegend 0123 visibleOnSlice = (~cellfun(@isempty,hContour)); 0124 ixLegend = find(voiSelection); 0125 hContourTmp = cellfun(@(X) X(1),hContour(visibleOnSlice),'UniformOutput',false); 0126 if ~isempty(voiSelection) 0127 hLegend = legend(axesHandle,[hContourTmp{:}],[cst(ixLegend(visibleOnSlice),2)],'AutoUpdate','off'); 0128 else 0129 hLegend = legend(axesHandle,[hContourTmp{:}],[cst(visibleOnSlice,2)],'AutoUpdate','off'); 0130 end 0131 set(hLegend,'Box','Off'); 0132 set(hLegend,'TextColor',[1 1 1]); 0133 set(hLegend,'FontSize',12); 0134 0135 end 0136 else 0137 hContour = []; 0138 end 0139 0140 axis(axesHandle,'tight'); 0141 set(axesHandle,'xtick',[],'ytick',[]); 0142 colormap(axesHandle,doseColorMap); 0143 0144 matRad_plotAxisLabels(axesHandle,ct,plane,slice,[]) 0145 0146 % set axis ratio 0147 0148 ratios = [1/ct.resolution.x 1/ct.resolution.y 1/ct.resolution.z]; 0149 0150 set(axesHandle,'DataAspectRatioMode','manual'); 0151 if plane == 1 0152 res = [ratios(3) ratios(2)]./max([ratios(3) ratios(2)]); 0153 set(axesHandle,'DataAspectRatio',[res 1]) 0154 elseif plane == 2 % sagittal plane 0155 res = [ratios(3) ratios(1)]./max([ratios(3) ratios(1)]); 0156 set(axesHandle,'DataAspectRatio',[res 1]) 0157 elseif plane == 3 % Axial plane 0158 res = [ratios(2) ratios(1)]./max([ratios(2) ratios(1)]); 0159 set(axesHandle,'DataAspectRatio',[res 1]) 0160 end 0161 0162 hCMap = matRad_plotColorbar(axesHandle,doseColorMap,doseWindow,'Location','EastOutside'); 0163 if ~isempty(colorBarLabel) 0164 set(get(hCMap,'YLabel'),'String', colorBarLabel,'FontSize',14); 0165 end 0166 0167 end 0168