Could the file be damaged?

Summary of what happened:

I am trying to run qsiprep on the data of 16 subjects using apptainer.
qsiprep ran successfully on 12 subjects. For the remaining 4 of them, I get the error message below when dwidenoise is implemented.

Command used (and if a helper script was used, a link to the helper script or the command generated):

#!/bin/bash
#  apptainer_qsiprep.sh
#  
#
#  Created by ldaumail3 on 12/17/24.
#  
#SBATCH --account=gts-wpark78                 # Charge account
#SBATCH -N1 --ntasks-per-node=10               # Number of nodes and cores per node
#SBATCH --mem-per-cpu=20G                      # Memory per core
#SBATCH -t900                                 # Duration of the job (8*60 = 480 mins; 900 = 15 hours)
#SBATCH -qinferno                              # QOS name embers = free, leftover  cpus / inferno = paid, credits usage
#use cpu-small partition
#SBATCH -o./outReports/Report-%j.out                       # Combined output and error messages file
#SBATCH --mail-type=BEGIN,END,FAIL            # Mail preferences
#SBATCH --mail-user=ldaumail3@gatech.edu      # E-mail address for notifications
#SBATCH --array=1-4%1                             # Job IDs to run simultaneously from SUBJ list (limited to 4 simultaneously with %4)
#SBATCH --requeue                               #Resume job if previously crashed

#SUBJ=(NSxGxBAx1970 EBxGxCCx1986 EBxLxHHx1949 EBxGxZAx1990 NSxLxATx1954 EBxGxEYx1965 NSxGxHNx1952 NSxLxYKx1964 EBxLxQPx1957 EBxGxYZx1949 EBxLxTZx1956 NSxGxIFx1991 EBxGxPEx1959 NSxGxHKx1965 NSxLxQUx1953 NSxLxPQx1>
#damaged NSxLxATx1954 EBxGxYZx1949 EBxLxTZx1956 #still need to run them maybe with new data
SUBJ=(EBxGxYZx1949 NSxGxHNx1952 EBxLxTZx1956 NSxLxATx1954) # #NSxGxHNx1952
#SUBJ=(NSxGxBAx1970 EBxGxCCx1986 EBxLxHHx1949 EBxGxZAx1990 NSxLxYKx1964 NSxLxPQx1973 EBxGxEYx1965 EBxLxQPx1957 NSxGxIFx1991 EBxGxPEx1959 NSxGxHKx1965 NSxLxQUx1953) 
# for calculating the amount of time the job takes
begin=`date +%s`
echo $HOSTNAME

# Loading modules
#module load apptainer

apptainer run \
    --bind $HOME/scratch/ampb:/bids \
    --bind $HOME/scratch/ampb/derivatives/qsiprep:/out \
    --bind $HOME/scratch/ampb/work:/work \
    --bind $HOME/p-wpark78-0/software/license.txt:/license.txt \
    --bind $HOME/p-wpark78-0/images:/opt/images \
$HOME/p-wpark78-0/images/qsiprep-latest.sif \
     /bids /out participant \
    --participant-label ${SUBJ[$SLURM_ARRAY_TASK_ID-1]} \
    -w /work \
    --ignore fieldmaps \
    --output-resolution 1.5 \
    --mem-mb 75000 \
    --nprocs 8 \
    --low-mem --stop-on-first-crash \
    --fs-license-file /license.txt

# getting end time to calculate time elapsed
end=`date +%s`
elapsed=`expr $end - $begin`
echo Time taken: $elapsed

Version:

Running QSIPrep version 1.0.0rc2.dev0+g789be41.d20241119

Environment (Docker, Singularity / Apptainer, custom installation):

Apptainer

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

            dwidenoise: ^[[01;31m[ERROR] error uncompressing GZ file "/bids/sub-EBxGxYZx1949/ses-03/dwi/sub-EBxGxYZx1949_ses-03_acq-HCPdir99_dir-AP_dwi.nii.gz": /bids/sub-EBxGxYZx1949/ses-03/dwi/sub-EBxGxYZx1949_ses>
Traceback:
        Traceback (most recent call last):
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 402, in run
            runtime = self._post_run_hook(runtime)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/mixins/reporting.py", line 49, in _post_run_hook
            self._generate_report()
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/interfaces/denoise.py", line 69, in _generate_report
            input_dwi, denoised_nii, field_nii = self._get_plotting_images()
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/interfaces/mrtrix.py", line 176, in _get_plotting_images
            input_dwi = load_img(self.inputs.in_file)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nilearn/image/image.py", line 1333, in load_img
            return check_niimg(img, wildcards=wildcards, dtype=dtype)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nilearn/_utils/niimg_conversions.py", line 316, in check_niimg
            niimg = load_niimg(niimg, dtype=dtype)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nilearn/_utils/niimg.py", line 134, in load_niimg
            dtype = _get_target_dtype(_get_data(niimg).dtype, dtype)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nilearn/_utils/niimg.py", line 25, in _get_data
            data = np.asanyarray(img._dataobj)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 457, in __array__
            arr = self._get_scaled(dtype=dtype, slicer=())
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 424, in _get_scaled
            scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 394, in _get_unscaled
            return array_from_file(
          File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nibabel/volumeutils.py", line 472, in array_from_file
            raise OSError(
        OSError: Expected 360640000 bytes, got 360639998 bytes from object
         - could the file be damaged?

I would appreciate any lead,
Thanks!


Hi @ldaumail,

Please return the BIDS validation report. Also, do images for those subjects open up well in neuroimage viewers? Does the error persist upon using a fresh working directory and/or reconverting dicoms?

Best,
Steven

Hi @Steven, you are right, It seems the files are corrupted. Thanks for pointing that out, I will reconvert the dicoms and try again