aslprep icon indicating copy to clipboard operation
aslprep copied to clipboard

metadata for multi-delay pCASL

Open emmalxw opened this issue 2 years ago • 7 comments

Dear ASLprep team,

we use 5 multi-delay pCASL (repeat is 2 2 2 3 3), and I add the delay time for each volume (according to BIDS) in json file using matlab. When I use array, error shows:

TraitError: The 'tis' trait of a _BASILCBFInputSpec instance must be a float or a list of items which are a float, but a value of array([2.0088, 2.0088, 2.0088, 2.0088, 2.5088, 2.5088, 2.5088, 2.5088,
       3.0088, 3.0088, 3.0088, 3.0088, 3.5088, 3.5088, 3.5088, 3.5088,
       3.5088, 3.5088, 4.0088, 4.0088, 4.0088, 4.0088, 4.0088, 4.0088]) <class 'numpy.ndarray'> was specified.
When I use string, it shows:
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/aslprep/cli/workflow.py", line 80, in build_workflow
    retval["workflow"] = init_aslprep_wf()
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/base.py", line 53, in init_aslprep_wf
    single_subject_wf = init_single_subject_wf(subject_id)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/base.py", line 277, in init_single_subject_wf
    asl_preproc_wf = init_asl_preproc_wf(asl_file)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/asl/base.py", line 528, in init_asl_preproc_wf
    metadata=metadata)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/asl/cbf.py", line 98, in init_cbf_compt_wf
    tiscbf = get_tis(metadata)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/interfaces/cbf_computation.py", line 1407, in get_tis
    return np.add(metadata["PostLabelingDelay"], metadata["LabelingDuration"])
numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U47'), dtype('float64')) -> None

But when I run in BASIL separately, the processing is fine. I'm wondering how should I do in jason file to let aslprep run.

Thanks, Emma Screenshot at 2022-12-02 11-40-54

emmalxw avatar Dec 02 '22 01:12 emmalxw

It's a bit late for this now, but for completeness (and for anyone else who might stumble upon this), in this case the PostLabelingDelay should be a JSON array of the form:

{
  // ... other sidecar fields ...
  "PostLabelingDelay": [0.5, 0.5, 0.5, 0.5, 1.0, 1.0, 1.0, 1.0, 1.5, 1.5, 1.5, 1.5, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5],
  // ...
}

The full traceback when running aslprep with the JSON array would be useful.

andrewrosss avatar Mar 17 '23 06:03 andrewrosss

Hi Andrew and ASLprep team, I met the same question. I edit the "PostLabelingDelay" as you said.

{ //...
"ArterialSpinLabelingType":"PCASL", 
"PostLabelingDelay":[0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 0, 0], "BackgroundSuppression":false, 
// ...
}

but I just got the same Error as Emma.

Process Process-2:
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/aslprep/cli/workflow.py", line 80, in build_workflow
    retval["workflow"] = init_aslprep_wf()
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/base.py", line 53, in init_aslprep_wf
    single_subject_wf = init_single_subject_wf(subject_id)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/base.py", line 277, in init_single_subject_wf
    asl_preproc_wf = init_asl_preproc_wf(asl_file)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/asl/base.py", line 528, in init_asl_preproc_wf
    metadata=metadata)
  File "/usr/local/miniconda/lib/python3.7/site-packages/aslprep/workflows/asl/cbf.py", line 116, in init_cbf_compt_wf
    pcasl = pcaslorasl(metadata = metadata)), name='basilcbf',
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/fsl/base.py", line 172, in __init__
    super(FSLCommand, self).__init__(**inputs)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 627, in __init__
    super(CommandLine, self).__init__(**inputs)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 202, in __init__
    self.inputs.trait_set(**inputs)
  File "/usr/local/miniconda/lib/python3.7/site-packages/traits/has_traits.py", line 1543, in trait_set
    setattr( self, name, value )
  File "/usr/local/miniconda/lib/python3.7/site-packages/traits/trait_handlers.py", line 172, in error
    value )
traits.trait_errors.TraitError: The 'tis' trait of a _BASILCBFInputSpec instance must be a float or a list of items which are a float, but a value of array([1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 2.2,
       2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.2, 2.7, 2.7,
       2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 3.2, 3.2, 3.2,
       3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2, 3.2,
       3.2, 3.2, 3.2, 3.2, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7,
       3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7,
       3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 3.7, 1.5, 1.5]) <class 'numpy.ndarray'> was specified.

Do you have any advice?

Xiaoyu

XiaoyuXu750 avatar May 30 '23 10:05 XiaoyuXu750

@XiaoyuXu750 what version of ASLPrep are you using?

tsalo avatar May 30 '23 13:05 tsalo

I am using 0.2.8.

XiaoyuXu750 avatar May 31 '23 08:05 XiaoyuXu750

@XiaoyuXu750 can you pull the current unstable version and try on that? 0.2.8 has the original bug @emmalxw reported here, while 0.3.0 disabled multi-delay support temporarily while we fixed the code. The next release should work with multi-delay PCASL data, but it would be easiest to check against unstable first.

tsalo avatar May 31 '23 13:05 tsalo

Thanks for reply. I will feedback after checking the unstable version.

XiaoyuXu750 avatar Jun 01 '23 03:06 XiaoyuXu750

Hi Taylor,

Sorry for the late feedback. I tried the unstable version, and it worked out! Thanks a lot!

XiaoyuXu750 avatar Jul 15 '23 05:07 XiaoyuXu750