matRad function to visualize imported field shapes from a dicom RTPLAN data. Note that this only works with pln structures that were generated with matRad's dicom import tool and feature the appropriate field shape information call matRad_visPhotonFieldShapes(pln) input pln: matRad plan struct output - References - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright 2020 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 matRad_visPhotonFieldShapes(pln) 0002 % matRad function to visualize imported field shapes from a dicom RTPLAN 0003 % data. Note that this only works with pln structures that were generated 0004 % with matRad's dicom import tool and feature the appropriate field shape 0005 % information 0006 % 0007 % call 0008 % matRad_visPhotonFieldShapes(pln) 0009 % 0010 % input 0011 % pln: matRad plan struct 0012 % 0013 % output 0014 % - 0015 % 0016 % References 0017 % - 0018 % 0019 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 % 0021 % Copyright 2020 the matRad development team. 0022 % 0023 % This file is part of the matRad project. It is subject to the license 0024 % terms in the LICENSE file found in the top-level directory of this 0025 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0026 % of the matRad project, including this file, may be copied, modified, 0027 % propagated, or distributed except according to the terms contained in the 0028 % LICENSE file. 0029 % 0030 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0031 0032 if ~isfield(pln, 'propStf') || ~isfield(pln.propStf, 'collimation') 0033 error(['This function only works with field shapes stemming from a DICOM ' ... 0034 'photon plan import. For matRad''s native aperture info struct you ' ... 0035 'may want to check out https://github.com/e0404/matRad/blob/master/matRad_visApertureInfo.m '... 0036 'as shown in https://github.com/e0404/matRad/blob/master/examples/matRad_example3_photonsDAO.m']); 0037 end 0038 0039 coords = [-pln.propStf.collimation.fieldWidth/2 ... 0040 :pln.propStf.collimation.convResolution ... 0041 :pln.propStf.collimation.fieldWidth/2-pln.propStf.collimation.convResolution]; 0042 0043 fieldShapeFigureHandle = figure; 0044 fieldShapeAxisHandle = axes(fieldShapeFigureHandle); 0045 0046 for i = 1: pln.propStf.collimation.numOfFields 0047 0048 cla(fieldShapeAxisHandle) 0049 0050 imagesc(fieldShapeAxisHandle, coords, coords, pln.propStf.collimation.Fields(i).Shape) 0051 0052 xlabel(fieldShapeAxisHandle, '[mm]') 0053 ylabel(fieldShapeAxisHandle, '[mm]') 0054 0055 title(fieldShapeAxisHandle, ['field shape i: ' num2str(i) ' @ gantry = ' num2str(pln.propStf.collimation.Fields(i).GantryAngle) '° and couch = ' num2str(pln.propStf.collimation.Fields(i).CouchAngle) '°']) 0056 axis(fieldShapeAxisHandle, 'equal', 'tight') 0057 0058 drawnow 0059 pause(.1) 0060 0061 end