MakeFileName : converts from nameInfo structure to the image filename. INPUT : nameInfo : contains information about where numbers are found after strings in strD, for more info look at ReadFileName npos: [4x4 double] strD: {'t' 'c' 'xy' 'z'} basename: before first found strD, eg. 'tsyfp-p-' suffix: after last found number of strD, eg. '.tif' OUTPUT : name : string of format *t*c*xy*z* Copyright (C) 2016 Wiggins Lab Written by Paul Wiggins & Stella Stylianidou. University of Washington, 2016 This file is part of SuperSegger. SuperSegger 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. SuperSegger 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 SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function name = MakeFileName( nameInfo ) 0002 % MakeFileName : converts from nameInfo structure to the image filename. 0003 % 0004 % INPUT : 0005 % nameInfo : contains information about where numbers are found 0006 % after strings in strD, for more info look at ReadFileName 0007 % npos: [4x4 double] 0008 % strD: {'t' 'c' 'xy' 'z'} 0009 % basename: before first found strD, eg. 'tsyfp-p-' 0010 % suffix: after last found number of strD, eg. '.tif' 0011 % OUTPUT : 0012 % name : string of format *t*c*xy*z* 0013 % 0014 % 0015 % Copyright (C) 2016 Wiggins Lab 0016 % Written by Paul Wiggins & Stella Stylianidou. 0017 % University of Washington, 2016 0018 % This file is part of SuperSegger. 0019 % 0020 % SuperSegger is free software: you can redistribute it and/or modify 0021 % it under the terms of the GNU General Public License as published by 0022 % the Free Software Foundation, either version 3 of the License, or 0023 % (at your option) any later version. 0024 % 0025 % SuperSegger is distributed in the hope that it will be useful, 0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0028 % GNU General Public License for more details. 0029 % 0030 % You should have received a copy of the GNU General Public License 0031 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0032 0033 0034 npos = nameInfo.npos; 0035 strD = nameInfo.strD; 0036 basename = nameInfo.basename; 0037 suffix = nameInfo.suffix; 0038 numD = numel(strD); 0039 [tmp,ord] = sort(npos(:,2)); 0040 npos_sort = npos( ord, :); 0041 strD_sort = strD(ord); 0042 0043 name = basename; 0044 for i = 1:numD 0045 if npos_sort(i,2) 0046 str_tmp = ['%0',num2str(npos_sort(i,4)),'d']; 0047 name = [name, strD_sort{i}, sprintf( str_tmp, npos_sort(i,1))]; 0048 end 0049 end 0050 name = [name,suffix]; 0051 end 0052