Skip to content

Commit

Permalink
Merge pull request #801 from HJZollner/develop
Browse files Browse the repository at this point in the history
[BUG FIX] - Average Multiple Experiments not working for json jobs - …
  • Loading branch information
HJZollner authored Dec 9, 2024
2 parents 8ddd093 + 80277ed commit e46b502
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
35 changes: 30 additions & 5 deletions job/OspreyJob.m
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions load/osp_LoadSDAT.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e46b502

Please sign in to comment.