matRad function to convert cst format Converts a cst with struct array objectives / constraints to the new cst format using a cell array of objects. call newCst = matRad_convertOldCstToNewCstObjectives(cst) input cst a cst cell array that contains the old obectives as struct array output newCst copy of the input cst with all old objectives struct arrays replaced by cell arrays of Objective objects References - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function newCst = matRad_convertOldCstToNewCstObjectives(cst) 0002 % matRad function to convert cst format 0003 % Converts a cst with struct array objectives / constraints to the new cst 0004 % format using a cell array of objects. 0005 % 0006 % call 0007 % newCst = matRad_convertOldCstToNewCstObjectives(cst) 0008 % 0009 % input 0010 % cst a cst cell array that contains the old obectives as struct 0011 % array 0012 % 0013 % output 0014 % newCst copy of the input cst with all old objectives struct arrays 0015 % replaced by cell arrays of Objective objects 0016 % 0017 % References 0018 % - 0019 % 0020 % 0021 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 0023 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 % 0025 % Copyright 2019 the matRad development team. 0026 % 0027 % This file is part of the matRad project. It is subject to the license 0028 % terms in the LICENSE file found in the top-level directory of this 0029 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0030 % of the matRad project, including this file, may be copied, modified, 0031 % propagated, or distributed except according to the terms contained in the 0032 % LICENSE file. 0033 % 0034 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0035 0036 % Copy cst 0037 newCst = cst; 0038 0039 % Loop over cst to convert objectives 0040 for m = 1:size(cst,1) 0041 if ~isempty(cst{m,6}) 0042 %Create empty cell array in the new cst 0043 newCst{m,6} = cell(0); 0044 %For each objective instanciate the appropriate objective object 0045 for n = 1:numel(cst{m,6}) 0046 s = matRad_DoseOptimizationFunction.convertOldOptimizationStruct(cst{m,6}(n)); 0047 newCst{m,6}{n} = s; 0048 end 0049 end 0050 end