mnoergaard / petprep_extract_tacs

PETPrep BIDS App for extracting time activity curves for PET data
Apache License 2.0
4 stars 2 forks source link

[Bug] Array Size Error w/ create_weighted_average_pet #8

Closed bendhouseart closed 5 months ago

bendhouseart commented 5 months ago

Have encountered an error during the create_weighted_average_pet during integration:

Traceback:
    Traceback (most recent call last):
      File "/home/galassiae/Projects/petprep_extract_tacs/petprep_extract_tacs_env/lib64/python3.9/site-packages/nipype/interfaces/base/core.py", line 397, in run
        runtime = self._run_interface(runtime)
      File "/home/galassiae/Projects/petprep_extract_tacs/petprep_extract_tacs_env/lib64/python3.9/site-packages/nipype/interfaces/utility/wrappers.py", line 142, in _run_interface
        out = function_handle(**args)
      File "<string>", line 35, in create_weighted_average_pet
    ValueError: operands could not be broadcast together with shapes (18,) (19,) 

Ultimately leads the pipeline failing when it fails to locate the weighted average later on down the line:

Traceback:
        Traceback (most recent call last):
          File "/home/galassiae/Projects/petprep_extract_tacs/petprep_extract_tacs_env/lib64/python3.9/site-packages/nipype/interfaces/base/core.py", line 400, in run
            outputs = self.aggregate_outputs(runtime)
          File "/home/galassiae/Projects/petprep_extract_tacs/petprep_extract_tacs_env/lib64/python3.9/site-packages/nipype/interfaces/base/core.py", line 429, in aggregate_outputs
            predicted_outputs = self._list_outputs()  # Predictions from _list_outputs
          File "/home/galassiae/Projects/petprep_extract_tacs/petprep_extract_tacs_env/lib64/python3.9/site-packages/nipype/interfaces/io.py", line 1469, in _list_outputs
            raise IOError(msg)
        OSError: No files were found matching pet_file template: /home/galassiae/Data/PDE4B_BIDS/s*/s*/pet/*sub-PF12_ses-test_run-1_desc-wavg_pet.[n]*

Same error occurs w/ or without running --petprep_hmc flag on this dataset.

mnoergaard commented 5 months ago

@bendhouseart - I believe this might be happening because of inconsistent timing information in the json files (i.e. the data is not BIDS compliant). Please verify that the 4th dimension of the nifti files matches the number of entries in the timing information in the json files.

bendhouseart commented 5 months ago

Well, you nailed it; seems like we're up/down 1 frame between NIfTI and json:

[galassiae@elgreco3 PDE4B_BIDS]$ mri_info sub-PF12/ses-test/pet/sub-PF12_ses-test_run-2_pet.nii.gz | grep dimensions
    dimensions: 200 x 200 x 111 x 19
[galassiae@elgreco3 PDE4B_BIDS]$ cat sub-PF12/ses-test/pet/sub-PF12_ses-test_run-2_pet.json | jq -r 'values.FrameTimesStart'
[
  8695.0,
  8995.0,
  9295.0,
  9595.0,
  9895.0,
  10195.0,
  10495.0,
  10795.0,
  11095.0,
  11395.0,
  11695.0,
  11995.0,
  12295.0,
  12595.0,
  12895.0,
  13195.0,
  13495.0,
  13795.0
]