Summary of what happened:
For some of my participant-sessions, BIDS-validator is telling me that my slice timing array is not appropriate because my k dimension is 80 for the corresponding nifti header?
For context, i ran dcm2niix, and then I had to do an in-house script to manually add slice timing info, as we are using a Philips scanner where DICOMs do not have this field.
Physically my images are not properly oriented, I can see it pretty easily in an MRIQC visual for example.
I compared a json file that does not have the error with one that has it, and the only thing that jumps out is the phase encoding direction that is set to “j” (no error) and “i” (error) (see relevant output log below).
Our local MR specialists mentions the original problem is because the scanner automatically changes to coronal acquisition (as opposed to axial as it was supposed to) once the angle of acquisition goes above 45 degrees?
Any idea of how I could solve this? I hear fslswapdim could help? Can I just correct this by changing the metadata field in json files? Do I need to change this at the DICOM level? What other pre-processing considerations will I have to be careful of ?
Thanks in advance!
Command used (and if a helper script was used, a link to the helper script or the command generated):
$ bids-validator /data
bids-validator@1.15.0
### helper script:
#!/bin/bash
# Define file paths
# file with no slice timing error
file1="../data/sub-RGC901/ses-1/func/sub-RGC901_ses-1_task-BDM_run-1_bold.json"
# file with slice timing error
file2="../data/sub-RGC908/ses-x/func/sub-RGC908_ses-x_task-BDM_run-1_bold.json"
# Sort JSON files using jq and save to temporary files
jq -S . "$file1" > sorted_file1.json
jq -S . "$file2" > sorted_file2.json
# Compare the sorted JSON files
diff sorted_file1.json sorted_file2.json
# Clean up temporary files
rm sorted_file1.json sorted_file2.json
Version:
Environment (Docker, Singularity / Apptainer, custom installation):
Bids-validator is installed locally.
Data formatted according to a validatable standard? Please provide the output of the validator:
3: [WARN] The number of elements in the SliceTiming array should match the 'k' dimension of the corresponding NIfTI volume. (code: 87 - SLICETIMING_ELEMENTS)
./sub-RGC903/ses-1/func/sub-RGC903_ses-1_task-BDM_run-1_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC903/ses-1/func/sub-RGC903_ses-1_task-BDM_run-2_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC903/ses-1/func/sub-RGC903_ses-1_task-BDM_run-3_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC903/ses-x/func/sub-RGC903_ses-x_task-BDM_run-1_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC903/ses-x/func/sub-RGC903_ses-x_task-BDM_run-2_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC903/ses-x/func/sub-RGC903_ses-x_task-BDM_run-3_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC908/ses-x/func/sub-RGC908_ses-x_task-BDM_run-1_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC908/ses-x/func/sub-RGC908_ses-x_task-BDM_run-2_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
./sub-RGC908/ses-x/func/sub-RGC908_ses-x_task-BDM_run-3_bold.nii.gz
Evidence: SliceTiming array is of length 45 and the value of the 'k' dimension is 80 for the corresponding nifti header.
Please visit https://neurostars.org/search?q=SLICETIMING_ELEMENTS for existing conversations about this issue.
Relevant log outputs (up to 20 lines):
[pagag24@beluga3 scripts]$ bash compare_json.sh
5c5
< "AcquisitionTime": "10:06:18.790000",
---
> "AcquisitionTime": "11:48:39.760000",
13,14c13,14
< "EstimatedEffectiveEchoSpacing": 0.000300251,
< "EstimatedTotalReadoutTime": 0.0237198,
---
> "EstimatedEffectiveEchoSpacing": 0.000291068,
> "EstimatedTotalReadoutTime": 0.0229944,
18,23c18,23
< 0.999515,
< -0.0205438,
< 0.0234043,
< 0.0301223,
< 0.828502,
< -0.559176
---
> 0.999427,
> -0.0293173,
> 0.0169287,
> 0.0324521,
> 0.687259,
> -0.725688
31,32c31,32
< "ImagingFrequency": 127.76768,
< "InPlanePhaseEncodingDirectionDICOM": "COL",
---
> "ImagingFrequency": 127.767885,
> "InPlanePhaseEncodingDirectionDICOM": "ROW",
47c47
< "PhaseEncodingAxis": "j",
---
> "PhaseEncodingAxis": "i",
51,53c51,53
< "PhilipsRescaleSlope": 0.806593,
< "PhilipsScaleSlope": 0.0267301,
< "PixelBandwidth": 2104.91,
---
> "PhilipsRescaleSlope": 0.860317,
> "PhilipsScaleSlope": 0.0235088,
> "PixelBandwidth": 2190.68,
69c69
< "WaterFatShift": 10.5683
---
> "WaterFatShift": 10.2451
Screenshots / relevant information:
example of relevants field of a problematic json file:
{
"StationName": "PHILIPS-BQ9N6TK",
"BodyPartExamined": "BRAIN",
"PatientPosition": "HFS",
"SoftwareVersions": "5.3.1\\5.3.1.1",
"MRAcquisitionType": "2D",
"SeriesDescription": "fMRI_3mm_FOOD1",
"ProtocolName": "WIP fMRI_3mm_FOOD1",
"ScanningSequence": "GR",
"SequenceVariant": "SK",
"ScanOptions": "FS",
"PulseSequenceName": "FEEPI",
"ImageType": [
"ORIGINAL",
"PRIMARY",
"T2",
"NONE"
],
"SeriesNumber": 601,
"AcquisitionTime": "11:27:20.410000",
"AcquisitionNumber": 6,
"PhilipsRescaleSlope": 0.927228,
"PhilipsRescaleIntercept": 0,
"PhilipsScaleSlope": 0.018698,
"UsePhilipsFloatNotDisplayScaling": 1,
"SliceThickness": 3,
"SpacingBetweenSlices": 3,
"EchoTime": 0.03,
"RepetitionTime": 2.75,
"MTState": false,
"FlipAngle": 80,
"CoilString": "MULTI COIL",
"PercentPhaseFOV": 100,
"PercentSampling": 100,
"EchoTrainLength": 39,
"PhaseEncodingSteps": 80,
"FrequencyEncodingSteps": 80,
"PhaseEncodingStepsOutOfPlane": 1,
"AcquisitionMatrixPE": 80,
"ReconMatrixPE": 80,
"ParallelReductionFactorInPlane": 2.1,
"ParallelAcquisitionTechnique": "SENSE",
"WaterFatShift": 10.5544,
"EstimatedEffectiveEchoSpacing": 0.000299856,
"EstimatedTotalReadoutTime": 0.0236886,
"AcquisitionDuration": 626.962,
"PixelBandwidth": 2108.46,
"PhaseEncodingAxis": "j",
"ImageOrientationPatientDICOM": [
1,
0,
0,
0,
0.761425,
-0.648253
],
"InPlanePhaseEncodingDirectionDICOM": "COL",
"ConversionSoftware": "dcm2niix",
"ConversionSoftwareVersion": "v1.0.20230411",
"TaskName": "BDM",
"SliceTiming": [
0.0000,
0.0611,
0.1222,
0.1833,
0.2444,
0.3055,
0.3666,
0.4277,
0.4888,
0.5499,
0.6110,
0.6721,
0.7332,
0.7943,
0.8554,
0.9165,
0.9776,
1.0387,
1.0998,
1.1609,
1.2220,
1.2831,
1.3442,
1.4053,
1.4664,
1.5275,
1.5886,
1.6497,
1.7108,
1.7719,
1.8330,
1.8941,
1.9552,
2.0163,
2.0774,
2.1385,
2.1996,
2.2607,
2.3218,
2.3829,
2.4440,
2.5051,
2.5662,
2.6273,
2.6884
],
"SliceEncodingDirection": "k"
}