-
Notifications
You must be signed in to change notification settings - Fork 131
feat: rename BIDS files for multi-orientation series. #788
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
Draft
bpinsard
wants to merge
6
commits into
nipy:master
Choose a base branch
from
UNFmontreal:enh/multi_sliceorientationpatient
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
05796fb
rebase update_multiorient_name
bpinsard 09c9115
please typing
bpinsard 414eaa9
add data and bids tests
bpinsard 2aa4427
fix mypy with assert
bpinsard a934582
Apply suggestions from code review
bpinsard 5fedadb
fix tests, use BIDSFile for renaming
bpinsard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""Heuristic demonstrating conversion of the Multi-Echo sequences. | ||
|
||
It only cares about converting sequences which have _ME_ in their | ||
series_description and outputs to BIDS. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from heudiconv.utils import SeqInfo | ||
|
||
|
||
def create_key( | ||
template: Optional[str], | ||
outtype: tuple[str, ...] = ("nii.gz",), | ||
annotation_classes: None = None, | ||
) -> tuple[str, tuple[str, ...], None]: | ||
if template is None or not template: | ||
raise ValueError("Template must be a valid format string") | ||
return (template, outtype, annotation_classes) | ||
|
||
|
||
def infotodict( | ||
seqinfo: list[SeqInfo], | ||
) -> dict[tuple[str, tuple[str, ...], None], list[str]]: | ||
"""Heuristic evaluator for determining which runs belong where | ||
|
||
allowed template fields - follow python string module: | ||
|
||
item: index within category | ||
subject: participant id | ||
seqitem: run number during scanning | ||
subindex: sub index within group | ||
""" | ||
localizer = create_key("sub-{subject}/anat/sub-{subject}_localizer") | ||
|
||
info: dict[tuple[str, tuple[str, ...], None], list[str]] = { | ||
localizer: [], | ||
} | ||
for s in seqinfo: | ||
if "localizer" in s.series_description: | ||
info[localizer].append(s.series_id) | ||
return info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+671 KB
...onv/tests/data/01-localizer_64ch/MR.1.3.12.2.1107.5.2.43.167006.2018113015350928736278242
Binary file not shown.
Binary file added
BIN
+671 KB
...conv/tests/data/01-localizer_64ch/MR.1.3.12.2.1107.5.2.43.167006.201811301535098526678240
Binary file not shown.
Binary file added
BIN
+671 KB
...onv/tests/data/01-localizer_64ch/MR.1.3.12.2.1107.5.2.43.167006.2018113015351140807678244
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.