aramis-lab / clinica

Software platform for clinical neuroimaging studies
http://www.clinica.run/
Other
220 stars 74 forks source link

Cannot execute `pet-linear` pipeline #728

Closed Kateridge closed 2 years ago

Kateridge commented 2 years ago

Describe the bug I have successfully performed t1-linear on some ADNI data, but I cannot further execute pet-linear pipeline.

To Reproduce Subjects used: 941_S_4377, 941_S_4420, 941_S_4764 1) Execute t1-linear (works fine) 2) Execute pet-linear (get following errors):

(clinica) kateridge@Ubuntu:~/Projects/Projects/Datasets/test$ clinica run pet-linear -wd ~/Projects/Projects/Datasets/test/temp -np 1 ~/Projects/Projects/Datasets/test/BIDS ~/Projects/Projects/Datasets/test/CAPS 18FFDG pons2
2022-08-20 10:47:56,449:INFO:The pipeline will be run on the following 3 image(s):
2022-08-20 10:47:56,449:INFO:   sub-ADNI941S4377 | ses-M00,
2022-08-20 10:47:56,449:INFO:   sub-ADNI941S4420 | ses-M00,
2022-08-20 10:47:56,449:INFO:   sub-ADNI941S4764 | ses-M00,
2022-08-20 10:47:56,450:INFO:The pipeline will last approximately 3 minutes per image.
2022-08-20 10:47:56,837:INFO:Running pipeline for sub-ADNI941S4377 | ses-M00
Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/bin/clinica", line 8, in <module>
    sys.exit(main())
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/clinica/cmdline.py", line 89, in main
    cli()
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/clinica/pipelines/pet_linear/pet_linear_cli.py", line 77, in cli
    pipeline.run(plugin="MultiProc", plugin_args={"n_procs": n_procs})
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/clinica/pipelines/engine.py", line 288, in run
    raise e
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/clinica/pipelines/engine.py", line 269, in run
    exec_graph = Workflow.run(self, plugin, plugin_args, update_hash)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/workflows.py", line 638, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/plugins/base.py", line 166, in run
    self._clean_queue(jobid, graph, result=result)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/plugins/base.py", line 244, in _clean_queue
    raise RuntimeError("".join(result["traceback"]))
