diff --git a/job/OspreyJob.m b/job/OspreyJob.m index f94ec9ae..ddb53829 100755 --- a/job/OspreyJob.m +++ b/job/OspreyJob.m @@ -256,21 +256,46 @@ % and save them as separate cells to be saved into the MRSCont % container. if isfield(jobStruct, 'files') - files = jobStruct.files'; + if ~iscell(jobStruct.files{1}) || size(jobStruct.files,1) == 1 + files = jobStruct.files'; + end + if iscell(files{1}) + files = cellfun(@transpose,files,'UniformOutput',false); + end else error('Invalid job file! A job file needs to contain at least metabolite data in the field ''files''.'); end if isfield(jobStruct, 'files_mm') %re_mm Adding functionality for MM - files_mm = jobStruct.files_mm'; %re_mm + if ~iscell(jobStruct.files_mm{1}) || size(jobStruct.files_mm,1) == 1 + files_mm = jobStruct.files_mm'; %re_mm + end + if iscell(files_mm{1}) + files_mm = cellfun(@transpose,files_mm,'UniformOutput',false); + end end %re_mm if isfield(jobStruct, 'files_mm_ref') - files_mm_ref = jobStruct.files_mm_ref'; + if ~iscell(jobStruct.files_mm_ref{1}) || size(jobStruct.files_mm_ref,1) == 1 + files_mm_ref = jobStruct.files_mm_ref'; + end + if iscell(files_mm_ref{1}) + files_mm_ref = cellfun(@transpose,files_mm_ref,'UniformOutput',false); + end end if isfield(jobStruct, 'files_ref') - files_ref = jobStruct.files_ref'; + if ~iscell(jobStruct.files_ref{1}) || size(jobStruct.files_ref,1) == 1 + files_ref = jobStruct.files_ref'; + end + if iscell(files_ref{1}) + files_ref = cellfun(@transpose,files_ref,'UniformOutput',false); + end end if isfield(jobStruct, 'files_w') - files_w = jobStruct.files_w'; + if ~iscell(jobStruct.files_w{1}) || size(jobStruct.files_w,1) == 1 + files_w = jobStruct.files_w'; + end + if iscell(files_w{1}) + files_w = cellfun(@transpose,files_w,'UniformOutput',false); + end end if isfield(jobStruct, 'files_nii') files_nii = jobStruct.files_nii'; diff --git a/load/osp_LoadSDAT.m b/load/osp_LoadSDAT.m index 53b409d9..1eceb214 100644 --- a/load/osp_LoadSDAT.m +++ b/load/osp_LoadSDAT.m @@ -33,21 +33,21 @@ MRSCont.files_mm{kk} = MRSCont.files_mm{1}; % re_mm allowable to specify one MM file for the whole batch end %re_mm end %re_mm - if ((length(MRSCont.files_mm) ~= MRSCont.nDatasets(1)) ) %re_mm + if ((size(MRSCont.files_mm,2) ~= MRSCont.nDatasets(1)) ) %re_mm msg = 'Number of specified MM files does not match number of specified metabolite files.'; %re_mm fprintf(msg); error(msg); end %re_mm end %re_mm if MRSCont.flags.hasRef - if length(MRSCont.files_ref) ~= MRSCont.nDatasets(1) + if size(MRSCont.files_ref,2) ~= MRSCont.nDatasets(1) msg = 'Number of specified reference files does not match number of specified metabolite files.'; %re_mm fprintf(msg); error(msg); end end if MRSCont.flags.hasWater - if length(MRSCont.files_w) ~= MRSCont.nDatasets(1) + if size(MRSCont.files_w,2) ~= MRSCont.nDatasets(1) msg = 'Number of specified water files does not match number of specified metabolite files.'; %re_mm fprintf(msg); error(msg);