PennLINC / aslprep

Preprocessing of arterial spin labeling (ASL) data
https://aslprep.readthedocs.io
Other
41 stars 15 forks source link

Error with GE data #303

Closed tsalo closed 1 year ago

tsalo commented 1 year ago

We pulled the latest docker version (0.4.0) and replaced the ge.py file, but there were 3 errors reported, what is the reason for this?

error1:

Node: aslprep_wf.single_subject_101_wf.anat_preproc_wf.anat_derivatives_wf.gen_ref
Working directory: /work/aslprep_wf/single_subject_101_wf/anat_preproc_wf/anat_derivatives_wf/_in_tuple_MNI152NLin2009cAsym.resnative/gen_ref

Node inputs:

fixed_image = <undefined>
fov_mask = None
keep_native = True
moving_image = <undefined>
xform_code = None

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node gen_ref.

Traceback:
    Traceback (most recent call last):
      File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/nibabel.py", line 430, in _run_interface
        self._results["out_file"] = _gen_reference(
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/nibabel.py", line 609, in _gen_reference
        resampled = nli.resample_img(
      File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/image/resampling.py", line 445, in resample_img
        img = _utils.check_niimg(img)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/_utils/niimg_conversions.py", line 286, in check_niimg
        niimg = load_niimg(niimg, dtype=dtype)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/_utils/niimg.py", line 137, in load_niimg
        dtype = _get_target_dtype(_get_data(niimg).dtype, dtype)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/_utils/niimg.py", line 26, in _get_data
        data = np.asanyarray(img._dataobj)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 426, in __array__
        arr = self._get_scaled(dtype=dtype, slicer=())
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 393, in _get_scaled
        scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 363, in _get_unscaled
        return array_from_file(
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/volumeutils.py", line 461, in array_from_file
        raise OSError(
    OSError: Expected 17060042 bytes, got 17053871 bytes from object
     - could the file be damaged?

error2:

Node: aslprep_wf.single_subject_101_wf.anat_preproc_wf.anat_norm_wf.registration
Working directory: /work/aslprep_wf/single_subject_101_wf/anat_preproc_wf/anat_norm_wf/_template_MNI152NLin2009cAsym/registration

Node inputs:

explicit_masking = True
flavor = precise
float = True
initial_moving_transform = <undefined>
lesion_mask = <undefined>
moving = T1w
moving_image = <undefined>
moving_mask = <undefined>
num_threads = 5
orientation = RAS
reference = T1w
reference_image = <undefined>
reference_mask = <undefined>
settings = <undefined>
template = MNI152NLin2009cAsym
template_resolution = <undefined>
template_spec = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node registration.

Traceback:
    Traceback (most recent call last):
      File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/norm.py", line 183, in _run_interface
        ants_args = self._get_ants_args()
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/norm.py", line 457, in _get_ants_args
        args["fixed_image"] = mask(
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/norm.py", line 506, in mask
        data = in_nii.get_fdata()
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/dataobj_images.py", line 368, in get_fdata
        data = np.asanyarray(self._dataobj, dtype=dtype)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 426, in __array__
        arr = self._get_scaled(dtype=dtype, slicer=())
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 393, in _get_scaled
        scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 363, in _get_unscaled
        return array_from_file(
      File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/volumeutils.py", line 461, in array_from_file
        raise OSError(
    OSError: Expected 17060042 bytes, got 17053871 bytes from object
     - could the file be damaged?

 - could the file be damaged?

error3:

Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_t1_trans_wf.asl_to_t1w_transform
Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_t1_trans_wf/asl_to_t1w_transform

Node inputs:

args = <undefined>
copy_dtype = True
default_value = 0.0
dimension = <undefined>
environ = {}
float = True
input_image = <undefined>
input_image_type = <undefined>
interpolation = LanczosWindowedSinc
interpolation_parameters = <undefined>
invert_transform_flags = <undefined>
num_threads = 5
out_postfix = _trans
output_image = <undefined>
print_out_composite_warp_file = <undefined>
reference_image = <undefined>
save_cmd = True
transforms = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node asl_to_t1w_transform.

Traceback:
    Traceback (most recent call last):
      File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/usr/local/miniconda/lib/python3.8/site-packages/aslprep/niworkflows/interfaces/itk.py", line 177, in _run_interface
        tmp_folder.cleanup()
      File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 832, in cleanup
        self._rmtree(self.name)
      File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 814, in _rmtree
        _shutil.rmtree(name, onerror=onerror)
      File "/usr/local/miniconda/lib/python3.8/shutil.py", line 719, in rmtree
        onerror(os.rmdir, path, sys.exc_info())
      File "/usr/local/miniconda/lib/python3.8/shutil.py", line 717, in rmtree
        os.rmdir(path)
    OSError: [Errno 26] Text file busy: '/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_t1_trans_wf/asl_to_t1w_transform/tmp-qtx8k5tj'

Originally posted by @Luoyu-Wang in https://github.com/PennLINC/aslprep/issues/301#issuecomment-1575478389

tsalo commented 1 year ago

@Luoyu-Wang, can you explain what you mean by "replac[ing] the ge.py file"? Did you not just use the Docker image?

Luoyu-Wang commented 1 year ago

I pulled the latest version (0.4.0 )and still got the same error, so I downloaded the corrected ge.py from 301 and replaced the source file. docker cp ./ge.py 3e60ded2b7bc:/usr/local/miniconda/lib/python3.8/site-packages/aslprep/interfaces/ge.py In fact, after I pulled the latest version (0.4.0) these errors appeared, and after the replacement the old errors disappeared, but these errors remained.

tsalo commented 1 year ago

Please instead pull the pennlinc/aslprep:unstable and try that.

Luoyu-Wang commented 1 year ago

I pulled the pennlinc/aslprep:unstable and tried that. but the error remain. docker run -ti --rm -v /media/sf_data/matlab/ASL/rawdata:/data:ro -v /media/sf_data/matlab/ASL/derivatives:/out:rw -v /media/sf_data/matlab/ASL/wd_temp:/work:rw -v /home/wly/softwares/freesurfer/license.txt:/opt/freesurfer/license.txt -v /home/wly/softwares/templateflow:/home/aslprep/.cache/templateflow/ pennlinc/aslprep:unstable /data /out participant -w /work --ignore fieldmaps

Or do I have to delete the previous version before pull the unstable vesion again?

e1: Node: aslprep_wf.single_subject_101_wf.anat_preproc_wf.anat_derivatives_wf.gen_ref Working directory: /work/aslprep_wf/single_subject_101_wf/anat_preproc_wf/anat_derivatives_wf/_in_tuple_MNI152NLin2009cAsym.resnative/gen_ref

Node inputs:

fixed_image = fov_mask = None keep_native = True moving_image = xform_code = None

Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command raise NodeExecutionError(msg) nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node gen_ref.

Traceback: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run runtime = self._run_interface(runtime) File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/nibabel.py", line 430, in _run_interface self._results["out_file"] = _gen_reference( File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/nibabel.py", line 609, in _gen_reference resampled = nli.resample_img( File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/image/resampling.py", line 445, in resample_img img = _utils.check_niimg(img) File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/_utils/niimg_conversions.py", line 286, in check_niimg niimg = load_niimg(niimg, dtype=dtype) File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/_utils/niimg.py", line 137, in load_niimg dtype = _get_target_dtype(_get_data(niimg).dtype, dtype) File "/usr/local/miniconda/lib/python3.8/site-packages/nilearn/_utils/niimg.py", line 26, in _get_data data = np.asanyarray(img._dataobj) File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 426, in array arr = self._get_scaled(dtype=dtype, slicer=()) File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 393, in _get_scaled scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter) File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 363, in _get_unscaled return array_from_file( File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/volumeutils.py", line 461, in array_from_file raise OSError( OSError: Expected 17060042 bytes, got 17053871 bytes from object

e2: Node: aslprep_wf.single_subject_101_wf.anat_preproc_wf.anat_norm_wf.registration Working directory: /work/aslprep_wf/single_subject_101_wf/anat_preproc_wf/anat_norm_wf/_template_MNI152NLin2009cAsym/registration

Node inputs:

explicit_masking = True flavor = precise float = True initial_moving_transform = lesion_mask = moving = T1w moving_image = moving_mask = num_threads = 5 orientation = RAS reference = T1w reference_image = reference_mask = settings = template = MNI152NLin2009cAsym template_resolution = template_spec =

Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command raise NodeExecutionError(msg) nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node registration.

Traceback: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run runtime = self._run_interface(runtime) File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/norm.py", line 183, in _run_interface ants_args = self._get_ants_args() File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/norm.py", line 457, in _get_ants_args args["fixed_image"] = mask( File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/norm.py", line 506, in mask data = in_nii.get_fdata() File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/dataobj_images.py", line 368, in get_fdata data = np.asanyarray(self._dataobj, dtype=dtype) File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 426, in array arr = self._get_scaled(dtype=dtype, slicer=()) File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 393, in _get_scaled scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter) File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/arrayproxy.py", line 363, in _get_unscaled return array_from_file( File "/usr/local/miniconda/lib/python3.8/site-packages/nibabel/volumeutils.py", line 461, in array_from_file raise OSError( OSError: Expected 17060042 bytes, got 17053871 bytes from object

e3: Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_t1_trans_wf.asl_to_t1w_transform Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_t1_trans_wf/asl_to_t1w_transform

Node inputs:

args = copy_dtype = True default_value = 0.0 dimension = environ = {} float = True input_image = input_image_type = interpolation = LanczosWindowedSinc interpolation_parameters = invert_transform_flags = num_threads = 5 out_postfix = _trans output_image = print_out_composite_warp_file = reference_image = save_cmd = True transforms =

Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command raise NodeExecutionError(msg) nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node asl_to_t1w_transform.

Traceback: Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run runtime = self._run_interface(runtime) File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/itk.py", line 197, in _run_interface tmp_folder.cleanup() File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 832, in cleanup self._rmtree(self.name) File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 814, in _rmtree _shutil.rmtree(name, onerror=onerror) File "/usr/local/miniconda/lib/python3.8/shutil.py", line 719, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/usr/local/miniconda/lib/python3.8/shutil.py", line 717, in rmtree os.rmdir(path) OSError: [Errno 26] Text file busy: '/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_t1_trans_wf/asl_to_t1w_transform/tmp-06z8701m'

tsalo commented 1 year ago

Thanks! You don't need to delete anything before pulling unstable, though if I push changes you may want to pull unstable again.

The first error is actually coming from smriprep, so I'd like to work through them one by one. Can you try (1) deleting the working directory and (2) running with --anat-only?

Luoyu-Wang commented 1 year ago

Okay, I'll test it as soon as possible.

Luoyu-Wang commented 1 year ago

I have done several tests: 1) directly add --anat-only, and it reports the same error 2) Add --anat-only and remove the mounted templateflow, the result is successful, I suspect it may be a problem with the previously downloaded template. 3) Remove the mounted templateflow to run, the old errors disappeared, but a few new errors appeared.

e1:

Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_t1_trans_wf.asl_to_t1w_transform
Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_t1_trans_wf/asl_to_t1w_transform

Node inputs:

args = <undefined>
copy_dtype = True
default_value = 0.0
dimension = <undefined>
environ = {}
float = True
input_image = <undefined>
input_image_type = <undefined>
interpolation = LanczosWindowedSinc
interpolation_parameters = <undefined>
invert_transform_flags = <undefined>
num_threads = 5
out_postfix = _trans
output_image = <undefined>
print_out_composite_warp_file = <undefined>
reference_image = <undefined>
save_cmd = True
transforms = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node asl_to_t1w_transform.

Traceback:
    Traceback (most recent call last):
      File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/itk.py", line 197, in _run_interface
        tmp_folder.cleanup()
      File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 832, in cleanup
        self._rmtree(self.name)
      File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 814, in _rmtree
        _shutil.rmtree(name, onerror=onerror)
      File "/usr/local/miniconda/lib/python3.8/shutil.py", line 719, in rmtree
        onerror(os.rmdir, path, sys.exc_info())
      File "/usr/local/miniconda/lib/python3.8/shutil.py", line 717, in rmtree
        os.rmdir(path)
    OSError: [Errno 26] Text file busy: '/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_t1_trans_wf/asl_to_t1w_transform/tmp-04a_tytl'

e2:

Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_derivatives_wf.ds_mean_cbf_parcellated
Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_derivatives_wf/ds_mean_cbf_parcellated

Node inputs:

acquisition = <undefined>
atlas = ['Schaefer117', 'Schaefer217', 'Schaefer317', 'Schaefer417', 'Schaefer517', 'Schaefer617', 'Schaefer717', 'Schaefer817', 'Schaefer917', 'Schaefer1017', 'Glasser', 'Gordon', 'Tian']
base_directory = /out
ceagent = <undefined>
check_hdr = True
chunk = <undefined>
cohort = <undefined>
compress = [False]
data_dtype = <undefined>
datatype = <undefined>
den = <undefined>
density = <undefined>
desc = <undefined>
direction = <undefined>
dismiss_entities = <undefined>
echo = <undefined>
extension = <undefined>
flip = <undefined>
fmap = <undefined>
from = <undefined>
hemi = <undefined>
in_file = [['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf0/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf1/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf2/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf3/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf4/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf5/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf6/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf7/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf8/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf9/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf10/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf11/timeseries.tsv'], ['/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/parcellate_cbf_wf/parcellate_mean_cbf/mapflow/_parcellate_mean_cbf12/timeseries.tsv']]
inv = <undefined>
label = <undefined>
measure = <undefined>
meta_dict = <undefined>
modality = <undefined>
mode = <undefined>
model = <undefined>
mt = <undefined>
part = <undefined>
proc = <undefined>
reconstruction = <undefined>
recording = <undefined>
res = <undefined>
resolution = <undefined>
roi = <undefined>
run = <undefined>
sample = <undefined>
scans = <undefined>
session = <undefined>
source_file = <undefined>
space = <undefined>
staining = <undefined>
subject = <undefined>
subset = <undefined>
suffix = cbf
task = <undefined>
to = <undefined>
tracer = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/utils.py", line 94, in nodelist_runner
    result = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 504, in run
    emptydirs(outdir, noexist_ok=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/utils/filemanip.py", line 807, in emptydirs
    raise ex
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/utils/filemanip.py", line 789, in emptydirs
    shutil.rmtree(path)
  File "/usr/local/miniconda/lib/python3.8/shutil.py", line 715, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/local/miniconda/lib/python3.8/shutil.py", line 656, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/local/miniconda/lib/python3.8/shutil.py", line 654, in _rmtree_safe_fd
    os.rmdir(entry.name, dir_fd=topfd)
OSError: [Errno 26] Text file busy: '_report'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 344, in _send_procs_to_workers
    self.procs[jobid].run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 1380, in _run_interface
    result = self._collate_results(
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 1249, in _collate_results
    for i, nresult, err in nodes:
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/utils.py", line 99, in nodelist_runner
    result = node.result
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 223, in result
    return _load_resultfile(
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/utils.py", line 291, in load_resultfile
    raise FileNotFoundError(results_file)
FileNotFoundError: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_derivatives_wf/ds_mean_cbf_parcellated/mapflow/_ds_mean_cbf_parcellated0/result__ds_mean_cbf_parcellated0.pklz

e3:

Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_std_trans_wf.asl_to_std_transform
Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_std_trans_wf/_std_target_MNI152NLin2009cAsym.resnative/asl_to_std_transform

Node inputs:

args = <undefined>
copy_dtype = True
default_value = 0.0
dimension = <undefined>
environ = {}
float = True
input_image = <undefined>
input_image_type = <undefined>
interpolation = LanczosWindowedSinc
interpolation_parameters = <undefined>
invert_transform_flags = <undefined>
num_threads = 5
out_postfix = _trans
output_image = <undefined>
print_out_composite_warp_file = <undefined>
reference_image = <undefined>
save_cmd = True
transforms = <undefined>

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node asl_to_std_transform.

Traceback:
    Traceback (most recent call last):
      File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/usr/local/miniconda/lib/python3.8/site-packages/niworkflows/interfaces/itk.py", line 197, in _run_interface
        tmp_folder.cleanup()
      File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 832, in cleanup
        self._rmtree(self.name)
      File "/usr/local/miniconda/lib/python3.8/tempfile.py", line 814, in _rmtree
        _shutil.rmtree(name, onerror=onerror)
      File "/usr/local/miniconda/lib/python3.8/shutil.py", line 719, in rmtree
        onerror(os.rmdir, path, sys.exc_info())
      File "/usr/local/miniconda/lib/python3.8/shutil.py", line 717, in rmtree
        os.rmdir(path)
    OSError: [Errno 26] Text file busy: '/work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_std_trans_wf/_std_target_MNI152NLin2009cAsym.resnative/asl_to_std_transform/tmp-2i985nv9'
mattcieslak commented 1 year ago

These errors all seem to have something to do with file system problems. Are any of the rw directories mounted external drives or remote file systems?

Luoyu-Wang commented 1 year ago

We only mounted the data, out, work, license and templateflow to the docker.

docker run -ti --rm \
    -v /media/sf_data/matlab/ASL/rawdata:/data:ro \
    -v /media/sf_data/matlab/ASL/derivatives:/out:rw \
    -v /media/sf_data/matlab/ASL/wd_temp:/work:rw \
    -v /home/wly/softwares/freesurfer/license.txt:/opt/freesurfer/license.txt  \
    -v /home/wly/softwares/templateflow:/home/aslprep/.cache/templateflow/ \
    pennlinc/aslprep:unstable /data /out participant -w /work --ignore fieldmaps
Luoyu-Wang commented 1 year ago

We deployed the docker in a virtualbox and did the data processing in a shared folder.

tsalo commented 1 year ago

@Luoyu-Wang do you need to run it in virtualbox? Can you run Docker or Singularity directly?

Luoyu-Wang commented 1 year ago

Thank you very much for your guidance, I can run successfully in the standalone system, but the results of GE is strange, I found that the CBF is very high, about several thousand, is this due to the difference in gain bwtween the ASL and M0? Do you have any suggestions? In addition to that, the resolution of CBF in standard space is [1.72, 1.72, 3], and I want to get a resolution of [2, 2, 2], how should I set "--output-space" (set 'MNI152NLin2009cAsym:res-2mm' report error)? And how can I get the CBF in fsaverage5 space?

tsalo commented 1 year ago

the results of GE is strange, I found that the CBF is very high, about several thousand, is this due to the difference in gain bwtween the ASL and M0? Do you have any suggestions?

It's possible that your M0 scans are not already scaled in your BIDS dataset. There's some info about this in the documentation. From what I can recall, with the GE sequence, the M0 scan should be scaled by a factor of 32 * the number of averages (since the deltaM volume from a GE sequence is the sum across the acquisitions, rather than an average).

In addition to that, the resolution of CBF in standard space is [1.72, 1.72, 3], and I want to get a resolution of [2, 2, 2], how should I set "--output-space" (set 'MNI152NLin2009cAsym:res-2mm' report error)?

Can you do --output-space MNI152NLin2009cAsym:res-2 instead of 2mm?

And how can I get the CBF in fsaverage5 space?

That isn't supported in ASLPrep yet, unfortunately. I have an issue open for it (#297), but I haven't had the chance to work on it yet. There may be other tools that can handle the surface extraction from templates, so I would recommend asking about options for that on NeuroStars.

Luoyu-Wang commented 1 year ago

Thanks very much for your patient answer. Can the "number of averages" be considered as Acquisition Number from GE ? In addition, I also need CBF in T1 space, could it be ok if I add "--output-space anat" directly?

tsalo commented 1 year ago

Can the "number of averages" be considered as Acquisition Number from GE ?

In the BIDS metadata it's TotalAcquiredPairs.

In addition, I also need CBF in T1 space, could it be ok if I add "--output-space anat" directly?

Yes, that should work. T1w should also do the same thing.

Luoyu-Wang commented 1 year ago

I added "--output-space anat" or "--output-space anat" without changing any other parameters, but I found that the result is reported errors, how can I do to solve that?

e1:

Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_derivatives_wf.ds_aslref_t1 Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_derivatives_wf/ds_aslref_t1

Node inputs:

RawSources = ['sub-101/perf/sub-101_asl.nii.gz'] acquisition = atlas = base_directory = /out ceagent = check_hdr = True chunk = cohort = compress = [True] data_dtype = datatype = den = density = desc = direction = dismiss_entities = ['echo'] echo = extension = flip = fmap = from = hemi = in_file = inv = label = measure = meta_dict = modality = mode = model = mt = part = proc = reconstruction = recording = res = resolution = roi = run = sample = scans = session = source_file = ['/data/sub-101/perf/sub-101_asl.nii.gz'] space = T1w staining = subject = subset = suffix = aslref task = to = tracer =

Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 344, in _send_procs_to_workers self.procs[jobid].run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 722, in _run_command result = self._interface.run(cwd=outdir, ignore_exception=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 388, in run self._check_mandatory_inputs() File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 275, in _check_mandatory_inputs raise ValueError(msg) ValueError: DerivativesDataSink requires a value for input 'in_file'. For a list of required inputs, see DerivativesDataSink.help()

When creating this crashfile, the results file corresponding to the node could not be found

e2:

Node: aslprep_wf.single_subject_101_wf.asl_preproc_asl.asl_derivatives_wf.ds_asl_t1 Working directory: /work/aslprep_wf/single_subject_101_wf/asl_preproc_asl/asl_derivatives_wf/ds_asl_t1

Node inputs:

RawSources = ['sub-101/perf/sub-101_asl.nii.gz'] acquisition = atlas = base_directory = /out ceagent = check_hdr = True chunk = cohort = compress = [True] data_dtype = datatype = den = density = desc = preproc direction = dismiss_entities = echo = extension = flip = fmap = from = hemi = in_file = inv = label = measure = meta_dict = modality = mode = model = mt = part = proc = reconstruction = recording = res = resolution = roi = run = sample = scans = session = source_file = ['/data/sub-101/perf/sub-101_asl.nii.gz'] space = T1w staining = subject = subset = suffix = asl task = to = tracer =

Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 344, in _send_procs_to_workers self.procs[jobid].run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 722, in _run_command result = self._interface.run(cwd=outdir, ignore_exception=True) File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 388, in run self._check_mandatory_inputs() File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 275, in _check_mandatory_inputs raise ValueError(msg) ValueError: DerivativesDataSink requires a value for input 'in_file'. For a list of required inputs, see DerivativesDataSink.help()

When creating this crashfile, the results file corresponding to the node could not be found.

Luoyu-Wang commented 1 year ago

Thank you very much for your previous guidance. We used the unstable version of ASLPREP to process multi-PLD ASL data from GE scans and found that we got stuck at this step several days, we found the cpu was running very inefficiently(about 3%), while processing single-PLD ASL data normally, what is the reason for this?

 [Node] Cached "_anat2std_tpms1" - collecting precomputed outputs

230626-01:21:26,471 nipype.workflow INFO: [Node] "_anat2std_tpms1" found cached. 230626-01:21:26,472 nipype.workflow INFO: [Node] Setting-up "_anat2std_tpms2" in "/work/aslprep_wf/single_subject_S0001_wf/anat_preproc_wf/anat_derivatives_wf/_in_tuple_MNI152NLin2009cAsym.res2/anat2std_tpms/mapflow/_anat2std_tpms2". 230626-01:21:26,472 nipype.workflow INFO: [Node] Cached "_anat2std_tpms2" - collecting precomputed outputs 230626-01:21:26,473 nipype.workflow INFO: [Node] "_anat2std_tpms2" found cached. 230626-01:21:27,729 nipype.workflow INFO: [Node] Finished "norm_rpt", elapsed time 10.425669s. 230626-01:21:33,3 nipype.workflow INFO: [Node] Finished "anat2std_mask", elapsed time 12.22636s. 230626-01:21:33,692 nipype.workflow INFO: [Node] Finished "anat2std_dseg", elapsed time 12.916289s. 230626-01:21:34,425 nipype.interface WARNING: Changing /out/aslprep/sub-S0001/anat/sub-S0001_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii.gz dtype from float64 to uint8 230626-01:21:34,689 nipype.interface WARNING: Changing /out/aslprep/sub-S0001/anat/sub-S0001_space-MNI152NLin2009cAsym_res-2_dseg.nii.gz dtype from float64 to int16

tsalo commented 1 year ago

We used the unstable version of ASLPREP to process multi-PLD ASL data from GE scans and found that we got stuck at this step several days, we found the cpu was running very inefficiently(about 3%), while processing single-PLD ASL data normally, what is the reason for this?

This seems like a separate problem. Could you open a new issue?