Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Can now handle SVS, nDatasets>1, and MRSI data.
The use of auxiliary nested functions make the code more legible.
The auxiliary function at the bottom, get_header, has a variable possible_keys (line 123). This list will need to be updated to account for all types of fitting nomenclature. The exampledata/nifti-mrs example produces a container with the structure MRSCont.fit.results.metab.fitParams{1,nDatasets}. The MRSI container has the structure MRSCont.fit.results{5,5,5}.off.fitParams{1,1}. Some of the structures become cell arrays of structures and some of the field names change. The MRSI example also uses the labels "off" and "A" depending on the parent field whereas the other example always uses "metab". The struct vs cell array of struct has been taken care of using assertCell(). The pairs of these labels, though, will need to be hard coded at the bottom. That's something I would need from the Osprey team.
There is a section where irrelevant fieldnames can be specified to be ignored. This helps avoid throwing errors. They are only modified if the field exists. These also need to be explicitly listed - more help from the Osprey team.
A limitation of the current code regarding the label pairs is that the data type should be uniform. Future work can add functionality for exporting related types, i.e. edit_on, edit_off, and diff or off and water.