Osprey bug (when loading data/list)

Hi all,
When loading DATA/LIST Osprey feels the reference water inside the DATA file only when I have exactly 1 file in the job. If I have 2 and more files, MRSCont.flags.hasRef becomes equal to 0, and this is why:

In OspreyLoad line 111:

[maxDatasets,~] = max(tempDatasets);

So, my maxDatasets is 1 because I don’t have any files provided except for the DATA files.

But then, line 113:

% Determine number of datasets
MRSCont.nDatasets = size(MRSCont.files,2);
if maxDatasets > 1
   ...
else 
     MRSCont.nDatasets(2) = 1;
end

So, I end up with MRSCont.nDatasets = [N_of_spectra_2_process, 1]

And then in osp_LoadDATA lline 94 there is this:

            if ~MRSCont.flags.hasRef && ~isempty(raw_ref)
                % Add NIfTI-MRS information
                raw_ref  = osp_add_nii_mrs_field(raw_ref,MRSCont.ver.Osp);
                MRSCont.raw_ref_uncomb{metab_ll,kk}  = raw_ref;
                if kk == MRSCont.nDatasets
                    MRSCont.flags.hasRef = 1;
                    MRSCont.opts.MultipleSpectra.ref = MRSCont.opts.MultipleSpectra.metab;
                end
            else if MRSCont.flags.hasRef
                    ...
                end
            end

So, the kk == MRSCont.nDatasets is True only when I have 1 DATA file in the Job. Only in this case the ref spectra will be coil-combined and stored.

An easy but crude fix is to set MRSCont.flags.hasRef = 1 and MRSCont.opts.MultipleSpectra.ref = MRSCont.opts.MultipleSpectra.metab right before OspreyLoad line 287: [MRSCont] = osp_combineCoils(MRSCont); But I believe it could be fixed better by someone else (:

Cheers,
Andrei