schorschinho / osprey

All-in-one toolbox for processing of magnetic resonance spectroscopy data.
https://schorschinho.github.io/osprey
MIT License
52 stars 41 forks source link

[BUG] - osp_saveNII fails if water signal does not originate from a separate data file - osp_saveNII #728

Closed alexcraven closed 1 month ago

alexcraven commented 2 months ago

Describe the bug

Some GE P-files incorporate metabolite, reference and water data in the same file.

In these cases, osp_LoadP sets the hasWater flag, but MRSCont.files_w remains empty.

This causes osp_saveNII to fail:


Error in osp_saveNII (line 132)
        [path_w,filename_w,ext_w]   = fileparts(MRSCont.files_w{kk});

Error in OspreyProcess (line 853)
    [MRSCont] = osp_saveNII(MRSCont);

Suggested Fix

osp_saveNII could replicate behavior from the hasRef condition immediately above for GE data (or more generally, any case where files_w is empty)?

HJZollner commented 1 month ago

Thanks Alex. I think, your solution should work fine.

Added in #739