RuntimeError: Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 524, in run
    result = self._run_interface(execute=True)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 642, in _run_interface
    return self._run_command(execute)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 750, in _run_command
    raise NodeExecutionError(
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node antsRegistrationT1W2MNI.

Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 454, in aggregate_outputs
    setattr(outputs, key, val)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_types.py", line 2695, in validate
    return TraitListObject(self, object, name, value)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 584, in __init__
    super().__init__(
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 213, in __init__
    super().__init__(self.item_validator(item) for item in iterable)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 213, in <genexpr>
    super().__init__(self.item_validator(item) for item in iterable)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 867, in _item_validator
    return trait_validator(object, self.name, value)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
    self.error(objekt, name, str(value))
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/base_trait_handler.py", line 74, in error
    raise TraitError(
traits.trait_errors.TraitError: Each element of the 'reverse_forward_transforms' trait of a RegistrationOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/home/kateridge/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI/transform0Warp.nii.gz' <class 'str'> was specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 401, in run
    outputs = self.aggregate_outputs(runtime)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 461, in aggregate_outputs
    raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory '['/home/kateridge/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI/transform0Warp.nii.gz']' for output 'reverse_forward_transforms' of a Registration interface

Looks like it gets a str of a list rather than a path

Desktop (please complete the following information):

omar-rifai commented 2 years ago

Hi @Kateridge,

Do you have crash files (.pklz) you could share with us so that we can look at the content?

It looks like there is an issue with the execution of and ants interface Exception raised while executing Node antsRegistrationT1W2MNI.

Regards,

Omar

Kateridge commented 2 years ago

Thanks for your reply! The crash file is attached. crash-20220830-170741-kateridge-antsRegistrationT1W2MNI.a0-2da88e71-12f6-4be7-b562-783050012b3d.zip

omar-rifai commented 2 years ago

The zip seems to contain a file without an extension (which I can not seem to read) can you try to copy the original pklz file?

Kateridge commented 2 years ago

I cannot directly upload pklz file because of the file type restriction of the attachment. So, I repack the orginal pklz file here: crash_log.zip; or you can access it through Google Drive: I'm a link; or I read the pklz file using nipypecli crash ...:

(clinica) kateridge@IDEALAB-ZYW:~/Projects/Projects/Datasets/test$ nipypecli crash crash-20220830-170741-kateridge-antsRegistrationT1W2MNI.a0-2da88e71-12f6-4be7-b562-783050012b3d.pklz 

File: /home/kateridge/Projects/Projects/Datasets/test/crash-20220830-170741-kateridge-antsRegistrationT1W2MNI.a0-2da88e71-12f6-4be7-b562-783050012b3d.pklz
Node: pet-linear.antsRegistrationT1W2MNI
Working directory: /home/kateridge/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI

Node inputs:

args = <undefined>
collapse_output_transforms = True
convergence_threshold = [1e-05]
convergence_window_size = [10]
dimension = 3
environ = {'NSLOTS': '1'}
fixed_image = ['/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/clinica/resources/masks/mni_icbm152_t1_tal_nlin_sym_09c.nii']
fixed_image_mask = <undefined>
fixed_image_masks = <undefined>
float = <undefined>
initial_moving_transform = <undefined>
initial_moving_transform_com = <undefined>
initialize_transforms_per_stage = False
interpolation = Linear
interpolation_parameters = <undefined>
invert_initial_moving_transform = <undefined>
metric = ['MI']
metric_item_trait = <undefined>
metric_stage_trait = <undefined>
metric_weight = [1.0]
metric_weight_item_trait = 1.0
metric_weight_stage_trait = <undefined>
moving_image = ['/home/kateridge/Projects/Projects/Datasets/test/BIDS/sub-ADNI941S4377/ses-M00/anat/sub-ADNI941S4377_ses-M00_T1w.nii.gz']
moving_image_mask = <undefined>
moving_image_masks = <undefined>
num_threads = 1
number_of_iterations = [[200, 50, 10]]
output_inverse_warped_image = <undefined>
output_transform_prefix = transform
output_warped_image = <undefined>
radius_bins_item_trait = 5
radius_bins_stage_trait = <undefined>
radius_or_number_of_bins = [32]
random_seed = <undefined>
restore_state = <undefined>
restrict_deformation = <undefined>
sampling_percentage = <undefined>
sampling_percentage_item_trait = <undefined>
sampling_percentage_stage_trait = <undefined>
sampling_strategy = <undefined>
sampling_strategy_item_trait = <undefined>
sampling_strategy_stage_trait = <undefined>
save_state = <undefined>
shrink_factors = [[8, 4, 2]]
sigma_units = ['vox']
smoothing_sigmas = [[3.0, 2.0, 1.0]]
transform_parameters = [(0.1, 3.0, 0.0)]
transforms = ['SyN']
use_estimate_learning_rate_once = <undefined>
use_histogram_matching = False
verbose = True
winsorize_lower_quantile = 0.005
winsorize_upper_quantile = 0.995
write_composite_transform = False

Traceback: 
Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 524, in run
    result = self._run_interface(execute=True)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 642, in _run_interface
    return self._run_command(execute)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 750, in _run_command
    raise NodeExecutionError(
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node antsRegistrationT1W2MNI.

Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 454, in aggregate_outputs
    setattr(outputs, key, val)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_types.py", line 2695, in validate
    return TraitListObject(self, object, name, value)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 584, in __init__
    super().__init__(
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 213, in __init__
    super().__init__(self.item_validator(item) for item in iterable)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 213, in <genexpr>
    super().__init__(self.item_validator(item) for item in iterable)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/trait_list_object.py", line 867, in _item_validator
    return trait_validator(object, self.name, value)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
    self.error(objekt, name, str(value))
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/traits/base_trait_handler.py", line 74, in error
    raise TraitError(
traits.trait_errors.TraitError: Each element of the 'reverse_transforms' trait of a RegistrationOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/home/kateridge/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI/transform0InverseWarp.nii.gz' <class 'str'> was specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 401, in run
    outputs = self.aggregate_outputs(runtime)
  File "/home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 461, in aggregate_outputs
    raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory '['/home/kateridge/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI/transform0InverseWarp.nii.gz']' for output 'reverse_transforms' of a Registration interface
omar-rifai commented 2 years ago

I see, thanks ! Unfortunately there is not much more info. I tried running locally on some test input and it seems to work on my part.

One thing to try is to have a look in the temp directory (/home/kateridge/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI/) and see if you have acommand.txt` file.

The command that Nipype tried to execute and failed should be there. You can try executing it manually in the command line and see if it works.

Let me know,

Thanks.

Kateridge commented 2 years ago

I execute the command manually and it dosen't work. It got a Segmentation fault and then exited.

(base) kateridge@IDEALAB-ZYW:~/Projects/Projects/Datasets/test/temp/pet-linear/1a489671f7c4c87cd1e0f4035fb465f78c45bad8/antsRegistrationT1W2MNI$ antsRegistration --collapse-output-transforms 1 --dimensionality 3 --initialize-transforms-per-stage 0 --interpolation Linear --output transform --transform SyN[ 0.1, 3.0, 0.0 ] --metric MI[ /home/kateridge/anaconda3/envs/clinica/lib/python3.8/site-packages/clinica/resources/masks/mni_icbm152_t1_tal_nlin_sym_09c.nii, /home/kateridge/Projects/Projects/Datasets/test/BIDS/sub-ADNI941S4377/ses-M00/anat/sub-ADNI941S4377_ses-M00_T1w.nii.gz, 1, 32 ] --convergence [ 200x50x10, 1e-05, 10 ] --smoothing-sigmas 3.0x2.0x1.0vox --shrink-factors 8x4x2 --use-histogram-matching 0 -v --winsorize-image-intensities [ 0.005, 0.995 ]  --write-composite-transform 0
All_Command_lines_OK
Segmentation fault (core dumped)
omar-rifai commented 2 years ago

I'm not entirely sure what is happening but it seems it is more of an issue with Ants (or that specific version of Ants) and / or the execution environment as I don't see anything suspicious with the command at first glance.

For reference we are using ants 2.2.0.

Kateridge commented 2 years ago

Thanks for your help! I may reinstall the environments and try again to see if it works.

omar-rifai commented 2 years ago

Closing as it seems not caused directly by Clinica. Don't hesitate to reopen if necessary.