matRad Cube read wrapper determines the extension and assigns the appropriate reader to it call matRad_readCube(filename) input filename: full path of the file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [cube, metadata] = matRad_readCube(filename) 0002 % matRad Cube read wrapper 0003 % determines the extension and assigns the appropriate reader to it 0004 % 0005 % call 0006 % matRad_readCube(filename) 0007 % 0008 % input 0009 % filename: full path of the file 0010 % 0011 % 0012 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0013 % 0014 % Copyright 2015 the matRad development team. 0015 % 0016 % This file is part of the matRad project. It is subject to the license 0017 % terms in the LICENSE file found in the top-level directory of this 0018 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0019 % of the matRad project, including this file, may be copied, modified, 0020 % propagated, or distributed except according to the terms contained in the 0021 % LICENSE file. 0022 % 0023 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 if ~exist(filename,'file') 0026 error(['File ' filename ' does not exist!']); 0027 end 0028 0029 [pathstr,name,ext] = fileparts(filename); 0030 0031 switch ext 0032 case {'.nrrd','.NRRD'} 0033 disp(['Reading NRRD: ' filename '...']); 0034 [cube, metadata] = matRad_readNRRD(filename); 0035 disp('Done!'); 0036 otherwise 0037 error(['Extension ' ext ' not (yet) supported!']); 0038 end 0039 metadata.name = name; 0040 metadata.path = pathstr; 0041 0042 end 0043