matRad_visApertureInfo

Purpose ^

matRad function to visualize aperture shapes stored as struct

Synopsis ^

function matRad_visApertureInfo(apertureInfo,mode)

Description ^

 matRad function to visualize aperture shapes stored as struct

 call
   matRad_visApertureInfo(apertureInfo,mode)

 input
   apertureInfo: aperture weight and shape info struct
   mode:         switch to display leaf numbers ('leafNum') or physical
                 coordinates of the leaves ('physical')

 output
   -

 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 matRad_visApertureInfo(apertureInfo,mode)
0002 % matRad function to visualize aperture shapes stored as struct
0003 %
0004 % call
0005 %   matRad_visApertureInfo(apertureInfo,mode)
0006 %
0007 % input
0008 %   apertureInfo: aperture weight and shape info struct
0009 %   mode:         switch to display leaf numbers ('leafNum') or physical
0010 %                 coordinates of the leaves ('physical')
0011 %
0012 % output
0013 %   -
0014 %
0015 % References
0016 %
0017 %   -
0018 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0019 %
0020 % Copyright 2015 the matRad development team.
0021 %
0022 % This file is part of the matRad project. It is subject to the license
0023 % terms in the LICENSE file found in the top-level directory of this
0024 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0025 % of the matRad project, including this file, may be copied, modified,
0026 % propagated, or distributed except according to the terms contained in the
0027 % LICENSE file.
0028 %
0029 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 
0031 if nargin < 2 % set default mode to physical
0032     mode = 'leafNum'; % options: 'physical','leafNum'
0033 end
0034 
0035 % global parameters
0036 numOfBeams = size(apertureInfo.beam,2);
0037 bixelWidth = apertureInfo.bixelWidth;
0038 
0039 % custom colormap
0040 color = [0.2:0.01:0.8; 0.2:0.01:0.8; 0.2:0.01:0.8]';
0041 color = flipud(color);
0042 color(:,3) = 0;
0043 color(:,2) = 0;
0044 
0045 % loop over all beams
0046 for i=1:numOfBeams
0047 
0048     % open new figure for every beam
0049     figure('units','inches')
0050 
0051     % get the MLC dimensions for this beam
0052     minX = apertureInfo.beam(i).MLCWindow(1);
0053     maxX = apertureInfo.beam(i).MLCWindow(2);    
0054     
0055     %get maximum weight
0056     wMax = max([apertureInfo.beam(i).shape(:).weight]);
0057     if strcmp(mode,'leafNum')
0058 
0059         % get the active leaf Pairs
0060         % the leaf indices have to be flipped in order to fit to the order of
0061         % the leaf positions (1st row of leafPos is lowest row in physical
0062         % coordinates
0063         activeLeafInd = flipud(find(apertureInfo.beam(i).isActiveLeafPair));
0064     end
0065     
0066     subplotColumns = ceil(apertureInfo.beam(i).numOfShapes/2);
0067     subplotLines   = ceil(apertureInfo.beam(i).numOfShapes/subplotColumns);
0068     %adjust figure position
0069     set(gcf,'pos',[0 0 1.8*subplotColumns 3*subplotLines])
0070     
0071     % loop over all shapes of the beam
0072     for j = 1:apertureInfo.beam(i).numOfShapes
0073         
0074         % creating subplots
0075         subplot(subplotLines,subplotColumns,j)
0076 
0077         title(['Beam: ' num2str(i) ' Shape: ' num2str(j) ' w=' ...
0078                 num2str(apertureInfo.beam(i).shape(j).weight,2)],...
0079                     'Fontsize',8)
0080         colorInd = max(ceil((apertureInfo.beam(i).shape(j).weight/wMax)*61+eps),1);
0081         set(gca,'Color',color(colorInd,:));
0082         
0083         hold on
0084         
0085         if strcmp(mode,'physical')
0086             % loop over all active leaf pairs
0087             for k = 1:apertureInfo.beam(i).numOfActiveLeafPairs
0088                 fill([minX apertureInfo.beam(i).shape(j).leftLeafPos(k) ...
0089                         apertureInfo.beam(i).shape(j).leftLeafPos(k) minX],...
0090                         [apertureInfo.beam(i).leafPairPos(k)- bixelWidth/2 ...
0091                         apertureInfo.beam(i).leafPairPos(k)- bixelWidth/2 ...
0092                         apertureInfo.beam(i).leafPairPos(k)+ bixelWidth/2 ...
0093                         apertureInfo.beam(i).leafPairPos(k)+ bixelWidth/2],'b')
0094                  fill([apertureInfo.beam(i).shape(j).rightLeafPos(k) ...
0095                         maxX maxX ...
0096                         apertureInfo.beam(i).shape(j).rightLeafPos(k)],...
0097                         [apertureInfo.beam(i).leafPairPos(k)- bixelWidth/2 ...
0098                         apertureInfo.beam(i).leafPairPos(k)- bixelWidth/2 ...
0099                         apertureInfo.beam(i).leafPairPos(k)+ bixelWidth/2 ...
0100                         apertureInfo.beam(i).leafPairPos(k)+ bixelWidth/2],'b')                
0101             end
0102         elseif strcmp(mode,'leafNum')
0103             % loop over all active leaf pairs
0104             for k = 1:apertureInfo.beam(i).numOfActiveLeafPairs
0105                 fill([minX apertureInfo.beam(i).shape(j).leftLeafPos(k) ...
0106                     apertureInfo.beam(i).shape(j).leftLeafPos(k) minX],...
0107                     [activeLeafInd(k) - 1/2 ...
0108                     activeLeafInd(k) - 1/2 ...
0109                     activeLeafInd(k) + 1/2 ...
0110                     activeLeafInd(k) + 1/2],'b') 
0111                 fill([apertureInfo.beam(i).shape(j).rightLeafPos(k) ...
0112                     maxX maxX ...
0113                     apertureInfo.beam(i).shape(j).rightLeafPos(k)],...
0114                     [activeLeafInd(k) - 1/2 ...
0115                     activeLeafInd(k) - 1/2 ...
0116                     activeLeafInd(k) + 1/2 ...
0117                     activeLeafInd(k) + 1/2],'b')                
0118             end
0119         end
0120     
0121         axis tight
0122         xlabel('horiz. pos. [mm]')
0123 
0124         if strcmp(mode,'physical')
0125             ylabel('vert. pos. [mm]')
0126         elseif strcmp(mode,'leafNum')
0127             ylabel('leaf pair #')
0128         end
0129     
0130     end
0131 
0132 end
0133 
0134 end

| Generated by m2html © 2005