Skip to content
Permalink
Browse files

Merge pull request #196 from jones-michael-s/master

minor bugfixes on aa_export_toBIDS
  • Loading branch information...
tiborauer committed May 29, 2019
2 parents 1a68e1d + a1be166 commit e90bde765ef9f2aea43744f542ec523ae49e6761
Showing with 11 additions and 10 deletions.
  1. +11 −10 aa_toolbox/aa_export_toBIDS.m
@@ -94,9 +94,9 @@ function aa_export_toBIDS(varargin)
if exist(bidsdir,'dir')
success = ~system(sprintf('cp %s/* %s', bidsdir, destpath));
% these three files are compulsory
if ~exists(fullfile(destpath,'dataset_description.json'),'file'); success=0; end
if ~exists(fullfile(destpath,'README'),'file'); success=0; end
if ~exists(fullfile(destpath,'CHANGES'),'file'); success=0; end
if ~exist(fullfile(destpath,'dataset_description.json'),'file'); success=0; end
if ~exist(fullfile(destpath,'README'),'file'); success=0; end
if ~exist(fullfile(destpath,'CHANGES'),'file'); success=0; end
end
end

@@ -221,13 +221,14 @@ function aa_export_toBIDS(varargin)
aas_log(aap,false,'WARNING: No image is available!')
continue;
end


src = src_main;
if any(strcmp(aas_getstreams(aap,'output'),'dummyscans'))
src = spm_file(tempname,'ext','nii');
src_dummy = aas_getfiles_bystream(aap,'session',[subj sess],'dummyscans','output');
spm_file_merge(char(src_dummy,src_main),src);
else
src = src_main;
if ~isempty(src_dummy)
src = spm_file(tempname,'ext','nii');
spm_file_merge(char(src_dummy,src_main),src);
end
end
fhdr = aas_getfiles_bystream(aap,'session',[subj sess],'epi_dicom_header','output');

@@ -240,13 +241,13 @@ function aa_export_toBIDS(varargin)
aas_makedir(aap,fullfile(subjpath,'func'));
dest = fullfile(subjpath,'func',sprintf('%s_task-%s_bold.nii',suboutname,valueValidate(taskname)));
if isRun, dest = strrep(dest,'bold.nii',sprintf('run-%d_bold.nii',runNo)); end
copyfile(src,dest); gzip(dest); delete(dest); if exist('src_dummy','var'), delete(src); clear src_dummy; end

copyfile(src,dest); gzip(dest); delete(dest); if (exist('src_dummy','var') && ~isempty(src_dummy)), delete(src); clear src_dummy; end
% header
loaded = load(fhdr); hdr = loaded.DICOMHEADERS{1};
if isempty(fieldnames(hdr))
aas_log(aap,false,'WARNING: No header information is available!')
else
if iscell(hdr), hdr = hdr{1}; end; hdr = hdr(1);
json = struct(...
'RepetitionTime',hdr.volumeTR,...
'EchoTime',hdr.volumeTE,...

0 comments on commit e90bde7

Please sign in to comment.
You can’t perform that action at this time.