%% Author: Rodrigo de Barros Vimieiro % Date: Jun, 2018 % rodrigo.vimieiro@gmail.com % ========================================================================= %{ % ------------------------------------------------------------------------- % saveData(dataRecon3d,parameter,title,folder,infoDicom) % ------------------------------------------------------------------------- % DESCRIPTION: % This function save projections of a virtual phantom or % reconstructed data. % % % INPUT: % - dataRecon3d = Reconstructed data % - parameter = Parameter of all geometry % - title = Title of the data (Dicom, Shepp-Logan, VCT) % - infoDicom = Dicom header from projections % - folder = Folder to save the data % % --------------------------------------------------------------------- % Copyright (C) <2018> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . %} % ========================================================================= %% Save data function saveData(dataRecon3d,varargin) optionals = {[],[],[],[]}; % Placeholder for inputs numInputs = nargin - 1; % Minus number of required inputs inputVar = 1; while numInputs > 0 if ~isempty(varargin{inputVar}) optionals{inputVar} = varargin{inputVar}; end inputVar = inputVar + 1; numInputs = numInputs - 1; end parameter = optionals{1}; title = optionals{2}; folder = optionals{3}; infoDicom = optionals{4}; if(isempty(folder)) folder='Output'; else mkdir([folder,filesep,title]); end % Some more informations to save for k=1:size(dataRecon3d,2) info = dataRecon3d{2,k}; info.Title = title; dataRecon3d{2,k} = info; end filestring = [folder,filesep,title,filesep,'Reconstruction-',info.reconMeth]; % Dicom breast/virtual phantom images if(~isempty(infoDicom)) fprintf('\nWriting images ') writeDicom(dataRecon3d,infoDicom,filestring,info.reconMeth,parameter); else writeDcm(dataRecon3d,filestring,parameter) end fprintf('\nSaving data...') save(filestring,'dataRecon3d','-v7.3') end