Skip to content

Commit

Permalink
refactor: use junifer_data to load xfms
Browse files Browse the repository at this point in the history
  • Loading branch information
synchon committed Jan 24, 2025
1 parent 75b6544 commit fae153d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions junifer/data/template_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

import nibabel as nib
import numpy as np
from junifer_data import get
from templateflow import api as tflow

from ..utils import logger, raise_error
from .utils import check_dataset, closest_resolution, fetch_file_via_datalad
from .utils import JUNIFER_DATA_VERSION, closest_resolution, get_dataset_path


__all__ = ["get_template", "get_xfm"]
Expand All @@ -33,17 +34,14 @@ def get_xfm(src: str, dst: str) -> Path: # pragma: no cover
The path to the transformation file.
"""
# Get dataset
dataset = check_dataset()
# Set file path to retrieve
xfm_file_path = (
dataset.pathobj
/ "xfms"
/ f"{src}_to_{dst}"
/ f"{src}_to_{dst}_Composite.h5"
)
xfm_file_path = Path(f"xfms/{src}_to_{dst}/{src}_to_{dst}_Composite.h5")
# Retrieve file
return fetch_file_via_datalad(dataset=dataset, file_path=xfm_file_path)
return get(
file_path=xfm_file_path,
dataset_path=get_dataset_path(),
tag=JUNIFER_DATA_VERSION,
)


def get_template(
Expand Down

0 comments on commit fae153d

Please sign in to comment.