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

Enh/compute_subject_gm_mask #404

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion junifer/data/coordinates/_fsl_coordinates_warper.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def warp(
f"{pretransform_coordinates_path.resolve()}",
"| img2imgcoord -mm",
f"-src {target_data['path'].resolve()}",
f"-dest {target_data['reference_path'].resolve()}",
f"-dest {target_data['reference']["path"].resolve()}",
f"-warp {warp_data['path'].resolve()}",
f"> {transformed_coords_path.resolve()};",
f"sed -i 1d {transformed_coords_path.resolve()}",
Expand Down
17 changes: 11 additions & 6 deletions junifer/data/masks/_ants_mask_warper.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@
The mask image to transform.
src : str
The data type or template space to warp from.
It should be empty string if ``dst="T1w"``.
It should be empty string if ``dst="native"``.
dst : str
The data type or template space to warp to.
`"T1w"` is the only allowed data type and it uses the resampled T1w
found in ``target_data.reference_path``. The ``"reference_path"``
key is added when :class:`.SpaceWarper` is used.
`"native"` is the only allowed data type and it uses the resampled
T1w found in ``target_data.reference``. The

Check failure on line 53 in junifer/data/masks/_ants_mask_warper.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W291)

junifer/data/masks/_ants_mask_warper.py:53:56: W291 Trailing whitespace

Check failure on line 53 in junifer/data/masks/_ants_mask_warper.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W291)

junifer/data/masks/_ants_mask_warper.py:53:56: W291 Trailing whitespace
``"reference"`` key is added when :class:`.SpaceWarper` is
used or if the data is provided native space.
target_data : dict
The corresponding item of the data object to which the mask
will be applied.
warp_data : dict or None
The warp data item of the data object. The value is unused if
``dst!="T1w"``.
``dst!="native"``.

Returns
-------
Expand Down Expand Up @@ -87,6 +88,10 @@
# Warp data check
if warp_data is None:
raise_error("No `warp_data` provided")
if "reference" not in target_data:
raise_error("No `reference` provided")
if "path" not in target_data["reference"]:
raise_error("No `path` provided in `reference`")

logger.debug("Using ANTs for mask transformation")

Expand All @@ -104,7 +109,7 @@
"-n 'GenericLabel[NearestNeighbor]'",
f"-i {prewarp_mask_path.resolve()}",
# use resampled reference
f"-r {target_data['reference_path'].resolve()}",
f"-r {target_data['reference']["path"].resolve()}",
f"-t {warp_data['path'].resolve()}",
f"-o {warped_mask_path.resolve()}",
]
Expand Down
2 changes: 1 addition & 1 deletion junifer/data/masks/_fsl_mask_warper.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def warp(
"--interp=nn",
f"-i {prewarp_mask_path.resolve()}",
# use resampled reference
f"-r {target_data['reference_path'].resolve()}",
f"-r {target_data['reference']["path"].resolve()}",
f"-w {warp_data['path'].resolve()}",
f"-o {warped_mask_path.resolve()}",
]
Expand Down
Loading
Loading