I have an old data set with only .nii
files (not DICOMs), so I made .json
file myself with all the information I could collect from the published paper based on this same dataset. Here’s an example of the .json
file sub-101_ses-1_task-VWMT_run-01_bold.json
:
{
"TaskName" : "VWMT",
"RepetitionTime": 1.5,
"EchoTime" : 0.03,
"FlipAngle" : 70,
"FieldOfView" : [ 240, 240, 125 ]
}
and I have rearranged the data to fit bids structure, as below:
sub-101/ses-1/
anat/
sub-101_ses-1_acq-overlay_T1w.nii.gz
sub-101_ses-1_acq-overlay_T1w.json
sub-101_ses-1_acq-spgr_T1w.nii.gz
sub-101_ses-1_acq-overlay_T1w.json
func/
sub-101_ses-1_task-VWMT_run-01_bold.nii.gz (run_01.nii.bz2)
sub-101_ses-1_task-VWMT_run-01_bold.json
sub-101_ses-1_task-VWMT_run-02_bold.nii.gz (run_02.nii.bz2)
sub-101_ses-1_task-VWMT_run-02_bold.json
sub-101_ses-1_task-VWMT_run-03_bold.nii.gz (run_03.nii.bz2)
sub-101_ses-1_task-VWMT_run-03_bold.json
sub-101_ses-1_task-VWMT_run-04_bold.nii.gz (run_04.nii.bz2)
sub-101_ses-1_task-VWMT_run-04_bold.json
sub-101/ses-2/
anat/
sub-101_ses-2_acq-overlay_T1w.nii.gz
sub-101_ses-2_acq-spgr_T1w.nii.gz
func/
sub-101_ses-2_task-VWMT_run-01_bold.nii.gz (run_01.nii.bz2)
sub-101_ses-2_task-VWMT_run-01_bold.json
sub-101_ses-2_task-VWMT_run-02_bold.nii.gz (run_02.nii.bz2)
sub-101_ses-2_task-VWMT_run-02_bold.json
sub-101_ses-2_task-VWMT_run-03_bold.nii.gz (run_03.nii.bz2)
sub-101_ses-2_task-VWMT_run-03_bold.json
sub-101_ses-2_task-VWMT_run-04_bold.nii.gz (run_04.nii.bz2)
sub-101_ses-2_task-VWMT_run-04_bold.json
sub-101/ses-3/
anat/
sub-101_ses-3_acq-overlay_T1w.nii.gz
sub-101_acq-spgr_T1w.nii.gz
func/
sub-101_ses-3_task-VWMT_run-01_bold.nii.gz (run_01.nii.bz2)
sub-101_ses-3_task-VWMT_run-01_bold.json
sub-101_ses-3_task-VWMT_run-02_bold.nii.gz (run_02.nii.bz2)
sub-101_ses-3_task-VWMT_run-02_bold.json
sub-101_ses-3_task-VWMT_run-03_bold.nii.gz (run_03.nii.bz2)
sub-101_ses-3_task-VWMT_run-03_bold.json
sub-101_ses-3_task-VWMT_run-04_bold.nii.gz (run_04.nii.bz2)
sub-101_ses-3_task-VWMT_run-04_bold.json
When I feed the data into fmriprep
, validator gave me two errors and three warnings as below:
Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
1: [ERR] Repetition time was not defined in seconds, milliseconds or microseconds in the scan's header. (code: 11 - REPETITION_TIME_UNITS)
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-03_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-04_bold.nii.gz
Please visit https://neurostars.org/search?q=REPETITION_TIME_UNITS for existing conversations about this issue.
2: [ERR] sform_code and qform_code in the image header are 0. The image/file will be considered invalid or assumed to be in LAS orientation. (code: 60 - SFORM_AND_QFORM_IN_IMAGE_HEADER_ARE_ZERO)
./sub-101/ses-1/anat/sub-101_ses-1_T1w.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-03_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-04_bold.nii.gz
Please visit https://neurostars.org/search?q=SFORM_AND_QFORM_IN_IMAGE_HEADER_ARE_ZERO for existing conversations about this issue.
1: [WARN] You should define 'SliceTiming' for this file. If you don't provide this information slice time correction will not be possible. (code: 13 - SLICE_TIMING_NOT_DEFINED)
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-03_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-04_bold.nii.gz
Please visit https://neurostars.org/search?q=SLICE_TIMING_NOT_DEFINED for existing conversations about this issue.
2: [WARN] NIfTI file's header field for unit information for x, y, z, and t dimensions empty or too short (code: 41 - NIFTI_UNIT)
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-03_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-04_bold.nii.gz
Please visit https://neurostars.org/search?q=NIFTI_UNIT for existing conversations about this issue.
3: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)
Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.
Summary: Available Tasks: Available Modalities:
8 Files, 129.15MB VWMT T1w
1 - Subject bold
1 - Session
If you have any questions, please post on https://neurostars.org/tags/bids.
And fmriprep
was killed with the follwoing error from nibabel
Traceback (most recent call last):
File "/usr/local/miniconda/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/local/miniconda/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 674, in build_workflow
work_dir=str(work_dir),
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/workflows/base.py", line 259, in init_fmriprep_wf
use_syn=use_syn,
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/workflows/base.py", line 617, in init_single_subject_wf
use_syn=use_syn,
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/workflows/bold/base.py", line 289, in init_func_preproc_wf
bold_tlen, mem_gb = _create_mem_gb(ref_file)
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/workflows/bold/base.py", line 991, in _create_mem_gb
bold_tlen = nb.load(bold_fname).shape[-1]
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/loadsave.py", line 49, in load
img = image_klass.from_filename(filename, **kwargs)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/keywordonly.py", line 17, in wrapper
return func(*args, **kwargs)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/dataobj_images.py", line 484, in from_filename
keep_file_open=keep_file_open)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/keywordonly.py", line 17, in wrapper
return func(*args, **kwargs)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/analyze.py", line 975, in from_file_map
header = klass.header_class.from_fileobj(hdrf)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/nifti1.py", line 687, in from_fileobj
hdr = klass(raw_str, endianness, check)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/nifti1.py", line 670, in __init__
check)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/analyze.py", line 252, in __init__
super(AnalyzeHeader, self).__init__(binaryblock, endianness, check)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/wrapstruct.py", line 174, in __init__
self.check_fix()
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/wrapstruct.py", line 365, in check_fix
report.log_raise(logger, error_level)
File "/usr/local/miniconda/lib/python3.7/site-packages/nibabel/batteryrunners.py", line 277, in log_raise
raise self.error(self.problem_msg)
nibabel.spatialimages.HeaderDataError: vox offset 348 too low for single file nifti1
So I opened a Jupyter Notebook to check the possible issues. When using nibabel.load()
to read one of the *_bold.nii
file, I got the same error
vox offset 348 too low for single file nifti1
So I checked the header, as below:
$ fslhd sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
filename sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
size of header 348
data_type INT16
dim0 4
dim1 64
dim2 64
dim3 25
dim4 285
dim5 0
dim6 0
dim7 0
vox_units Unknown
time_units Unknown
datatype 4
nbyper 2
bitpix 16
pixdim0 0.000000
pixdim1 3.750000
pixdim2 3.750000
pixdim3 5.000000
pixdim4 0.000000
pixdim5 0.000000
pixdim6 0.000000
pixdim7 0.000000
vox_offset 348
cal_max 0.000000
cal_min 0.000000
scl_slope 0.000000
scl_inter 0.000000
phase_dim 0
freq_dim 0
slice_dim 0
slice_name Unknown
slice_code 0
slice_start 0
slice_end 0
slice_duration 0.000000
toffset 0.000000
intent Unknown
intent_code 0
intent_name
intent_p1 0.000000
intent_p2 0.000000
intent_p3 0.000000
qform_name Unknown
qform_code 0
qto_xyz:1 3.750000 0.000000 0.000000 0.000000
qto_xyz:2 0.000000 3.750000 0.000000 0.000000
qto_xyz:3 0.000000 0.000000 5.000000 0.000000
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Left-to-Right
qform_yorient Posterior-to-Anterior
qform_zorient Inferior-to-Superior
sform_name Unknown
sform_code 0
sto_xyz:1 0.000000 0.000000 0.000000 0.000000
sto_xyz:2 0.000000 0.000000 0.000000 0.000000
sto_xyz:3 0.000000 0.000000 0.000000 0.000000
sto_xyz:4 0.000000 0.000000 0.000000 1.000000
sform_xorient Unknown
sform_yorient Unknown
sform_zorient Unknown
file_type NIFTI-1+
file_code 1
descrip
aux_file
Should I manually change the header info, such as vox_offset
, to 352 or other values?
Also, for the second error reported by bids validator,
2: [ERR] sform_code and qform_code in the image header are 0. The image/file will be considered invalid or assumed to be in LAS orientation. (code: 60 - SFORM_AND_QFORM_IN_IMAGE_HEADER_ARE_ZERO)
./sub-101/ses-1/anat/sub-101_ses-1_T1w.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-01_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-03_bold.nii.gz
./sub-101/ses-1/func/sub-101_ses-1_task-VWMT_run-04_bold.nii.gz
Does that mean I need to manually change sform_code
and qform_code
?
If all the three pieces of information in header were changed, would my data be workable to fmriprep
?
Thanks!