bids-apps / HCPPipelines

A BIDS App for minimal preprocessing using the HCP Pipelines
33 stars 30 forks source link

fieldmap for BOLD file not found even though it is present #73

Open rmldj opened 2 years ago

rmldj commented 2 years ago

Hello,

I posted this on the hcp-users group but it seems to be more specific to the BIDS app:

I am trying to run the HCPPipelines BIDS app on a sample subject from my colleague's data. After the PostFreeSurferPipeline is completed, I get the error:

  File "/run.py", line 435, in <module>
    f"No fieldmaps found for BOLD {fmritcs}. Consider --procesing_mode [legacy | auto ]."
AssertionError: No fieldmaps found for BOLD /bids_dataset/sub-121c/func/sub-121c_task-rest_bold.nii.gz. Consider --procesing_mode [legacy | auto ].

However in the subdirectory sub-121c/fmap, I have the following files:

sub-121c_dir-PA_epi.json    sub-121c_magnitude2.json
sub-121c_dir-PA_epi.nii.gz  sub-121c_magnitude2.nii.gz
sub-121c_magnitude1.json    sub-121c_phasediff.json
sub-121c_magnitude1.nii.gz  sub-121c_phasediff.nii.gz

In the sub-121c_dir-PA_epi.json there is the line

    "IntendedFor": "func/sub-121c_task-rest_bold.nii.gz"

and the corresponding sub-121c_dir-PA_epi.nii.gz is present.

The BIDS validator correctly identifies the corresponding BOLD map func/sub-121c_task-rest_bold.nii.gz - I checked this by modifying the IntendedFor field. However the pipeline script somehow does not locate the fieldmap sub-121c_dir-PA_epi.nii.gz... I would be grateful for any help.. Romuald

rmldj commented 2 years ago

Btw. I pulled the latest version from docker hub yesterday - so this should be v4.3.0-3

rmldj commented 2 years ago

I did some sleuthing on the command line using BIDSLayout. It seems that the problem is in https://github.com/BIDS-Apps/HCPPipelines/blob/master/run.py#L416 The fieldmap_set that I get is

[{'epi': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_dir-PA_epi.nii.gz', 'suffix': 'epi'}, {'phasediff': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_phasediff.nii.gz', 'magnitude1': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_magnitude1.nii.gz', 'suffix': 'phasediff', 'magnitude2': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_magnitude2.nii.gz'}]

hence the following condition fails:

all(item["suffix"] == "epi" for item in fieldmap_set)

However, if I would erase the phasediff and magnitude files it would still not work as it would fail the condition

len(fieldmap_set) == 2

So it seems that the code expects two have two epi fieldmaps, while I have only one? Is it true? Does that mean that the data is incomplete and I should be using auto processing mode here? (I have a T2w image)

rhancockn commented 2 years ago

This is very helpful-it looks like the code could better handle the presence of both epi and phase/magnitude fieldmaps. However, you do have incomplete data. EPI fieldmaps come in pairs acquired in opposite phase encoding directions; the field cannot be calculated from a single direction. You are missing the file fmap/sub-121c_dir-AP_epi.nii.gz from the dataset. If you remove the fmap/sub-121c_dir-PA_epi.nii.gz file, processing should proceed with the phase/magnitude data, provided that is suitable for correcting your data. This is admittedly less thoroughly tested than EPI fieldmaps.

Roeland Hancock

On Fri, Jan 14, 2022 at 4:37 PM rmldj @.***> wrote:

I did some sleuthing on the command line using BIDSLayout. It seems that the problem is in https://github.com/BIDS-Apps/HCPPipelines/blob/master/run.py#L416 The fieldmap_set that I get is

[{'epi': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_dir-PA_epi.nii.gz', 'suffix': 'epi'}, {'phasediff': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_phasediff.nii.gz', 'magnitude1': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_magnitude1.nii.gz', 'suffix': 'phasediff', 'magnitude2': '/opt/romuald/SR/fMRI_data/sub-121c/fmap/sub-121c_magnitude2.nii.gz'}]

hence the following condition fails:

all(item["suffix"] == "epi" for item in fieldmap_set)

However, if I would erase the phasediff and magnitude files it would still not work as it would fail the condition

len(fieldmap_set) == 2

So it seems that the code expects two have two epi fieldmaps, while I have only one? Is it true? Does that mean that the data is incomplete and I should be using auto processing mode here? (I have a T2w image)

— Reply to this email directly, view it on GitHub https://github.com/BIDS-Apps/HCPPipelines/issues/73#issuecomment-1013490757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARMKWYA4SMIXC34PIZUJPLUWCJSLANCNFSM5L7C4MNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

rmldj commented 2 years ago

Thanks! I will ask for the AP file. But apparently the legacy method has The following LegacyStyleData settings were requested: --dcmethod=NONE So the HCPPipeline does not do any distortion correction - the phase/magnitude data would be used with the option https://github.com/Washington-University/HCPpipelines/blob/master/fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh#L76 so this need some setup from inside the BIDS app?