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

add "GeneratedBy"s in dataset_description.json for BIDS 1.4+ compliance #1019

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion AFQ/api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ def __init__(self,
"Name": bids_description["Name"],
"BIDSVersion": bids_description["BIDSVersion"],
"PipelineDescription": {"Name": "pyAFQ",
"Version": pyafq_version}}
"Version": pyafq_version},
"GeneratedBy": [{"Name": op.basename(self.afq_path),
"Version": pyafq_version}]}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you really have both of these side-by-side?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I left the PipelineDescription for compatibility. I think it's just going to be extra and should be deleted in the near future.

Comment on lines +190 to +192
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, while we're here, could we add something like:

Suggested change
"Version": pyafq_version},
"GeneratedBy": [{"Name": op.basename(self.afq_path),
"Version": pyafq_version}]}
"Version": pyafq_version},
"GeneratedBy": [{"Name": op.basename(self.afq_path),
"Version": pyafq_version}],
"HowToAcknowledge": "Please cite this paper: https://apertureneuro.org/article/77465-evaluating-the-reliability-of-human-brain-white-matter-tractometry"}


pl_desc_file = op.join(self.afq_path, 'dataset_description.json')

Expand Down
18 changes: 12 additions & 6 deletions AFQ/data/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,8 @@ def organize_cfin_data(path=None):
to_bids_description(
dmriprep_folder,
**{"Name": "CFIN",
"PipelineDescription": {"Name": "dipy"}})
"PipelineDescription": {"Name": "dipy"},
"GeneratedBy": [{"Name": "dipy"}]})


def organize_stanford_data(path=None, clear_previous_afq=None):
Expand Down Expand Up @@ -1120,10 +1121,12 @@ def organize_stanford_data(path=None, clear_previous_afq=None):
# And descriptions of the pipelines in the derivatives:
to_bids_description(dmriprep_folder,
**{"Name": "Stanford HARDI",
"PipelineDescription": {"Name": "vistasoft"}})
"PipelineDescription": {"Name": "vistasoft"},
"GeneratedBy": [{"Name": "vistasoft"}]})
to_bids_description(freesurfer_folder,
**{"Name": "Stanford HARDI",
"PipelineDescription": {"Name": "freesurfer"}})
"PipelineDescription": {"Name": "freesurfer"},
"GeneratedBy": [{"Name": "freesurfer"}]})


fetch_stanford_hardi_lv1 = _make_reusable_fetcher(
Expand Down Expand Up @@ -1750,7 +1753,8 @@ def fetch_hcp(subjects,
to_bids_description(base_dir,
**{"Name": study,
"Acknowledgements": hcp_acknowledgements,
"PipelineDescription": {'Name': 'dmriprep'}})
"PipelineDescription": {'Name': 'dmriprep'},
"GeneratedBy": [{'Name': 'dmriprep'}]})

return data_files, op.join(my_path, study)

Expand Down Expand Up @@ -1844,7 +1848,8 @@ def fetch_hbn_preproc(subjects, path=None):
to_bids_description(base_dir,
**{"Name": "HBN",
"Acknowledgements": hbn_acknowledgements,
"PipelineDescription": {'Name': 'qsiprep'}})
"PipelineDescription": {'Name': 'qsiprep'},
"GeneratedBy": [{'Name': 'qsiprep'}]})

return data_files, op.join(my_path, "HBN")

Expand Down Expand Up @@ -1941,6 +1946,7 @@ def fetch_hbn_afq(subjects, path=None):
# Create the BIDS derivatives description file text
to_bids_description(base_dir,
**{"Name": "HBN",
"PipelineDescription": {'Name': 'afq'}})
"PipelineDescription": {'Name': 'afq'},
"GeneratedBy": [{'Name': 'afq'}]})

return data_files, op.join(my_path, "HBN")
15 changes: 10 additions & 5 deletions AFQ/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def create_dummy_bids_path(n_subjects, n_sessions, share_sessions=True):
afd.to_bids_description(
dmriprep_dir,
**{"Name": "Dummy",
"PipelineDescription": {"Name": "synthetic"}})
"PipelineDescription": {"Name": "synthetic"},
"GeneratedBy": [{"Name": "synthetic"}]})

for subject in subjects:
for session in sessions:
Expand All @@ -140,7 +141,8 @@ def create_dummy_bids_path(n_subjects, n_sessions, share_sessions=True):
afd.to_bids_description(
dmriprep_dir,
**{"Name": "Dummy",
"PipelineDescription": {"Name": "synthetic"}})
"PipelineDescription": {"Name": "synthetic"},
"GeneratedBy": [{"Name": "synthetic"}]})

for d in range(n_subjects):
subject = subjects[d]
Expand All @@ -163,7 +165,8 @@ def create_dummy_bids_path(n_subjects, n_sessions, share_sessions=True):
afd.to_bids_description(
dmriprep_dir,
**{"Name": "Dummy",
"PipelineDescription": {"Name": "synthetic"}})
"PipelineDescription": {"Name": "synthetic"},
"GeneratedBy": [{"Name": "synthetic"}]})

for subject in subjects:
for modality in ['anat', 'dwi']:
Expand Down Expand Up @@ -205,7 +208,8 @@ def test_AFQ_missing_files():
"otherDeriv"),
**{
"Name": "Missing",
"PipelineDescription": {"Name": "otherDeriv"}})
"PipelineDescription": {"Name": "otherDeriv"},
"GeneratedBy": [{"Name": "otherDeriv"}]})
touch(op.join(subses_folder, "sub-01_ses-01_dwi.nii.gz"))

with pytest.raises(
Expand All @@ -218,7 +222,8 @@ def test_AFQ_missing_files():
afd.to_bids_description(
op.join(bids_path, "missingPipe"), **{
"Name": "Missing",
"PipelineDescription": {"Name": "missingPipe"}})
"PipelineDescription": {"Name": "missingPipe"},
"GeneratedBy": [{"Name": "missingPipe"}]})
with pytest.raises(
ValueError,
match="No non-json files recognized by pyBIDS"
Expand Down
3 changes: 2 additions & 1 deletion examples/tutorial_examples/plot_bids_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
afd.to_bids_description(
tractography_path,
**{"Name": "my_tractography",
"PipelineDescription": {"Name": "my_tractography"}})
"PipelineDescription": {"Name": "my_tractography"},
"GeneratedBy": [{"Name": "my_tractography"}]})


###########################################################################
Expand Down
Loading