matRad function to calculate the equivalent densities from a dicom ct that originally uses intensity values call ct = matRad_calcWaterEqD(ct, pln) input ct: unprocessed dicom ct data which are stored as intensity values (IV) HU = IV * slope + intercept pln: matRad plan struct output ct: ct struct with cube with relative _electron_ densities 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 ct = matRad_calcWaterEqD(ct, pln) 0002 % matRad function to calculate the equivalent densities from a dicom ct 0003 % that originally uses intensity values 0004 % 0005 % call 0006 % ct = matRad_calcWaterEqD(ct, pln) 0007 % 0008 % input 0009 % ct: unprocessed dicom ct data which are stored as intensity values (IV) 0010 % 0011 % HU = IV * slope + intercept 0012 % 0013 % pln: matRad plan struct 0014 % 0015 % output 0016 % ct: ct struct with cube with relative _electron_ densities 0017 % 0018 % References 0019 % - 0020 % 0021 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 % 0023 % Copyright 2018 the matRad development team. 0024 % 0025 % This file is part of the matRad project. It is subject to the license 0026 % terms in the LICENSE file found in the top-level directory of this 0027 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0028 % of the matRad project, including this file, may be copied, modified, 0029 % propagated, or distributed except according to the terms contained in the 0030 % LICENSE file. 0031 % 0032 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0033 0034 % load hlut 0035 hlut = matRad_loadHLUT(ct, pln); 0036 0037 for i = 1:ct.numOfCtScen 0038 0039 % Manual adjustments if ct data is corrupt. If some values are out of range 0040 % of the LUT, then these values are adjusted. 0041 if max(ct.cubeHU{i}(:)) > max(hlut(:,1)) 0042 warning('projecting out of range HU values'); 0043 ct.cubeHU{i}(ct.cubeHU{i} > max(hlut(:,1))) = max(hlut(:,1)); 0044 end 0045 if min(ct.cubeHU{i}(:)) < min(hlut(:,1)) 0046 warning('projecting out of range HU values'); 0047 ct.cubeHU{i}(ct.cubeHU{i} < min(hlut(:,1))) = min(hlut(:,1)); 0048 end 0049 0050 % interpolate HU to relative electron density or relative stopping power based on lookup table 0051 ct.cube{i} = reshape(matRad_interp1(hlut(:,1),hlut(:,2),double(ct.cubeHU{i}(:))),ct.cubeDim); 0052 0053 end 0054 0055 % save hlut 0056 ct.hlut = hlut; 0057 0058 end