matRad_importDicomSteeringPhotons

Purpose ^

matRad function to import a matRad stf struct from dicom RTPLAN data

Synopsis ^

function [stf, pln] = matRad_importDicomSteeringPhotons(pln)

Description ^

 matRad function to import a matRad stf struct from dicom RTPLAN data
 
 call
   [stf, pln] = matRad_importDicomSteeringPhotons(pln)

 input
   pln:            matRad pln struct with meta information (collimation
                   data included)

 output
   stf             matRad stf struct
   pln             matRad pln struct

 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 [stf, pln] = matRad_importDicomSteeringPhotons(pln)
0002 % matRad function to import a matRad stf struct from dicom RTPLAN data
0003 %
0004 % call
0005 %   [stf, pln] = matRad_importDicomSteeringPhotons(pln)
0006 %
0007 % input
0008 %   pln:            matRad pln struct with meta information (collimation
0009 %                   data included)
0010 %
0011 % output
0012 %   stf             matRad stf struct
0013 %   pln             matRad pln struct
0014 %
0015 % References
0016 %
0017 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 %
0019 % Copyright 2015 the matRad development team.
0020 %
0021 % This file is part of the matRad project. It is subject to the license
0022 % terms in the LICENSE file found in the top-level directory of this
0023 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0024 % of the matRad project, including this file, may be copied, modified,
0025 % propagated, or distributed except according to the terms contained in the
0026 % LICENSE file.
0027 %
0028 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0029 
0030 stf = struct;
0031 if ~isfield(pln.propStf.collimation,'Fields')
0032     return
0033 end
0034 
0035 % get fields possessing a field weight vector greater than 0
0036 Fields = pln.propStf.collimation.Fields([pln.propStf.collimation.Fields(:).Weight] > 0);
0037 
0038 [UniqueComb,ia,ib] = unique( vertcat([Fields(:).GantryAngle], [Fields(:).CouchAngle])','rows');
0039 
0040 % return corret angles to pln, because some angle derivations might be
0041 % only in the control point sequences
0042 pln.propStf.gantryAngles = UniqueComb(:,1)';
0043 pln.propStf.couchAngles  = UniqueComb(:,2)';
0044 
0045 stf = struct;
0046 % loop over all fields
0047 for i = 1:size(UniqueComb,1)
0048     % set necessary steering information
0049     stf(i).gantryAngle  = UniqueComb(i,1);
0050     stf(i).couchAngle   = UniqueComb(i,2);
0051     stf(i).isoCenter    = pln.propStf.isoCenter(i,:);
0052     
0053     % bixelWidth = 'field' as keyword for whole field dose calc
0054     stf(i).bixelWidth    = 'field';
0055     stf(i).radiationMode = 'photons';
0056     
0057     % only one bixel per ray and one ray for photon dose calc based on
0058     % fields
0059     stf(i).numOfBixelsPerRay = 1;
0060     stf(i).numOfRays         = 1;
0061     stf(i).totalNumOfBixels  = stf(i).numOfRays;
0062     stf(i).SAD               = Fields(ia(i)).SAD;
0063     stf(i).sourcePoint_bev   = [0 -stf(i).SAD 0];
0064     
0065     % coordinate transformation with rotation matrix.
0066     % use transpose matrix because we are working with row vectors
0067     rotMat_vectors_T = transpose(matRad_getRotationMatrix(stf(i).gantryAngle,stf(i).couchAngle));
0068 
0069 
0070     % Rotated Source point (1st gantry, 2nd couch)
0071     stf(i).sourcePoint = stf(i).sourcePoint_bev*rotMat_vectors_T;
0072     
0073     % only one ray in center position
0074     stf(i).ray.rayPos_bev = [0 0 0];
0075     stf(i).ray.rayPos     = stf(i).ray.rayPos_bev*rotMat_vectors_T;
0076 
0077     % target point is for ray in center position at
0078     stf(i).ray.targetPoint_bev = [0 stf(i).SAD 0];
0079     stf(i).ray.targetPoint     = stf(i).ray.targetPoint_bev*rotMat_vectors_T;
0080     
0081     % set weight for output field
0082     stf(i).ray.weight = 1; % weighting incorporated into primary fluence --> finalShape
0083     %stf(i).ray.SSD    = Fields(ia(i)).SSD;
0084     stf(i).ray.energy = Fields(ia(i)).Energy;  
0085     
0086     ix = (ib == i);
0087     currFieldSeq = Fields(ix);
0088     
0089     % add weighted shapes for the current beam
0090     finalShape = 0;
0091     for j = 1:sum(ix)
0092         finalShape = finalShape + currFieldSeq(j).Weight * currFieldSeq(j).Shape;
0093     end
0094     stf(i).ray.shape = finalShape;
0095 
0096 end
0097

| Generated by m2html © 2005