matRad_plotIsoCenterMarker

Purpose ^

matRad function that plots an isocenter marker

Synopsis ^

function markerHandle = matRad_plotIsoCenterMarker(axesHandle,pln,ct,plane,slice,style)

Description ^

 matRad function that plots an isocenter marker

 call
   markerHandle = matRad_plotIsoCenterMarker(axesHandle,pln,ct,plane,slice)
   markerHandle = matRad_plotIsoCenterMarker(axesHandle,pln,ct,plane,slice,style)

 input
   axesHandle          handle to axes the marker should be displayed in
   pln                 matRad plan structure
   ct                  matRad ct structure
   plane               plane view (coronal=1,sagittal=2,axial=3)
   slice               slice in the selected plane of the 3D cube
   style               optional argument can be 'marker' or 'lines'. 
                       this might be useful for some issues 
                       with export to tikz for example
                       

 output
   markerHandle:       handle to the isocenter marker

 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 markerHandle = matRad_plotIsoCenterMarker(axesHandle,pln,ct,plane,slice,style)
0002 % matRad function that plots an isocenter marker
0003 %
0004 % call
0005 %   markerHandle = matRad_plotIsoCenterMarker(axesHandle,pln,ct,plane,slice)
0006 %   markerHandle = matRad_plotIsoCenterMarker(axesHandle,pln,ct,plane,slice,style)
0007 %
0008 % input
0009 %   axesHandle          handle to axes the marker should be displayed in
0010 %   pln                 matRad plan structure
0011 %   ct                  matRad ct structure
0012 %   plane               plane view (coronal=1,sagittal=2,axial=3)
0013 %   slice               slice in the selected plane of the 3D cube
0014 %   style               optional argument can be 'marker' or 'lines'.
0015 %                       this might be useful for some issues
0016 %                       with export to tikz for example
0017 %
0018 %
0019 % output
0020 %   markerHandle:       handle to the isocenter marker
0021 %
0022 % References
0023 %
0024 %   -
0025 %
0026 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0027 %
0028 % Copyright 2015 the matRad development team.
0029 %
0030 % This file is part of the matRad project. It is subject to the license
0031 % terms in the LICENSE file found in the top-level directory of this
0032 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0033 % of the matRad project, including this file, may be copied, modified,
0034 % propagated, or distributed except according to the terms contained in the
0035 % LICENSE file.
0036 %
0037 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0038 
0039 uniqueIsoCenters = unique(pln.propStf.isoCenter,'rows');
0040 
0041 for i = 1:size(uniqueIsoCenters,1)
0042 
0043     vIsoCenter           = round(uniqueIsoCenters(i,:)./[ct.resolution.x ct.resolution.y ct.resolution.z]);
0044     if  plane == 3% Axial plane
0045         vIsoCenterPlot  = [vIsoCenter(1) vIsoCenter(2)];
0046         if vIsoCenter(3) == slice
0047             isoCenterDirection = 0;
0048         else 
0049             isoCenterDirection = sign(double(vIsoCenter(3) > slice) - 0.5);
0050         end
0051     elseif plane == 2
0052         vIsoCenterPlot  = [vIsoCenter(3) vIsoCenter(2)];
0053         if vIsoCenter(2) == slice
0054             isoCenterDirection = 0;
0055         else
0056             isoCenterDirection = sign(double(vIsoCenter(1) > slice) - 0.5);
0057         end
0058 
0059     elseif plane == 1    
0060         vIsoCenterPlot  = [vIsoCenter(3) vIsoCenter(1)];
0061         if vIsoCenter(1) == slice
0062             isoCenterDirection = 0;
0063         else
0064             isoCenterDirection = sign(double(vIsoCenter(2) > slice) - 0.5);
0065         end
0066     end
0067 
0068 
0069 
0070     if nargin < 6
0071         style = 'lines';
0072     end
0073 
0074     if strcmpi(style,'lines') == 0 && strcmpi(style,'marker') == 0
0075         warning('Style option not recognized. Using lines as default');
0076         style = 'lines';
0077     end
0078 
0079     markerSize = 36/ct.resolution.x;
0080     markerColor = [0.27 0.27 0.27];
0081 
0082     if strcmpi(style,'marker')
0083         if isoCenterDirection > 0
0084             markerStyle = '^';
0085         elseif isoCenterDirection < 0
0086             markerStyle = 'v';
0087         else
0088             markerStyle = 'x';
0089             markerColor = [0 0 0];
0090         end    
0091         markerHandle = plot(axesHandle,vIsoCenterPlot(1),vIsoCenterPlot(2),markerStyle,'MarkerSize',markerSize,'LineWidth',4,'Color',markerColor);
0092     else
0093         if isoCenterDirection > 0
0094             linesX = [vIsoCenterPlot(1)-markerSize/4 vIsoCenterPlot(1) vIsoCenterPlot(1)+markerSize/4];
0095             linesY = [vIsoCenterPlot(2)+markerSize/4 vIsoCenterPlot(2) vIsoCenterPlot(2)+markerSize/4];
0096         elseif isoCenterDirection < 0        
0097             linesX = [vIsoCenterPlot(1)-markerSize/4 vIsoCenterPlot(1) vIsoCenterPlot(1)+markerSize/4];
0098             linesY = [vIsoCenterPlot(2)-markerSize/4 vIsoCenterPlot(2) vIsoCenterPlot(2)-markerSize/4];
0099         else
0100             linesX = [vIsoCenterPlot(1)-markerSize/4 vIsoCenterPlot(1)-markerSize/4; vIsoCenterPlot(1)+markerSize/4 vIsoCenterPlot(1)+markerSize/4];
0101             linesY = [vIsoCenterPlot(2)-markerSize/4 vIsoCenterPlot(2)+markerSize/4; vIsoCenterPlot(2)+markerSize/4 vIsoCenterPlot(2)-markerSize/4];
0102             markerColor = [0 0 0];
0103         end
0104 
0105         markerHandle = line(linesX,linesY,'LineWidth',4,'Color',markerColor,'Parent',axesHandle);
0106     end
0107 
0108 end

| Generated by m2html © 2005