Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEPOLAR field map can't be recognised after upgrading to version 22.0.0 #286

Closed
manzouri opened this issue Sep 9, 2022 · 38 comments
Closed
Labels
bug Something isn't working

Comments

@manzouri
Copy link

manzouri commented Sep 9, 2022

What happened?

I could use my PEPOLAR filed maps with earlier version but v 22 can't recognise them any Moreland ignore field maps

What command did you use?

fmriprep-docker $bids_root_dir $out_dir/ \
    participant \
    --participant-label $subject \
    --skip-bids-validation \
    --md-only-boilerplate \
    --output-spaces MNI152NLin2009cAsym \
    --fs-no-reconall \
    --fs-license-file /usr/local/freesurfer/license.txt \

What version of fMRIPrep are you running?

22.0.0

How are you running fMRIPrep?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

It runs smoothly but without field maps

Additional information / screenshots

No response

@manzouri manzouri added the bug Something isn't working label Sep 9, 2022
@mgxd
Copy link
Contributor

mgxd commented Sep 9, 2022

Can you remove --skip-bids-validation and add -vv to your command and retry? This will give us more information on what's happening.

@manzouri
Copy link
Author

It runs smoothly and generates the report without error but without field maps. I attach the log file here.
report.csv

@manzouri
Copy link
Author

Hi @mgxd , did you get any chance to look at this?

@mgxd
Copy link
Contributor

mgxd commented Sep 15, 2022

Yeah I took a look, but nothing in the report jumps out. Perhaps you can share the directory tree of the subject you are running into trouble with, along with the relevant fieldmap metadata (IntendedFor or B0FieldIdentifier fields).

@manzouri
Copy link
Author

manzouri commented Sep 16, 2022

Here is the tree:

├── dataset_description.json
└── sub-102
    └── ses-01
        ├── anat
        │   ├── sub-102_ses-01_run-01_T1w.json
        │   ├── sub-102_ses-01_run-01_T1w.nii.gz
        │   ├── sub-102_ses-01_run-01_T2w.json
        │   └── sub-102_ses-01_run-01_T2w.nii.gz
        ├── fmap
        │   ├── sub-102_ses-01_dir-AP_epi.json
        │   └── sub-102_ses-01_dir-AP_epi.nii.gz
        ├── func
        │   ├── sub-102_ses-01_task-rs_run-01_bold.json
        │   └── sub-102_ses-01_task-rs_run-01_bold.nii.gz
        └── sub-102_ses-01_scans.tsv

And I added this to my fieldmap json file :"IntendedFor":["ses-01/func/sub-102_ses-01_task-rs_run-01_bold.nii.gz"]
When I run fmriprep V21.0.2 on the exactly same raw_data it does the filedmap correction.

@mgxd
Copy link
Contributor

mgxd commented Sep 16, 2022

I'm not sure what is happening, but I can try reproducing this - I'll just need any the (non-identifying) metadata for the _epi and _bold files.

@manzouri
Copy link
Author

@mgxd I made attached json files , hope those help.
metadata.zip

@mgxd
Copy link
Contributor

mgxd commented Sep 19, 2022

Local test
sub-102/
└── ses-01
    ├── anat
    │   ├── sub-102_ses-01_run-01_T1w.json
    │   ├── sub-102_ses-01_run-01_T1w.nii.gz
    │   ├── sub-102_ses-01_run-01_T2w.json
    │   └── sub-102_ses-01_run-01_T2w.nii.gz
    ├── fmap
    │   ├── sub-102_ses-01_dir-AP_epi.json
    │   └── sub-102_ses-01_dir-AP_epi.nii.gz
    └── func
        ├── sub-102_ses-01_task-rs_run-01_bold.json
        └── sub-102_ses-01_task-rs_run-01_bold.nii.gz

$ sdcflows-find-estimators . 
Estimation for </private/tmp/tst> complete. Found:
	sub-102
		FieldmapEstimation(sources=<2 files>, method=<EstimatorType.PEPOLAR: 2>, bids_id='auto_00000')
			j-	ses-01/fmap/sub-102_ses-01_dir-AP_epi.nii.gz
			j	ses-01/func/sub-102_ses-01_task-rs_run-01_bold.nii.gz

It seems sdcflows' detection is working as expected...and looking through the changes between 21.0.x and 22.0.x, I'm not seeing any signs of regression. (cc @effigies @oesteban in case either of you have further ideas)

@oesteban
Copy link
Member

Perhaps @manzouri could run something like:

docker --rm -it --entrypoint=/bin/bash -v $bids_root_dir:/data:ro nipreps/fmriprep:22.0.0 find /data/sub-102/ses-01 -type f

and check that the fieldmaps are indeed accessible from the process.

For ourselves, we could add printing out the subject(s)' data tree to the report when executed very verbose. Evidently, none of this resolves the problem, but would certainly help when debugging these issues.

@manzouri
Copy link
Author

Thanks @oesteban , I tried to run the comand but getting this :
/usr/bin/find: /usr/bin/find: cannot execute binary file
By the way as I mentioned before it works perfectly fine with V21.0.2.
Do you think you can resolve this issue so I can use the latest version soon?

