ML_SAVEIMAGE Saves images according to the Murphylab title format for easy reading by
0001 function ml_saveimage(img, imgdir,ext) 0002 %ML_SAVEIMAGE Saves images according to the Murphylab title format for easy reading by 0003 0004 %Author: Unknown Date: Unknown 0005 % Copyright (C) 2007-2013 Murphy Lab 0006 % Carnegie Mellon University 0007 % 0008 % This program is free software; you can redistribute it and/or modify 0009 % it under the terms of the GNU General Public License as published 0010 % by the Free Software Foundation; either version 2 of the License, 0011 % or (at your option) any later version. 0012 % 0013 % This program is distributed in the hope that it will be useful, but 0014 % WITHOUT ANY WARRANTY; without even the implied warranty of 0015 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 % General Public License for more details. 0017 % 0018 % You should have received a copy of the GNU General Public License 0019 % along with this program; if not, write to the Free Software 0020 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0021 % 02110-1301, USA. 0022 % 0023 % For additional information visit http://murphylab.web.cmu.edu or 0024 % send email to murphy@cmu.edu 0025 0026 0027 if nargin<3 0028 error('3 arguments are required.'); 0029 end 0030 0031 if ~exist(imgdir, 'dir') 0032 mkdir(imgdir) 0033 end 0034 0035 for i = 1:size(img,3) 0036 imwrite(img(:,:,i), [imgdir filesep 'img.z' num2str(i) '.' ext], ext) 0037 end