bids-validator icon indicating copy to clipboard operation
bids-validator copied to clipboard

NIfTI/JSON metadata consistency checks

Open effigies opened this issue 6 years ago • 1 comments
trafficstars

Based on a discussion in: https://github.com/bids-standard/bids-specification/issues/138

The JSON metadata fields PhaseEncodingDirection, SliceEncodingDirection have corresponding values in the NIfTI header field dim_info:

JSON NIfTI
"PhaseEncodingDirection": "i[-]" (dim_info >> 2) & 0x03 == 1
"PhaseEncodingDirection": "j[-]" (dim_info >> 2) & 0x03 == 2
"PhaseEncodingDirection": "k[-]" (dim_info >> 2) & 0x03 == 3
"SliceEncodingDirection": "i[-]" (dim_info >> 4) & 0x03 == 1
"SliceEncodingDirection": "j[-]" (dim_info >> 4) & 0x03 == 2
"SliceEncodingDirection": "k[-]" (dim_info >> 4) & 0x03 == 3

Additionally, SliceTiming can be consistent or inconsistent with the following fields:

    slice_duration = If this is positive, AND if slice_dim is nonzero,
                     indicates the amount of time used to acquire 1 slice.
                     slice_duration*dim[slice_dim] can be less than pixdim[4]
                     with a clustered acquisition method, for example.

    slice_code = If this is nonzero, AND if slice_dim is nonzero, AND
                 if slice_duration is positive, indicates the timing
                 pattern of the slice acquisition.  The following codes
                 are defined:
                   NIFTI_SLICE_SEQ_INC  == sequential increasing
                   NIFTI_SLICE_SEQ_DEC  == sequential decreasing
                   NIFTI_SLICE_ALT_INC  == alternating increasing
                   NIFTI_SLICE_ALT_DEC  == alternating decreasing
                   NIFTI_SLICE_ALT_INC2 == alternating increasing bids-standard/legacy-validator#2
                   NIFTI_SLICE_ALT_DEC2 == alternating decreasing bids-standard/legacy-validator#2
  { slice_start } = Indicates the start and end of the slice acquisition
  { slice_end   } = pattern, when slice_code is nonzero.  These values
                    are present to allow for the possible addition of
                    "padded" slices at either end of the volume, which
                    don't fit into the slice timing pattern.  If there
                    are no padding slices, then slice_start=0 and
                    slice_end=dim[slice_dim]-1 are the correct values.
                    For these values to be meaningful, slice_start must
                    be non-negative and slice_end must be greater than
                    slice_start.  Otherwise, they should be ignored.

effigies avatar Mar 15 '19 19:03 effigies