@oesteban
Copy link
Member

Thanks @oesteban , I tried to run the comand but getting this : /usr/bin/find: /usr/bin/find: cannot execute binary file

That's weird. What do you get from:

docker --rm -it --entrypoint=/bin/bash -v $bids_root_dir:/data:ro nipreps/fmriprep:22.0.0 ls -lah /data/sub-102/ses-01/*

?

By the way as I mentioned before it works perfectly fine with V21.0.2. Do you think you can resolve this issue so I can use the latest version soon?

To resolve the issue, we will first need to understand it so that a solution can be tried and perhaps resolve it. The feedback we have received thus far has not been enough for us to understand it. That's why we are asking further questions.

@manzouri
Copy link
Author

@oesteban , I get the command to run with minor changes
docker run --rm -it --entrypoint="" -v $bids_root_dir:/data:ro nipreps/fmriprep:22.0.0 find /data/sub-102/ses-01 -type f
This is the output:
/data/sub-102/ses-01/anat/sub-102_ses-01_run-01_T2w.json
/data/sub-102/ses-01/anat/sub-102_ses-01_run-01_T1w.json
/data/sub-102/ses-01/anat/sub-102_ses-01_run-01_T1w.nii.gz
/data/sub-102/ses-01/anat/sub-102_ses-01_run-01_T2w.nii.gz
/data/sub-102/ses-01/func/sub-102_ses-01_task-rs_run-01_bold.nii.gz
/data/sub-102/ses-01/func/sub-102_ses-01_task-rs_run-01_bold.json
/data/sub-102/ses-01/sub-102_ses-01_scans.tsv
/data/sub-102/ses-01/fmap/sub-102_ses-01_dir-AP_epi.json
/data/sub-102/ses-01/fmap/sub-102_ses-01_dir-AP_epi.nii.gz

@manzouri
Copy link
Author

@oesteban , And after second command
docker run --rm -it --entrypoint="" -v $bids_root_dir:/data:ro nipreps/fmriprep:22.0.0 ls -lah /data/sub-102/ses-01/*
ls: cannot access '/data/sub-102/ses-01/*': No such file or directory

@mgxd
Copy link
Contributor

mgxd commented Sep 22, 2022

@manzouri would you be able to share this subject / some phantom data with us? Perhaps that would help finally track this down

@oesteban
Copy link
Member

docker run --rm -it --entrypoint="" -v $bids_root_dir:/data:ro nipreps/fmriprep:22.0.0 ls -lah /data/sub-102/ses-01/*
ls: cannot access '/data/sub-102/ses-01/*': No such file or directory

This is surprising, especially after seeing the output of the first command.

@manzouri would you be able to share this subject / some phantom data with us? Perhaps that would help finally track this down

I agree this seems to be the best way to understand what's going on.

@manzouri
Copy link
Author

@oesteban , without * at the end I get the following
total 24K
drwxr-xr-x 5 1001 1002 4.0K Sep 12 14:02 .
drwxr-xr-x 3 1001 1002 4.0K Sep 9 10:59 ..
drwxr-xr-x 2 1001 1002 4.0K Sep 12 14:02 anat
drwxr-xr-x 2 1001 1002 4.0K Sep 19 08:29 fmap
drwxr-xr-x 2 1001 1002 4.0K Sep 21 20:51 func
-rw-r--r-- 1 1001 1002 410 Apr 27 20:44 sub-102_ses-01_scans.tsv

@manzouri
Copy link
Author

manzouri commented Sep 22, 2022

@mgxd ,I can share another pilot data acquired from Siemens and another type of field map but same problem if that helps?

├── dataset_description.json
└── sub-pilot1
    └── ses-01
        ├── anat
        │   ├── sub-pilot1_ses-01_run-01_T1w.json
        │   └── sub-pilot1_ses-01_run-01_T1w.nii.gz
        ├── fmap
        │   ├── sub-pilot1_ses-01_run-01_magnitude1.json
        │   ├── sub-pilot1_ses-01_run-01_magnitude1.nii.gz
        │   ├── sub-pilot1_ses-01_run-01_magnitude2.json
        │   ├── sub-pilot1_ses-01_run-01_magnitude2.nii.gz
        │   ├── sub-pilot1_ses-01_run-01_phasediff.json
        │   └── sub-pilot1_ses-01_run-01_phasediff.nii.gz
        └── func
            ├── sub-pilot1_ses-01_task-suppression_run-01_bold.json
            └── sub-pilot1_ses-01_task-suppression_run-01_bold.nii.gz

@mgxd
Copy link
Contributor

mgxd commented Sep 22, 2022

That seems like a different fieldmap, which won't help in this case - if you can't share or don't have any similar data, we can think of ways to better inform us on what is going on when searching for estimation methods and include it in a future release.

@manzouri
Copy link
Author

@mgxd , Unfortunately I can't share this data and I don't have any similar from GE scanner but I am having the same problem with the fieldmaps from Siemens and I can easily share that data with you. Would be great if you can work on the available data to resolve this.

@manzouri
Copy link
Author

@mgxd , @oesteban Please let me know how I can help or better inform you about this issue?

@manzouri
Copy link
Author

manzouri commented Oct 3, 2022

Hi @mgxd , I saw that you were busy with new release just wonder if there has been any progress with this issue also?

@oesteban
Copy link
Member

oesteban commented Oct 3, 2022

@mgxd , Unfortunately I can't share this data and I don't have any similar from GE scanner but I am having the same problem with the fieldmaps from Siemens and I can easily share that data with you. Would be great if you can work on the available data to resolve this.

This would be the fastest way. If you are seeing the same issue on Siemens data and can share those, I'm fairly confident that's going to be the best option.

@manzouri
Copy link
Author

manzouri commented Oct 3, 2022

@oesteban , would you please give me your email to share the link?

@oesteban
Copy link
Member

oesteban commented Oct 3, 2022

nipreps@gmail.com should do ;)

thanks!

@manzouri
Copy link
Author

manzouri commented Oct 3, 2022

thanks @oesteban , just sent it and hope it helps :)

@oesteban
Copy link
Member

oesteban commented Oct 3, 2022

Thanks @manzouri, I can replicate the issue. Will look into this today or tomorrow.

@manzouri
Copy link
Author

manzouri commented Oct 5, 2022

Hi @oesteban , I wonder if you had some time to try my data and if you also have the same problem when running fmriprep from your end?

@oesteban oesteban transferred this issue from nipreps/fmriprep Oct 6, 2022
@oesteban
Copy link
Member

oesteban commented Oct 6, 2022

@effigies @mgxd commenting this line out:

"scope": "raw", # Ensure derivatives are not captured
solves the issue.

tested with PyBIDS 0.15.

With that line commented out, then this line below:

for fmap in layout.get(suffix=["fieldmap", "phasediff", "phase1"], **base_entities):
manages to identify the fieldmap.

My impression is that there must be some initialization parameter we are setting on the layout in fMRIPrep's side that disallows using the scope argument (then taken as an entity). Not sure this is a bug here or maybe pybids?

@manzouri
Copy link
Author

manzouri commented Oct 7, 2022

@oesteban , Good that you can find the bug, would it be possible for me to run fmriprep on my data soon?

@oesteban
Copy link
Member

oesteban commented Oct 7, 2022

I hope so - now, the next step is implementing a solution. We need to figure out whether we just remove that line, which will depend on the side effects of doing so. It could also be that we found a bug on PyBIDS. We will go as fast as our workload permits.

@mgxd
Copy link
Contributor

mgxd commented Oct 7, 2022

@manzouri can you share the contents of $bids_root_dir/dataset_description.json

@manzouri
Copy link
Author

manzouri commented Oct 7, 2022

@mgxd
{
"Name": "fMRIPrep - fMRI PREProcessing workflow",
"BIDSVersion": "1.4.0",
"DatasetType": "derivative",
"GeneratedBy": [
{
"Name": "fMRIPrep",
"Version": "20.2.1",
"CodeURL": "https://github.com/nipreps/fmriprep/archive/20.2.1.tar.gz"
}
],
"HowToAcknowledge": "Please cite our paper (https://doi.org/10.1038/s41592-018-0235-4), and include the generated citation boilerplate within the Methods section of the text."
}

@effigies
Copy link
Member

effigies commented Oct 7, 2022

@manzouri That's the fMRIPrep-generated dataset_description.json. We need the one from your input dataset.

@mgxd
Copy link
Contributor

mgxd commented Oct 7, 2022

What I think is happening is the fieldmaps are not being found because the root dataset_description.json includes "DatasetType": "derivative". If you remove this line, does that fix your problem?

@manzouri
Copy link
Author

manzouri commented Oct 7, 2022

@mgxd , thanks I think that was the solution now I see these lines when I run:
221007-16:13:10,995 nipype.workflow INFO:
B0 field inhomogeneity map will be estimated with the following 1 estimators: [<EstimatorType.PHASEDIFF: 3>].

@manzouri
Copy link
Author

manzouri commented Oct 7, 2022

What I think is happening is the fieldmaps are not being found because the root dataset_description.json includes "DatasetType": "derivative". If you remove this line, does that fix your problem?

And the previous versions were not sensitive to this maybe it is good to mention it somewhere for other people.

@effigies
Copy link
Member

effigies commented Oct 7, 2022

Out of curiosity, why does your dataset_description.json indicate that you are passing in fMRIPrep outputs as inputs? In general, I would expect datasets with bad metadata to misbehave.

That said, I agree we should handle this case better.

@manzouri
Copy link
Author

manzouri commented Oct 7, 2022

Out of curiosity, why does your dataset_description.json indicate that you are passing in fMRIPrep outputs as inputs? In general, I would expect datasets with bad metadata to misbehave.

That said, I agree we should handle this case better.

You are right, I copied it by mistake.
Thanks for your support and have a great weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants