Home > SuperSegger > Internal > getCellFiles.m

getCellFiles

PURPOSE ^

getCellFiles : returns a cell array with the names of the cell files in cellDir

SYNOPSIS ^

function rightCellNames = getCellFiles (cellDir,CONST)

DESCRIPTION ^

 getCellFiles : returns a cell array with the names of the cell files in cellDir
 If CONST.view.showFullCellCycleOnly is set to 1 it returns only the names of full cell cycle
 cells.

 INPUT :
       cellDir : directory with cell files eg. xy1/cell
       CONST : segmentation parameters.
 OUTPUT :
       rightCellNames a cell array with the names of the cell files in cellDir

 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/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rightCellNames = getCellFiles (cellDir,CONST)
0002 % getCellFiles : returns a cell array with the names of the cell files in cellDir
0003 % If CONST.view.showFullCellCycleOnly is set to 1 it returns only the names of full cell cycle
0004 % cells.
0005 %
0006 % INPUT :
0007 %       cellDir : directory with cell files eg. xy1/cell
0008 %       CONST : segmentation parameters.
0009 % OUTPUT :
0010 %       rightCellNames a cell array with the names of the cell files in cellDir
0011 %
0012 % Copyright (C) 2016 Wiggins Lab
0013 % Written by Stella Stylianidou.
0014 % University of Washington, 2016
0015 % This file is part of SuperSegger.
0016 %
0017 % SuperSegger is free software: you can redistribute it and/or modify
0018 % it under the terms of the GNU General Public License as published by
0019 % the Free Software Foundation, either version 3 of the License, or
0020 % (at your option) any later version.
0021 %
0022 % SuperSegger is distributed in the hope that it will be useful,
0023 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0025 % GNU General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License
0028 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0029 
0030 if ~exist('CONST','var') || isempty(CONST)
0031     CONST.view.showFullCellCycleOnly = 0;
0032 end
0033 
0034 if ~isfield( CONST, 'view') || CONST.view.showFullCellCycleOnly
0035     contents = dir([cellDir,filesep,'Cell*.mat']);
0036 else
0037     contents = dir([cellDir,filesep,'*ell*.mat']);
0038 end
0039 
0040 
0041 cellNames = {contents.name}';
0042 rightCells=regexpi(cellNames,'[cC]ell\d+.mat','once');
0043 ids = find(cell2mat(rightCells));
0044 
0045 rightCellNames = {cellNames{ids}};
0046 
0047 if numel(rightCellNames) == 0
0048     error('No cell files found')
0049 end
0050 
0051 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005