junifer 0.0.6.dev116__py3-none-any.whl → 0.0.6.dev119__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- junifer/_version.py +2 -2
- junifer/data/template_spaces.py +64 -42
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/METADATA +1 -1
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/RECORD +9 -9
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/WHEEL +0 -0
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev116.dist-info → junifer-0.0.6.dev119.dist-info}/top_level.txt +0 -0
junifer/_version.py
CHANGED
@@ -12,5 +12,5 @@ __version__: str
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
13
13
|
version_tuple: VERSION_TUPLE
|
14
14
|
|
15
|
-
__version__ = version = '0.0.6.
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 6, '
|
15
|
+
__version__ = version = '0.0.6.dev119'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 6, 'dev119')
|
junifer/data/template_spaces.py
CHANGED
@@ -6,9 +6,10 @@
|
|
6
6
|
from pathlib import Path
|
7
7
|
from typing import Any, Dict, Optional, Union
|
8
8
|
|
9
|
-
import
|
9
|
+
import datalad.api as dl
|
10
10
|
import nibabel as nib
|
11
11
|
import numpy as np
|
12
|
+
from datalad.support.exceptions import IncompleteResultsError
|
12
13
|
from templateflow import api as tflow
|
13
14
|
|
14
15
|
from ..utils import logger, raise_error
|
@@ -41,61 +42,82 @@ def get_xfm(
|
|
41
42
|
Raises
|
42
43
|
------
|
43
44
|
RuntimeError
|
44
|
-
If there is a problem
|
45
|
+
If there is a problem cloning the xfm dataset or
|
46
|
+
if there is a problem fetching the xfm file.
|
45
47
|
|
46
48
|
"""
|
49
|
+
# Set default path for storage
|
47
50
|
if xfms_dir is None:
|
48
51
|
xfms_dir = Path().home() / "junifer" / "data" / "xfms"
|
49
|
-
|
50
|
-
# Create default junifer data directory if not present
|
51
|
-
xfms_dir.mkdir(exist_ok=True, parents=True)
|
52
|
+
|
52
53
|
# Convert str to Path
|
53
|
-
|
54
|
+
if not isinstance(xfms_dir, Path):
|
54
55
|
xfms_dir = Path(xfms_dir)
|
55
56
|
|
56
|
-
#
|
57
|
-
|
58
|
-
#
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
# Set file name with extension
|
63
|
-
xfm_file = f"{src}_to_{dst}_Composite.h5"
|
64
|
-
# Set local file path
|
65
|
-
xfm_file_path = xfm_file_dir / xfm_file
|
66
|
-
# Check if the file exists
|
67
|
-
if xfm_file_path.exists():
|
68
|
-
logger.info(
|
69
|
-
f"Found existing xfm file for {src} to {dst} at "
|
70
|
-
f"{xfm_file_path.resolve()}"
|
57
|
+
# Check if the template xfms dataset is installed at storage path
|
58
|
+
is_installed = dl.Dataset(xfms_dir).is_installed()
|
59
|
+
# Use existing dataset
|
60
|
+
if is_installed:
|
61
|
+
logger.debug(
|
62
|
+
f"Found existing template xfms dataset at: {xfms_dir.resolve()}"
|
71
63
|
)
|
72
|
-
|
73
|
-
|
74
|
-
#
|
75
|
-
|
76
|
-
"
|
77
|
-
|
78
|
-
)
|
79
|
-
# Create the file before proceeding
|
80
|
-
xfm_file_path.touch()
|
81
|
-
|
82
|
-
logger.info(f"Downloading xfm file for {src} to {dst} from {url}")
|
83
|
-
# Steam response
|
84
|
-
with httpx.stream("GET", url) as resp:
|
64
|
+
# Set dataset
|
65
|
+
dataset = dl.Dataset(xfms_dir)
|
66
|
+
# Clone a fresh copy
|
67
|
+
else:
|
68
|
+
logger.debug(f"Cloning template xfms dataset to: {xfms_dir.resolve()}")
|
69
|
+
# Clone dataset
|
85
70
|
try:
|
86
|
-
|
87
|
-
|
71
|
+
dataset = dl.clone(
|
72
|
+
"https://github.com/juaml/human-template-xfms.git",
|
73
|
+
path=xfms_dir,
|
74
|
+
result_renderer="disabled",
|
75
|
+
)
|
76
|
+
except IncompleteResultsError as e:
|
88
77
|
raise_error(
|
89
|
-
f"
|
90
|
-
f"requesting {exc.request.url!r}",
|
78
|
+
msg=f"Failed to clone dataset: {e.failed}",
|
91
79
|
klass=RuntimeError,
|
92
80
|
)
|
93
81
|
else:
|
94
|
-
|
95
|
-
|
96
|
-
|
82
|
+
logger.debug(
|
83
|
+
f"Successfully cloned template xfms dataset to: "
|
84
|
+
f"{xfms_dir.resolve()}"
|
85
|
+
)
|
97
86
|
|
98
|
-
|
87
|
+
# Set file path to retrieve
|
88
|
+
xfm_file_path = (
|
89
|
+
xfms_dir / "xfms" / f"{src}_to_{dst}" / f"{src}_to_{dst}_Composite.h5"
|
90
|
+
)
|
91
|
+
|
92
|
+
# Retrieve file
|
93
|
+
try:
|
94
|
+
got = dataset.get(xfm_file_path, result_renderer="disabled")
|
95
|
+
except IncompleteResultsError as e:
|
96
|
+
raise_error(
|
97
|
+
msg=f"Failed to get file from dataset: {e.failed}",
|
98
|
+
klass=RuntimeError,
|
99
|
+
)
|
100
|
+
else:
|
101
|
+
file_path = Path(got[0]["path"])
|
102
|
+
# Conditional logging based on file fetch
|
103
|
+
status = got[0]["status"]
|
104
|
+
if status == "ok":
|
105
|
+
logger.info(
|
106
|
+
f"Successfully fetched xfm file for {src} to {dst} at "
|
107
|
+
f"{file_path.resolve()}"
|
108
|
+
)
|
109
|
+
return file_path
|
110
|
+
elif status == "notneeded":
|
111
|
+
logger.info(
|
112
|
+
f"Found existing xfm file for {src} to {dst} at "
|
113
|
+
f"{file_path.resolve()}"
|
114
|
+
)
|
115
|
+
return file_path
|
116
|
+
else:
|
117
|
+
raise_error(
|
118
|
+
f"Failed to fetch xfm file for {src} to {dst} at "
|
119
|
+
f"{file_path.resolve()}"
|
120
|
+
)
|
99
121
|
|
100
122
|
|
101
123
|
def get_template(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.6.
|
3
|
+
Version: 0.0.6.dev119
|
4
4
|
Summary: JUelich NeuroImaging FEature extractoR
|
5
5
|
Author-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
|
6
6
|
Maintainer-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
junifer/__init__.py,sha256=2McgH1yNue6Z1V26-uN_mfMjbTcx4CLhym-DMBl5xA4,266
|
2
2
|
junifer/__init__.pyi,sha256=A6Janz0-4ad7zQiLsIo-jnUkpHJjzGTt_KcVsJJLSDM,454
|
3
|
-
junifer/_version.py,sha256=
|
3
|
+
junifer/_version.py,sha256=Ss_ycuJWyNfXUOB3I8ssC4qO_enDi_q0nprYs06gkOk,428
|
4
4
|
junifer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
junifer/stats.py,sha256=BjQb2lfTGDP9l4UuQYmJFcJJNRfbJDGlNvC06SJaDDE,6237
|
6
6
|
junifer/api/__init__.py,sha256=aAXW_KAEGQ8aAP5Eni2G1R4MWBF7UgjKOgM6akLuJco,252
|
@@ -75,7 +75,7 @@ junifer/data/coordinates.py,sha256=1HH2Kz5nzZKN6-wJRmYotPH76fPaL1yYbCt8AhONogk,1
|
|
75
75
|
junifer/data/masks.py,sha256=omKOJLnUpmI1yVUkckWy9HhzbFZuYbYdOyr49xFvEwU,21640
|
76
76
|
junifer/data/parcellations.py,sha256=mw1xa6yFWAaVktTkkpCt2ZgSUapZbPwloN2UoPdLzdg,65490
|
77
77
|
junifer/data/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
78
|
-
junifer/data/template_spaces.py,sha256=
|
78
|
+
junifer/data/template_spaces.py,sha256=9uZuFztBGNZk3mhUI2h0oQMajjx6Wv31Fx11pGlDI20,6510
|
79
79
|
junifer/data/utils.py,sha256=dIdhCJMJHoXsjTjEMi2b-NXyCiSKsFZQt-5Ca00Obd4,1330
|
80
80
|
junifer/data/VOIs/meta/AutobiographicalMemory_VOIs.txt,sha256=9af38naeL18Tlt_gy_ep6vyTAxOB336JYjbo5FvP8PQ,686
|
81
81
|
junifer/data/VOIs/meta/CogAC_VOIs.txt,sha256=Sr5_E712OLdeQRyUcDNM0wLBvZIyO6gc9Q7KkyJHX1A,398
|
@@ -321,10 +321,10 @@ junifer/utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
321
321
|
junifer/utils/tests/test_fs.py,sha256=WQS7cKlKEZ742CIuiOYYpueeAhY9PqlastfDVpVVtvE,923
|
322
322
|
junifer/utils/tests/test_helpers.py,sha256=k5qqfxK8dFyuewTJyR1Qn6-nFaYNuVr0ysc18bfPjyU,929
|
323
323
|
junifer/utils/tests/test_logging.py,sha256=duO4ou365hxwa_kwihFtKPLaL6LC5XHiyhOijrrngbA,8009
|
324
|
-
junifer-0.0.6.
|
325
|
-
junifer-0.0.6.
|
326
|
-
junifer-0.0.6.
|
327
|
-
junifer-0.0.6.
|
328
|
-
junifer-0.0.6.
|
329
|
-
junifer-0.0.6.
|
330
|
-
junifer-0.0.6.
|
324
|
+
junifer-0.0.6.dev119.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
|
325
|
+
junifer-0.0.6.dev119.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
|
326
|
+
junifer-0.0.6.dev119.dist-info/METADATA,sha256=HHq5pP3yHkhHSdybSMHEMqYtQDTslO9eGj38TA8GK3s,8448
|
327
|
+
junifer-0.0.6.dev119.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
328
|
+
junifer-0.0.6.dev119.dist-info/entry_points.txt,sha256=6O8ru0BP-SP7YMUZiizFNoaZ2HvJpadO2G7nKk4PwjI,48
|
329
|
+
junifer-0.0.6.dev119.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
|
330
|
+
junifer-0.0.6.dev119.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|