Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions extensions/niak_test/niak_brick_cmp_files.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
end

%% Options
list_fields = { 'flag_ignore_format' , 'base_source' , 'base_target' , 'black_list_source' , 'black_list_target' , 'flag_source_only' , 'eps' , 'flag_verbose' , 'flag_test' };
list_defaults = { false , NaN , NaN , {} , {} , false , 10^(-4) , true , false };
list_fields = { 'exclude_files' , 'flag_ignore_format' , 'base_source' , 'base_target' , 'exclude_files' , 'black_list_source' , 'black_list_target' , 'flag_source_only' , 'eps' , 'flag_verbose' , 'flag_test' };
list_defaults = { {} , false , NaN , NaN , {} , {} , {} , false , 10^(-4) , true , false };
opt = psom_struct_defaults(opt,list_fields,list_defaults);

if ~isempty(opt.base_source)
Expand All @@ -146,11 +146,11 @@
in = psom_struct_defaults(in,{'source','target'},{{},{}});

if isempty(in.source)
in.source = niak_grab_folder(opt.base_source,opt.black_list_source);
in.source = niak_grab_folder(opt.base_source,opt.black_list_source,exclude_files);
end

if isempty(in.target)
in.target = niak_grab_folder(opt.base_target,opt.black_list_target);
in.target = niak_grab_folder(opt.base_target,opt.black_list_target,exclude_files);
end

if ~iscellstr(in.source)||~iscellstr(in.target)
Expand Down
16 changes: 13 additions & 3 deletions extensions/niak_test/niak_grab_folder.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function files = niak_grab_folder(path_data,black_list)
function files = niak_grab_folder(path_data,black_list,exclude_files)
% Grab all the files inside a folder (recursively)
%
% SYNTAX:
% FILES = NIAK_GRAB_FOLDER(PATH_DATA,BLACK_LIST)
% FILES = NIAK_GRAB_FOLDER(PATH_DATA,BLACK_LIST,EXCLUDE_FILES)
%
% _________________________________________________________________________
% INPUTS:
Expand Down Expand Up @@ -75,6 +75,16 @@
if ~isdir(black_list{num_e})
black_list_file{end+1} = regexprep(black_list{num_e},['(.*)' filesep],'$1') ;
end
else
black_list = {};
end

%% List of excluded files
if (nargin < 3)
exclude_files = {};
end
if ischar(exclude_files)
exclude_files = {exclude_files};
end

%% List of folders
Expand All @@ -86,7 +96,7 @@
files_loc = dir(path_data);
is_dir = [files_loc.isdir];
files_loc = {files_loc.name};
mask = ~ismember(files_loc,{'.','..'});
mask = ~ismember(files_loc,{'.','..'})&~ismember(files_loc,exclude_files);
is_dir = is_dir(mask);
files_loc = files_loc(mask);
files_loc = strcat(repmat({path_data},size(files_loc)),files_loc);
Expand Down