matRad_plotDoseSlice

Purpose ^

matRad function that generates a dose plot of a selected slice

Synopsis ^

function [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle,doseCube,plane,slice,threshold,alpha,cMap,window)

Description ^

 matRad function that generates a dose plot of a selected slice 
 The function can also be used in personal matlab figures by passing the
 corresponding axes handle.

 call
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,cMap)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,window)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha,cMap)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha,window)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,cMap,window)
   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha,cMap,window)

 input
   axesHandle  handle to axes the slice should be displayed in
   doseCube    3D array of the dose to select the slice from
   plane       plane view (coronal=1,sagittal=2,axial=3)
   slice       slice in the selected plane of the 3D cube
   threshold   threshold above which the dose shall be displayed
               for negative values (i.e. difference maps), also the values
               smaller than the negative threshold will be displayed
               if empty, no threshold will be applied
   alpha       optional argument defining the alpha value, default is 0.6.
               To use the default when providing a custom culormap, put in
               an empty array by [].
   cMap        optional argument defining the colormap, default is jet
               if you want to use the default map with the window argument
               you can use an empty array []
   window      optional argument defining the displayed range. default is
               [min(doseCube(:)) max(doseCube(:))]

 output
   doseHandle: handle of the plotted dose axes
   cMap        used colormap (same as input if set)
   window      used window (same as input if set)

 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.

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Cross-reference information ^

This function calls: This function is called by:

Source code ^

0001 function [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle,doseCube,plane,slice,threshold,alpha,cMap,window)
0002 % matRad function that generates a dose plot of a selected slice
0003 % The function can also be used in personal matlab figures by passing the
0004 % corresponding axes handle.
0005 %
0006 % call
0007 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold)
0008 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha)
0009 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,cMap)
0010 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,window)
0011 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha,cMap)
0012 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha,window)
0013 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,cMap,window)
0014 %   [doseHandle,cMap,window] = matRad_plotDoseSlice(axesHandle, doseCube,plane,slice,threshold,alpha,cMap,window)
0015 %
0016 % input
0017 %   axesHandle  handle to axes the slice should be displayed in
0018 %   doseCube    3D array of the dose to select the slice from
0019 %   plane       plane view (coronal=1,sagittal=2,axial=3)
0020 %   slice       slice in the selected plane of the 3D cube
0021 %   threshold   threshold above which the dose shall be displayed
0022 %               for negative values (i.e. difference maps), also the values
0023 %               smaller than the negative threshold will be displayed
0024 %               if empty, no threshold will be applied
0025 %   alpha       optional argument defining the alpha value, default is 0.6.
0026 %               To use the default when providing a custom culormap, put in
0027 %               an empty array by [].
0028 %   cMap        optional argument defining the colormap, default is jet
0029 %               if you want to use the default map with the window argument
0030 %               you can use an empty array []
0031 %   window      optional argument defining the displayed range. default is
0032 %               [min(doseCube(:)) max(doseCube(:))]
0033 %
0034 % output
0035 %   doseHandle: handle of the plotted dose axes
0036 %   cMap        used colormap (same as input if set)
0037 %   window      used window (same as input if set)
0038 %
0039 % References
0040 %   -
0041 %
0042 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0043 %
0044 % Copyright 2015 the matRad development team.
0045 %
0046 % This file is part of the matRad project. It is subject to the license
0047 % terms in the LICENSE file found in the top-level directory of this
0048 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0049 % of the matRad project, including this file, may be copied, modified,
0050 % propagated, or distributed except according to the terms contained in the
0051 % LICENSE file.
0052 %
0053 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0054 
0055 matRad_cfg = MatRad_Config.instance();
0056 
0057 %Use default colormap?
0058 if nargin < 7 || isempty(cMap)
0059     cMap = jet(64);
0060 end
0061 if nargin < 6 || isempty(alpha)
0062     alpha = 0.6;
0063 end
0064 if nargin < 8 || isempty(window)
0065     window = [min(doseCube(:)) max(doseCube(:))];
0066 end
0067 
0068 maxDose = max(doseCube(:));
0069 
0070 cMapScale = size(cMap,1) - 1;
0071 
0072 if plane == 1  % Coronal plane
0073     dose_slice = squeeze(doseCube(slice,:,:));
0074 elseif plane == 2 % sagittal plane
0075     dose_slice = squeeze(doseCube(:,slice,:));
0076 elseif plane == 3 % Axial plane
0077     dose_slice = squeeze(doseCube(:,:,slice));
0078 else
0079     matRad_cfg.dispError('Invalid plane ''%d'' selected for visualization!',plane);
0080 end
0081 
0082 if ~isempty(threshold)
0083     mask = alpha * (dose_slice < window(2) & dose_slice > window(1) & dose_slice > threshold*maxDose);
0084 else
0085     mask = alpha * (dose_slice < window(2) & dose_slice > window(1));
0086 end
0087 
0088 dose_slice = uint8(cMapScale*(dose_slice - window(1))/(window(2)-window(1)));
0089 
0090 %This circumenvents a bug in Octave when the index in the image hase the maximum value of uint8
0091 if matRad_cfg.isOctave
0092     dose_slice(dose_slice == 255) = 254;
0093 end
0094 
0095 dose_rgb = ind2rgb(dose_slice,cMap);
0096 
0097 % plot dose distribution
0098 doseHandle = image('CData',dose_rgb,'Parent',axesHandle);
0099 
0100 % alphadata for image objects is not yet implemented in Octave
0101 set(doseHandle,'AlphaData',mask);
0102 
0103 end
0104 
0105

| Generated by m2html © 2005