NIFTI-Imaging / gifti_clib

Source code repository for the GIFTI project (see https://www.nitrc.org/projects/gifti)
Other
0 stars 2 forks source link

NIFTI_INTENT_NONE is a valid intent code #16

Open crossmanith opened 3 years ago

crossmanith commented 3 years ago

NIFTI_INTENT_NONE is a valid intent code but is used as a return value in case of failure in gifti_intent_from_string()

afni-rickr commented 3 years ago

@crossmanith NONE is not really considered a valid code. It is the default case where the intent is not understood or set, and means "we do not know how to interpret the data".
What might you see as advantages in adding another INTENT (-1) to interpret? Would a program fail to load a GIFTI file in the case of a now invalid code (-1)? Then all GIFTI software would have to decide how to handle that. And since failing to load a dataset over the INTENT would be harsh, how would an intent evaluated as -1 differ from NONE (0)?

crossmanith commented 3 years ago

In section 2.3.4.9 the Gifti file format specification states : NIFTI_INTENT_NONE -> Data intent not specified. And in section 13.2: The functional file contains one or more DataArrays with Intent set to NIFTI_INTENT_NONE or one of the statistical intent values.

If gifti_intent_is_valid() returns NONE for both NONE and in case of an invalid numerical code one can’t distinguish between these two situations. I don't suggest to introduce a new intent value but to not use a valid code as an error code.