Open JohnLaMaster opened 8 months ago
Hi John,
This will be an effect of me making sure that the NIfTI-MRS class validation tools abide strictly by the NIfTI-MRS standard, and then making the more recent versions of FSL-MRS require a more recent version of the NIfTI-MRS tools package (with the stricter validation). The requirement for a description was always in the standard for any user-defined header values, because we allow anything to be put in that doesn't collide with those defined in the standard, and therefore it's useful to know what the header values mean. On the flip side, if you form the files using these tools it should always be compliant.
In this particular case it looks like there are two values of conversion time:
'ConversionTime': '2023-04-22T15:58:10.128',
'conversion_time': '2023-06-02T09:04:55.836'
The first, ConversionTime
is in the format expected by the standard, and so doesn't need a description. The second is a user-defined value and as such requires a description subfield. I.e. it would need to be 'conversion_time': {'Value': '2023-06-02T09:04:55.836', 'Description' : 'my special conversion time parameter'}
.
In this instance you can probably just blow away that second conversion time and then it will be compliant.
You can do this by loading the file using the NIFTI_MRS
class directly and setting the argument validate_on_creation to False
, and then modifying the header.
Something like
from fsl_mrs.core.nifti_mrs import NIFTI_MRS
non_compliant_file = NIFTI_MRS('path/to/data.nii', validate_on_creation=False)
non_compliant_file.remove_hdr_field('conversion_time')
non_compliant_file.save('path/to/compliant_file.nii')
Hi Will, thank you very much! It seems I will need to update my notebook for converting my simulations to NIfTI-MRS. I'll give your suggestion a try.
Thanks again!
I am trying to use FSL MRS interactively and I've run into the following error:
This happens with every input file, but we used FSL MRS to fit all of this data this summer, so I know it worked a few months ago.
I went through the data file using the following code:
And got the following output showing that 'conversion_time' does in fact have a filled in value pair.
Do you have any suggestions for what could be causing this and how to fix it or work around it?
Best, John