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

[GENFI] Update genfi patch #912

Merged
merged 59 commits into from
May 16, 2023

Conversation

MatthieuJoulot
Copy link
Contributor

Processing the whole dataset reveals a few more problems. This PR handles these problems.

@MatthieuJoulot
Copy link
Contributor Author

The test should break since the CI needs to be updated

@MatthieuJoulot
Copy link
Contributor Author

new data can be found here

@MatthieuJoulot MatthieuJoulot marked this pull request as ready for review May 11, 2023 14:56
@MatthieuJoulot
Copy link
Contributor Author

Unit-tests currently crash for the following reason: I changed the content of the bidsignore and added dwi to be ignored. I did that in order to respect the Philips sequence and to pass the bids-validator, which otherwise contradict.

They contradict because GENFI acquired a single b0, which has no bvecs or bvals, which is not allowed by the bids-spec.

I'm conflicted regarding this addition of dwi to the bidsignore, I'd rather remove it (even though I've added it), and not let GENFI pass the bids-validator, since it is out of spec.
@NicolasGensollen WDYT ?

Copy link
Member

@NicolasGensollen NicolasGensollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MatthieuJoulot !
I made a quick first pass without testing it (will do that later today...).
I'm a bit concerned with the changes made to utility functions used across all converters.
Did you make sure your modifications were not breaking anything ?

@@ -524,6 +524,7 @@ def _write_bidsignore(bids_dir: Union[str, Path]) -> None:
with open(Path(bids_dir) / ".bidsignore", "w") as f:
# pet/ is necessary until PET is added to BIDS standard
f.write("\n".join(["swi/\n"]))
f.write("\n".join(["dwi/\n"]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change ? Isn't this breaking other converters relying on this function ?

# ].agg("/".join, axis=1),
)
df_sub_ses_run = df_sub_ses_run.assign(
bids_filename=lambda df: df.bids_filename.apply(lambda x: x.replace("__", "_"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what you're doing here. Why would there exist "__" in the file names ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of the task_rest that is aggregated as well. since it only exists for fMRI acquisitions, two underscores are aggregated for other modalities.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I think we need to discuss this together. It looks very hacky from a reader's point of view...

The merge_imaging_data was always a weak point with a lot of lines and hard-to-follow logic.
We managed to make it reasonably complex the last time, but it seems to be "complexifying" again.

json.dump(data, json_file, indent=4)
with open(json_file, "r+") as f:
if multipart_id is not None:
data = json.load(f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these changes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but this doesn't work. So I changed back to what I had done in the first place, which I does !
It may not be optimal though, so we can look at it together

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we'll take a look at the error you're getting this afternoon.

Copy link
Member

@NicolasGensollen NicolasGensollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a second pass. I think we need to refactor a bit the function merge_imaging_data. It's getting really difficult to understand what's going on in it and I'm afraid it will look totally opaque to us in a few months...

json.dump(data, json_file, indent=4)
with open(json_file, "r+") as f:
if multipart_id is not None:
data = json.load(f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we'll take a look at the error you're getting this afternoon.

# ].agg("/".join, axis=1),
)
df_sub_ses_run = df_sub_ses_run.assign(
bids_filename=lambda df: df.bids_filename.apply(lambda x: x.replace("__", "_"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I think we need to discuss this together. It looks very hacky from a reader's point of view...

The merge_imaging_data was always a weak point with a lot of lines and hard-to-follow logic.
We managed to make it reasonably complex the last time, but it seems to be "complexifying" again.

Example
-------
source_id = 'C9ORF001'
source_ses_id = '11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 11 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11 means it is the first session of GENFI 2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's much clearer now that you added an example for source, thanks !

Copy link
Member

@NicolasGensollen NicolasGensollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @MatthieuJoulot !

@NicolasGensollen
Copy link
Member

Alright ! All tests are passing, merging...

@NicolasGensollen NicolasGensollen merged commit 45f50bf into aramis-lab:dev May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants