matRad function to load HLUT file based on the provided ct call hlut = matRad_loadHLUT(ct, pln) input ct: unprocessed dicom ct data pln: matRad pln struct output hlut: lookup table References - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright 2018 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 hlut = matRad_loadHLUT(ct, pln) 0002 % matRad function to load HLUT file based on the provided ct 0003 % 0004 % call 0005 % hlut = matRad_loadHLUT(ct, pln) 0006 % 0007 % input 0008 % ct: unprocessed dicom ct data 0009 % pln: matRad pln struct 0010 % 0011 % output 0012 % hlut: lookup table 0013 % 0014 % References 0015 % - 0016 % 0017 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0018 % 0019 % Copyright 2018 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 matRad_cfg = MatRad_Config.instance(); 0031 0032 % directory with look up table files 0033 if ~isdeployed 0034 hlutDir = fullfile(fileparts(mfilename('fullpath')),'hlutLibrary',filesep); 0035 else 0036 hlutDir = []; 0037 end 0038 0039 % if possible -> file standard out of dicom tags 0040 try 0041 0042 hlutFileName = ''; 0043 particle = pln.radiationMode; 0044 manufacturer = ct.dicomInfo.Manufacturer; 0045 model = ct.dicomInfo.ManufacturerModelName; 0046 convKernel = ct.dicomInfo.ConvolutionKernel; 0047 0048 hlutFileName = strcat(manufacturer, '-', model, '-ConvolutionKernel-',... 0049 convKernel, '_', particle, '.hlut'); 0050 0051 % check whether fileNames used '-' or '_' instead of blanks 0052 hlutFileCell{1} = hlutFileName; 0053 hlutFileCell{2} = regexprep(hlutFileName,' ','-'); 0054 hlutFileCell{3} = regexprep(hlutFileName,' ','_'); 0055 0056 % add pathname 0057 hlutFileCell = strcat(hlutDir,hlutFileCell); 0058 0059 % check if files exist 0060 existIx = cellfun(@(x) exist(x,'file') == 2,hlutFileCell); 0061 0062 if sum(existIx) == 0 0063 produce an error to enter catch statment below :) 0064 else 0065 hlutFileName = hlutFileCell{existIx}; 0066 end 0067 0068 catch 0069 0070 warnText = ['Could not find HLUT ' hlutFileName ' in hlutLibrary folder.' ... 0071 ' matRad default HLUT loaded']; 0072 warning('off','backtrace') 0073 matRad_cfg.dispWarning(warnText); 0074 0075 % load default HLUT 0076 hlutFileName = strcat(hlutDir,'matRad_default.hlut'); 0077 0078 end 0079 0080 hlut = matRad_readHLUT(hlutFileName); 0081 0082 end