isRightNameFormat : returns true if .tif images in the directory have the right naming convention. INPUT : dirname : directory name with images OUTPUT : rightNames : true if they have the right naming convention Copyright (C) 2016 Wiggins Lab Written by 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 [rightNames] = isRightNameFormat(dirname) 0002 % isRightNameFormat : returns true if .tif images in the directory have the 0003 % right naming convention. 0004 % INPUT : 0005 % dirname : directory name with images 0006 % OUTPUT : 0007 % rightNames : true if they have the right naming convention 0008 % 0009 % 0010 % Copyright (C) 2016 Wiggins Lab 0011 % Written by Stella Stylianidou. 0012 % University of Washington, 2016 0013 % This file is part of SuperSegger. 0014 % 0015 % SuperSegger is free software: you can redistribute it and/or modify 0016 % it under the terms of the GNU General Public License as published by 0017 % the Free Software Foundation, either version 3 of the License, or 0018 % (at your option) any later version. 0019 % 0020 % SuperSegger is distributed in the hope that it will be useful, 0021 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0022 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0023 % GNU General Public License for more details. 0024 % 0025 % You should have received a copy of the GNU General Public License 0026 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0027 0028 0029 contents = dir([dirname,filesep,'*.tif']); 0030 filenames = {contents.name}'; 0031 0032 nameWithXy=regexpi(filenames,'t\d+xy\d+c\d+.tif','once'); 0033 nameWithoutXy=regexpi(filenames,'t\d+c\d+.tif','once'); 0034 nameWithoutt=regexpi(filenames,'xy\d+c\d+.tif','once'); 0035 0036 numWithXy = sum(~cellfun('isempty',nameWithXy)); 0037 numWithoutXY = sum(~cellfun('isempty',nameWithoutXy)); 0038 numWithoutt = sum(~cellfun('isempty',nameWithoutt)); 0039 0040 if numWithXy>0 ||numWithoutXY>0 || numWithoutt>0 0041 rightNames = true; 0042 else 0043 rightNames = false; 0044 end 0045 0046 end 0047