I was curious if some of you already encountered this issue or are aware about it, but your compressed NIfTI images might contain subject information. I was lucky enough to catch it in time, but while preparing to publish my data via OpenNeuro.org, I almost published the name of my subjects as well, hidden in the compressed NIfTI file.
So, what’s the problem?
Let’s take a BOLD image from the OpenNeuro.org dataset ds000108. A good example is the functional image sub-01_ses-test_task-fingerfootlips_bold.nii.gz
.
If you double click on the compressed NIfTI file, you can see the following:
And if you extract the data in the .nii.gz
file manually, the uncompressed file name will be 8_finger_foot_lips.nii
. In itself, this doesn’t seem so problematic.
But in my case, the filename in the compressed NIfTI image was still the one given from the scanner, i.e. scan sequence and subject name.
How did I miss that?
-
Checking the header information of the compressed NIfTI file (i.e. with
fslhd
or withnibabel
) gives only back the name of the compressed file as it’s filename, i.e.sub-01_ses-test_task-fingerfootlips_bold.nii.gz
. -
Also, if you
gunzip
the NIfTI image, the filename will be the one from the compressed file, i.e.sub-01_ses-test_task-fingerfootlips_bold.nii.gz
. If you than compress it again withgzip
, the original hidden name is no longer there. -
If you use
gzip
orgunzip
with the-l
flag (i.e. list compressed file contents), you get the following output:gzip -l sub-01_ses-test_task-fingerfootlips_bold.nii.gz compressed uncompressed ratio uncompressed_name 24454931 45220192 45.9% sub-01_ses-test_task-fingerfootlips_bold.nii
So, also here, the
uncompressed_name
is indicated assub-01_ses-test_task-fingerfootlips_bold.nii
. Which is not true!
But, if you unzip the NIfTI image, using gunzip
with the --name
flag (i.e. save or restore the original name and time stamp):
gunzip --name sub-01_ses-test_task-fingerfootlips_bold.nii.gz
You will get the original file name 8_finger_foot_lips.nii
.
Where does the problem come from?
I think the problem is due to renaming the compressed NIfTI file. For example, if you run
cp sub-01_ses-test_task-fingerfootlips_bold.nii.gz new_file.nii.gz
The new_file.nii.gz
will nonetheless still contain the old filename 8_finger_foot_lips.nii
.
How to handle this issue?
At the moment, I see only two strategies. Either you rename the NIfTI image, before compressing them. Or you can also gunzip
all your .nii.gz
files, and compress them again with gzip
. This will overwrite the original name.
Did anybody of you already encounter the same issue? How did you handle it?