junifer 0.0.5.dev11__py3-none-any.whl → 0.0.5.dev27__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/markers/parcel_aggregation.py +3 -1
- junifer/preprocess/__init__.py +1 -0
- junifer/preprocess/smoothing/__init__.py +6 -0
- junifer/preprocess/smoothing/_afni_smoothing.py +119 -0
- junifer/preprocess/smoothing/_fsl_smoothing.py +116 -0
- junifer/preprocess/smoothing/_nilearn_smoothing.py +69 -0
- junifer/preprocess/smoothing/smoothing.py +174 -0
- junifer/preprocess/smoothing/tests/test_smoothing.py +94 -0
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.dist-info}/METADATA +1 -1
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.dist-info}/RECORD +16 -10
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.dist-info}/WHEEL +0 -0
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.5.dev11.dist-info → junifer-0.0.5.dev27.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.5.
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 5, '
|
15
|
+
__version__ = version = '0.0.5.dev27'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 5, 'dev27')
|
@@ -195,7 +195,9 @@ class ParcelAggregation(BaseMarker):
|
|
195
195
|
)
|
196
196
|
|
197
197
|
# Get binarized parcellation image for masking
|
198
|
-
parcellation_bin = math_img(
|
198
|
+
parcellation_bin = math_img(
|
199
|
+
"np.squeeze(img) != 0", img=parcellation_img
|
200
|
+
)
|
199
201
|
|
200
202
|
# Load mask
|
201
203
|
if self.masks is not None:
|
junifer/preprocess/__init__.py
CHANGED
@@ -0,0 +1,119 @@
|
|
1
|
+
"""Provide class for smoothing via AFNI."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
from typing import (
|
7
|
+
TYPE_CHECKING,
|
8
|
+
ClassVar,
|
9
|
+
Dict,
|
10
|
+
List,
|
11
|
+
Set,
|
12
|
+
Union,
|
13
|
+
)
|
14
|
+
|
15
|
+
import nibabel as nib
|
16
|
+
|
17
|
+
from ...pipeline import WorkDirManager
|
18
|
+
from ...utils import logger, run_ext_cmd
|
19
|
+
|
20
|
+
|
21
|
+
if TYPE_CHECKING:
|
22
|
+
from nibabel import Nifti1Image
|
23
|
+
|
24
|
+
|
25
|
+
__all__ = ["AFNISmoothing"]
|
26
|
+
|
27
|
+
|
28
|
+
class AFNISmoothing:
|
29
|
+
"""Class for smoothing via AFNI.
|
30
|
+
|
31
|
+
This class uses AFNI's 3dBlurToFWHM.
|
32
|
+
|
33
|
+
"""
|
34
|
+
|
35
|
+
_EXT_DEPENDENCIES: ClassVar[List[Dict[str, Union[str, List[str]]]]] = [
|
36
|
+
{
|
37
|
+
"name": "afni",
|
38
|
+
"commands": ["3dBlurToFWHM"],
|
39
|
+
},
|
40
|
+
]
|
41
|
+
|
42
|
+
_DEPENDENCIES: ClassVar[Set[str]] = {"nibabel"}
|
43
|
+
|
44
|
+
def preprocess(
|
45
|
+
self,
|
46
|
+
data: "Nifti1Image",
|
47
|
+
fwhm: Union[int, float],
|
48
|
+
) -> "Nifti1Image":
|
49
|
+
"""Preprocess using AFNI.
|
50
|
+
|
51
|
+
Parameters
|
52
|
+
----------
|
53
|
+
data : Niimg-like object
|
54
|
+
Image(s) to preprocess.
|
55
|
+
fwhm : int or float
|
56
|
+
Smooth until the value. AFNI estimates the smoothing and then
|
57
|
+
applies smoothing to reach ``fwhm``.
|
58
|
+
|
59
|
+
Returns
|
60
|
+
-------
|
61
|
+
Niimg-like object
|
62
|
+
The preprocessed image(s).
|
63
|
+
|
64
|
+
Notes
|
65
|
+
-----
|
66
|
+
For more information on ``3dBlurToFWHM``, check:
|
67
|
+
https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dBlurToFWHM.html
|
68
|
+
|
69
|
+
As the process also depends on the conversion of AFNI files to NIfTI
|
70
|
+
via AFNI's ``3dAFNItoNIFTI``, the help for that can be found at:
|
71
|
+
https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dAFNItoNIFTI.html
|
72
|
+
|
73
|
+
"""
|
74
|
+
logger.info("Smoothing using AFNI")
|
75
|
+
|
76
|
+
# Create component-scoped tempdir
|
77
|
+
tempdir = WorkDirManager().get_tempdir(prefix="afni_smoothing")
|
78
|
+
|
79
|
+
# Save target data to a component-scoped tempfile
|
80
|
+
nifti_in_file_path = tempdir / "input.nii" # needs to be .nii
|
81
|
+
nib.save(data, nifti_in_file_path)
|
82
|
+
|
83
|
+
# Set 3dBlurToFWHM command
|
84
|
+
blur_out_path_prefix = tempdir / "blur"
|
85
|
+
blur_cmd = [
|
86
|
+
"3dBlurToFWHM",
|
87
|
+
f"-input {nifti_in_file_path.resolve()}",
|
88
|
+
f"-prefix {blur_out_path_prefix.resolve()}",
|
89
|
+
"-automask",
|
90
|
+
f"-FWHM {fwhm}",
|
91
|
+
]
|
92
|
+
# Call 3dBlurToFWHM
|
93
|
+
run_ext_cmd(name="3dBlurToFWHM", cmd=blur_cmd)
|
94
|
+
|
95
|
+
# Create element-scoped tempdir so that the blurred output is
|
96
|
+
# available later as nibabel stores file path reference for
|
97
|
+
# loading on computation
|
98
|
+
element_tempdir = WorkDirManager().get_element_tempdir(
|
99
|
+
prefix="afni_blur"
|
100
|
+
)
|
101
|
+
# Convert afni to nifti
|
102
|
+
blur_afni_to_nifti_out_path = (
|
103
|
+
element_tempdir / "output.nii" # needs to be .nii
|
104
|
+
)
|
105
|
+
convert_cmd = [
|
106
|
+
"3dAFNItoNIFTI",
|
107
|
+
f"-prefix {blur_afni_to_nifti_out_path.resolve()}",
|
108
|
+
f"{blur_out_path_prefix}+tlrc.BRIK",
|
109
|
+
]
|
110
|
+
# Call 3dAFNItoNIFTI
|
111
|
+
run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_cmd)
|
112
|
+
|
113
|
+
# Load nifti
|
114
|
+
output_data = nib.load(blur_afni_to_nifti_out_path)
|
115
|
+
|
116
|
+
# Delete tempdir
|
117
|
+
WorkDirManager().delete_tempdir(tempdir)
|
118
|
+
|
119
|
+
return output_data # type: ignore
|
@@ -0,0 +1,116 @@
|
|
1
|
+
"""Provide class for smoothing via FSL."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
from typing import (
|
7
|
+
TYPE_CHECKING,
|
8
|
+
ClassVar,
|
9
|
+
Dict,
|
10
|
+
List,
|
11
|
+
Set,
|
12
|
+
Union,
|
13
|
+
)
|
14
|
+
|
15
|
+
import nibabel as nib
|
16
|
+
|
17
|
+
from ...pipeline import WorkDirManager
|
18
|
+
from ...utils import logger, run_ext_cmd
|
19
|
+
|
20
|
+
|
21
|
+
if TYPE_CHECKING:
|
22
|
+
from nibabel import Nifti1Image
|
23
|
+
|
24
|
+
|
25
|
+
__all__ = ["FSLSmoothing"]
|
26
|
+
|
27
|
+
|
28
|
+
class FSLSmoothing:
|
29
|
+
"""Class for smoothing via FSL.
|
30
|
+
|
31
|
+
This class uses FSL's susan.
|
32
|
+
|
33
|
+
"""
|
34
|
+
|
35
|
+
_EXT_DEPENDENCIES: ClassVar[List[Dict[str, Union[str, List[str]]]]] = [
|
36
|
+
{
|
37
|
+
"name": "fsl",
|
38
|
+
"commands": ["susan"],
|
39
|
+
},
|
40
|
+
]
|
41
|
+
|
42
|
+
_DEPENDENCIES: ClassVar[Set[str]] = {"nibabel"}
|
43
|
+
|
44
|
+
def preprocess(
|
45
|
+
self,
|
46
|
+
data: "Nifti1Image",
|
47
|
+
brightness_threshold: float,
|
48
|
+
fwhm: float,
|
49
|
+
) -> "Nifti1Image":
|
50
|
+
"""Preprocess using FSL.
|
51
|
+
|
52
|
+
Parameters
|
53
|
+
----------
|
54
|
+
data : Niimg-like object
|
55
|
+
Image(s) to preprocess.
|
56
|
+
brightness_threshold : float
|
57
|
+
Threshold to discriminate between noise and the underlying image.
|
58
|
+
The value should be set greater than the noise level and less than
|
59
|
+
the contrast of the underlying image.
|
60
|
+
fwhm : float
|
61
|
+
Spatial extent of smoothing.
|
62
|
+
|
63
|
+
Returns
|
64
|
+
-------
|
65
|
+
Niimg-like object
|
66
|
+
The preprocessed image(s).
|
67
|
+
|
68
|
+
Notes
|
69
|
+
-----
|
70
|
+
For more information on ``SUSAN``, check [1]_
|
71
|
+
|
72
|
+
References
|
73
|
+
----------
|
74
|
+
.. [1] Smith, S.M. and Brady, J.M. (1997).
|
75
|
+
SUSAN - a new approach to low level image processing.
|
76
|
+
International Journal of Computer Vision, Volume 23(1),
|
77
|
+
Pages 45-78.
|
78
|
+
|
79
|
+
"""
|
80
|
+
logger.info("Smoothing using FSL")
|
81
|
+
|
82
|
+
# Create component-scoped tempdir
|
83
|
+
tempdir = WorkDirManager().get_tempdir(prefix="fsl_smoothing")
|
84
|
+
|
85
|
+
# Save target data to a component-scoped tempfile
|
86
|
+
nifti_in_file_path = tempdir / "input.nii.gz"
|
87
|
+
nib.save(data, nifti_in_file_path)
|
88
|
+
|
89
|
+
# Create element-scoped tempdir so that the output is
|
90
|
+
# available later as nibabel stores file path reference for
|
91
|
+
# loading on computation
|
92
|
+
element_tempdir = WorkDirManager().get_element_tempdir(
|
93
|
+
prefix="fsl_susan"
|
94
|
+
)
|
95
|
+
susan_out_path = element_tempdir / "output.nii.gz"
|
96
|
+
# Set susan command
|
97
|
+
susan_cmd = [
|
98
|
+
"susan",
|
99
|
+
f"{nifti_in_file_path.resolve()}",
|
100
|
+
f"{brightness_threshold}",
|
101
|
+
f"{fwhm}",
|
102
|
+
"3", # dimension
|
103
|
+
"1", # use median when no neighbourhood is found
|
104
|
+
"0", # use input image to find USAN
|
105
|
+
f"{susan_out_path.resolve()}",
|
106
|
+
]
|
107
|
+
# Call susan
|
108
|
+
run_ext_cmd(name="susan", cmd=susan_cmd)
|
109
|
+
|
110
|
+
# Load nifti
|
111
|
+
output_data = nib.load(susan_out_path)
|
112
|
+
|
113
|
+
# Delete tempdir
|
114
|
+
WorkDirManager().delete_tempdir(tempdir)
|
115
|
+
|
116
|
+
return output_data # type: ignore
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"""Provide class for smoothing via nilearn."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
from typing import (
|
7
|
+
TYPE_CHECKING,
|
8
|
+
ClassVar,
|
9
|
+
Literal,
|
10
|
+
Set,
|
11
|
+
Union,
|
12
|
+
)
|
13
|
+
|
14
|
+
from nilearn import image as nimg
|
15
|
+
from numpy.typing import ArrayLike
|
16
|
+
|
17
|
+
from ...utils import logger
|
18
|
+
|
19
|
+
|
20
|
+
if TYPE_CHECKING:
|
21
|
+
from nibabel import Nifti1Image
|
22
|
+
|
23
|
+
|
24
|
+
__all__ = ["NilearnSmoothing"]
|
25
|
+
|
26
|
+
|
27
|
+
class NilearnSmoothing:
|
28
|
+
"""Class for smoothing via nilearn.
|
29
|
+
|
30
|
+
This class uses :func:`nilearn.image.smooth_img` to smooth image(s).
|
31
|
+
|
32
|
+
"""
|
33
|
+
|
34
|
+
_DEPENDENCIES: ClassVar[Set[str]] = {"nilearn"}
|
35
|
+
|
36
|
+
def preprocess(
|
37
|
+
self,
|
38
|
+
data: "Nifti1Image",
|
39
|
+
fwhm: Union[int, float, ArrayLike, Literal["fast"], None],
|
40
|
+
) -> "Nifti1Image":
|
41
|
+
"""Preprocess using nilearn.
|
42
|
+
|
43
|
+
Parameters
|
44
|
+
----------
|
45
|
+
data : Niimg-like object
|
46
|
+
Image(s) to preprocess.
|
47
|
+
fwhm : scalar, ``numpy.ndarray``, tuple or list of scalar, "fast" or \
|
48
|
+
None
|
49
|
+
Smoothing strength, as a full-width at half maximum, in
|
50
|
+
millimeters:
|
51
|
+
|
52
|
+
* If nonzero scalar, width is identical in all 3 directions.
|
53
|
+
* If ``numpy.ndarray``, tuple, or list, it must have 3 elements,
|
54
|
+
giving the FWHM along each axis. If any of the elements is 0 or
|
55
|
+
None, smoothing is not performed along that axis.
|
56
|
+
* If ``"fast"``, a fast smoothing will be performed with a filter
|
57
|
+
``[0.2, 1, 0.2]`` in each direction and a normalisation to
|
58
|
+
preserve the local average value.
|
59
|
+
* If None, no filtering is performed (useful when just removal of
|
60
|
+
non-finite values is needed).
|
61
|
+
|
62
|
+
Returns
|
63
|
+
-------
|
64
|
+
Niimg-like object
|
65
|
+
The preprocessed image(s).
|
66
|
+
|
67
|
+
"""
|
68
|
+
logger.info("Smoothing using nilearn")
|
69
|
+
return nimg.smooth_img(imgs=data, fwhm=fwhm) # type: ignore
|
@@ -0,0 +1,174 @@
|
|
1
|
+
"""Provide class for smoothing."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
from typing import Any, ClassVar, Dict, List, Optional, Tuple, Type, Union
|
7
|
+
|
8
|
+
from ...api.decorators import register_preprocessor
|
9
|
+
from ...utils import logger, raise_error
|
10
|
+
from ..base import BasePreprocessor
|
11
|
+
from ._afni_smoothing import AFNISmoothing
|
12
|
+
from ._fsl_smoothing import FSLSmoothing
|
13
|
+
from ._nilearn_smoothing import NilearnSmoothing
|
14
|
+
|
15
|
+
|
16
|
+
__all__ = ["Smoothing"]
|
17
|
+
|
18
|
+
|
19
|
+
@register_preprocessor
|
20
|
+
class Smoothing(BasePreprocessor):
|
21
|
+
"""Class for smoothing.
|
22
|
+
|
23
|
+
Parameters
|
24
|
+
----------
|
25
|
+
using : {"nilearn", "afni", "fsl"}
|
26
|
+
Implementation to use for smoothing:
|
27
|
+
|
28
|
+
* "nilearn" : Use :func:`nilearn.image.smooth_img`
|
29
|
+
* "afni" : Use AFNI's ``3dBlurToFWHM``
|
30
|
+
* "fsl" : Use FSL SUSAN's ``susan``
|
31
|
+
|
32
|
+
on : {"T1w", "T2w", "BOLD"} or list of the options
|
33
|
+
The data type to apply smoothing to.
|
34
|
+
smoothing_params : dict, optional
|
35
|
+
Extra parameters for smoothing as a dictionary (default None).
|
36
|
+
If ``using="nilearn"``, then the valid keys are:
|
37
|
+
|
38
|
+
* ``fmhw`` : scalar, ``numpy.ndarray``, tuple or list of scalar, \
|
39
|
+
"fast" or None
|
40
|
+
Smoothing strength, as a full-width at half maximum, in
|
41
|
+
millimeters:
|
42
|
+
|
43
|
+
- If nonzero scalar, width is identical in all 3 directions.
|
44
|
+
- If ``numpy.ndarray``, tuple, or list, it must have 3 elements,
|
45
|
+
giving the FWHM along each axis. If any of the elements is 0 or
|
46
|
+
None, smoothing is not performed along that axis.
|
47
|
+
- If ``"fast"``, a fast smoothing will be performed with a filter
|
48
|
+
``[0.2, 1, 0.2]`` in each direction and a normalisation to
|
49
|
+
preserve the local average value.
|
50
|
+
- If None, no filtering is performed (useful when just removal of
|
51
|
+
non-finite values is needed).
|
52
|
+
|
53
|
+
else if ``using="afni"``, then the valid keys are:
|
54
|
+
|
55
|
+
* ``fwhm`` : int or float
|
56
|
+
Smooth until the value. AFNI estimates the smoothing and then
|
57
|
+
applies smoothing to reach ``fwhm``.
|
58
|
+
|
59
|
+
else if ``using="fsl"``, then the valid keys are:
|
60
|
+
|
61
|
+
* ``brightness_threshold`` : float
|
62
|
+
Threshold to discriminate between noise and the underlying image.
|
63
|
+
The value should be set greater than the noise level and less than
|
64
|
+
the contrast of the underlying image.
|
65
|
+
* ``fwhm`` : float
|
66
|
+
Spatial extent of smoothing.
|
67
|
+
|
68
|
+
"""
|
69
|
+
|
70
|
+
_CONDITIONAL_DEPENDENCIES: ClassVar[List[Dict[str, Union[str, Type]]]] = [
|
71
|
+
{
|
72
|
+
"using": "nilearn",
|
73
|
+
"depends_on": NilearnSmoothing,
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"using": "afni",
|
77
|
+
"depends_on": AFNISmoothing,
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"using": "fsl",
|
81
|
+
"depends_on": FSLSmoothing,
|
82
|
+
},
|
83
|
+
]
|
84
|
+
|
85
|
+
def __init__(
|
86
|
+
self,
|
87
|
+
using: str,
|
88
|
+
on: Union[List[str], str],
|
89
|
+
smoothing_params: Optional[Dict] = None,
|
90
|
+
) -> None:
|
91
|
+
"""Initialize the class."""
|
92
|
+
# Validate `using` parameter
|
93
|
+
valid_using = [dep["using"] for dep in self._CONDITIONAL_DEPENDENCIES]
|
94
|
+
if using not in valid_using:
|
95
|
+
raise_error(
|
96
|
+
f"Invalid value for `using`, should be one of: {valid_using}"
|
97
|
+
)
|
98
|
+
self.using = using
|
99
|
+
self.smoothing_params = (
|
100
|
+
smoothing_params if smoothing_params is not None else {}
|
101
|
+
)
|
102
|
+
super().__init__(on=on)
|
103
|
+
|
104
|
+
def get_valid_inputs(self) -> List[str]:
|
105
|
+
"""Get valid data types for input.
|
106
|
+
|
107
|
+
Returns
|
108
|
+
-------
|
109
|
+
list of str
|
110
|
+
The list of data types that can be used as input for this
|
111
|
+
preprocessor.
|
112
|
+
|
113
|
+
"""
|
114
|
+
return ["T1w", "T2w", "BOLD"]
|
115
|
+
|
116
|
+
def get_output_type(self, input_type: str) -> str:
|
117
|
+
"""Get output type.
|
118
|
+
|
119
|
+
Parameters
|
120
|
+
----------
|
121
|
+
input_type : str
|
122
|
+
The data type input to the preprocessor.
|
123
|
+
|
124
|
+
Returns
|
125
|
+
-------
|
126
|
+
str
|
127
|
+
The data type output by the preprocessor.
|
128
|
+
|
129
|
+
"""
|
130
|
+
# Does not add any new keys
|
131
|
+
return input_type
|
132
|
+
|
133
|
+
def preprocess(
|
134
|
+
self,
|
135
|
+
input: Dict[str, Any],
|
136
|
+
extra_input: Optional[Dict[str, Any]] = None,
|
137
|
+
) -> Tuple[Dict[str, Any], Optional[Dict[str, Dict[str, Any]]]]:
|
138
|
+
"""Preprocess.
|
139
|
+
|
140
|
+
Parameters
|
141
|
+
----------
|
142
|
+
input : dict
|
143
|
+
The input from the Junifer Data object.
|
144
|
+
extra_input : dict, optional
|
145
|
+
The other fields in the Junifer Data object.
|
146
|
+
|
147
|
+
Returns
|
148
|
+
-------
|
149
|
+
dict
|
150
|
+
The computed result as dictionary.
|
151
|
+
None
|
152
|
+
Extra "helper" data types as dictionary to add to the Junifer Data
|
153
|
+
object.
|
154
|
+
|
155
|
+
"""
|
156
|
+
logger.debug("Smoothing")
|
157
|
+
|
158
|
+
# Conditional preprocessor
|
159
|
+
if self.using == "nilearn":
|
160
|
+
preprocessor = NilearnSmoothing()
|
161
|
+
elif self.using == "afni":
|
162
|
+
preprocessor = AFNISmoothing()
|
163
|
+
elif self.using == "fsl":
|
164
|
+
preprocessor = FSLSmoothing()
|
165
|
+
# Smooth
|
166
|
+
output = preprocessor.preprocess( # type: ignore
|
167
|
+
data=input["data"],
|
168
|
+
**self.smoothing_params,
|
169
|
+
)
|
170
|
+
|
171
|
+
# Modify target data
|
172
|
+
input["data"] = output
|
173
|
+
|
174
|
+
return input, None
|
@@ -0,0 +1,94 @@
|
|
1
|
+
"""Provide tests for Smoothing."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
|
7
|
+
import pytest
|
8
|
+
|
9
|
+
from junifer.datareader import DefaultDataReader
|
10
|
+
from junifer.pipeline.utils import _check_afni, _check_fsl
|
11
|
+
from junifer.preprocess import Smoothing
|
12
|
+
from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
|
13
|
+
|
14
|
+
|
15
|
+
@pytest.mark.parametrize(
|
16
|
+
"data_type",
|
17
|
+
["T1w", "BOLD"],
|
18
|
+
)
|
19
|
+
def test_Smoothing_nilearn(data_type: str) -> None:
|
20
|
+
"""Test Smoothing using nilearn.
|
21
|
+
|
22
|
+
Parameters
|
23
|
+
----------
|
24
|
+
data_type : str
|
25
|
+
The parametrized data type.
|
26
|
+
|
27
|
+
"""
|
28
|
+
with SPMAuditoryTestingDataGrabber() as dg:
|
29
|
+
# Read data
|
30
|
+
element_data = DefaultDataReader().fit_transform(dg["sub001"])
|
31
|
+
# Preprocess data
|
32
|
+
output = Smoothing(
|
33
|
+
using="nilearn",
|
34
|
+
on=data_type,
|
35
|
+
smoothing_params={"fwhm": "fast"},
|
36
|
+
).fit_transform(element_data)
|
37
|
+
|
38
|
+
assert isinstance(output, dict)
|
39
|
+
|
40
|
+
|
41
|
+
@pytest.mark.parametrize(
|
42
|
+
"data_type",
|
43
|
+
["T1w", "BOLD"],
|
44
|
+
)
|
45
|
+
@pytest.mark.skipif(
|
46
|
+
_check_afni() is False, reason="requires AFNI to be in PATH"
|
47
|
+
)
|
48
|
+
def test_Smoothing_afni(data_type: str) -> None:
|
49
|
+
"""Test Smoothing using AFNI.
|
50
|
+
|
51
|
+
Parameters
|
52
|
+
----------
|
53
|
+
data_type : str
|
54
|
+
The parametrized data type.
|
55
|
+
|
56
|
+
"""
|
57
|
+
with SPMAuditoryTestingDataGrabber() as dg:
|
58
|
+
# Read data
|
59
|
+
element_data = DefaultDataReader().fit_transform(dg["sub001"])
|
60
|
+
# Preprocess data
|
61
|
+
output = Smoothing(
|
62
|
+
using="afni",
|
63
|
+
on=data_type,
|
64
|
+
smoothing_params={"fwhm": 3},
|
65
|
+
).fit_transform(element_data)
|
66
|
+
|
67
|
+
assert isinstance(output, dict)
|
68
|
+
|
69
|
+
|
70
|
+
@pytest.mark.parametrize(
|
71
|
+
"data_type",
|
72
|
+
["T1w", "BOLD"],
|
73
|
+
)
|
74
|
+
@pytest.mark.skipif(_check_fsl() is False, reason="requires FSL to be in PATH")
|
75
|
+
def test_Smoothing_fsl(data_type: str) -> None:
|
76
|
+
"""Test Smoothing using FSL.
|
77
|
+
|
78
|
+
Parameters
|
79
|
+
----------
|
80
|
+
data_type : str
|
81
|
+
The parametrized data type.
|
82
|
+
|
83
|
+
"""
|
84
|
+
with SPMAuditoryTestingDataGrabber() as dg:
|
85
|
+
# Read data
|
86
|
+
element_data = DefaultDataReader().fit_transform(dg["sub001"])
|
87
|
+
# Preprocess data
|
88
|
+
output = Smoothing(
|
89
|
+
using="fsl",
|
90
|
+
on=data_type,
|
91
|
+
smoothing_params={"brightness_threshold": 10.0, "fwhm": 3.0},
|
92
|
+
).fit_transform(element_data)
|
93
|
+
|
94
|
+
assert isinstance(output, dict)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.5.
|
3
|
+
Version: 0.0.5.dev27
|
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,5 +1,5 @@
|
|
1
1
|
junifer/__init__.py,sha256=x1UR2jUcrUdm2HNl-3Qvyi4UUrU6ms5qm2qcmNY7zZk,391
|
2
|
-
junifer/_version.py,sha256=
|
2
|
+
junifer/_version.py,sha256=F2Z7xVB6hG84y0R3P4KaCGrxH_Hu1PR-l82F-5zd5fw,426
|
3
3
|
junifer/stats.py,sha256=sU5IZ2qFZWbzgSutQS_z42miIVItpSGmQYBn6KkD5fA,6162
|
4
4
|
junifer/api/__init__.py,sha256=YILu9M7SC0Ri4CVd90fELH2OnK_gvCYAXCoqBNCFE8E,257
|
5
5
|
junifer/api/cli.py,sha256=_fC35jp0YzqNIpO5yvTb_5QBmUpw6sRFgVjBeoRbhO8,13627
|
@@ -126,7 +126,7 @@ junifer/markers/__init__.py,sha256=exUUmpDsPkoNa9FK6Y7pDusOYv56_zoci8hiOaxyswE,7
|
|
126
126
|
junifer/markers/base.py,sha256=Af8TyoNAIHWREZkIgi2su6PUqoloJXVGT-KW13WlWUM,6370
|
127
127
|
junifer/markers/collection.py,sha256=eD6_IJ3y-9lcN4r0ORZqgr2ICjHyTvlAKyh0HKPYqzk,5247
|
128
128
|
junifer/markers/ets_rss.py,sha256=7fr6mmbMM5NKIDV6bUyyu-pwHJH56GwYv6oozK4EX6k,4557
|
129
|
-
junifer/markers/parcel_aggregation.py,sha256=
|
129
|
+
junifer/markers/parcel_aggregation.py,sha256=4dKBx2zgsFSuZlnSsr1tMWO_4kgh-NoId7epoiwTPfg,8702
|
130
130
|
junifer/markers/sphere_aggregation.py,sha256=3gC8-Z0qbX2y_q-YbwpnPll6lmKZY5V-DdQQA7tFzWc,8275
|
131
131
|
junifer/markers/utils.py,sha256=b6Bt_isqsOD2OF7oHvEpHyilauxYZzyz8YcbGWq6J4A,3833
|
132
132
|
junifer/markers/complexity/__init__.py,sha256=nzL6GpVlFhMDaWyJ-ZtpPx940LUSAUmYcyqLoQ7K1-E,818
|
@@ -202,7 +202,7 @@ junifer/pipeline/tests/test_pipeline_step_mixin.py,sha256=_ykZzyNzREXy-r_yv1gY_j
|
|
202
202
|
junifer/pipeline/tests/test_registry.py,sha256=rYN0pO3gSueQ6XsasEM9VU5BkLyaNl8WaCZiaO8Rno0,4105
|
203
203
|
junifer/pipeline/tests/test_update_meta_mixin.py,sha256=UeWwpUi-Q5WVd36Fgfn_utXplSVXMSjLcdO2mR2xLTk,1355
|
204
204
|
junifer/pipeline/tests/test_workdir_manager.py,sha256=E1WY4C-GDsx2c49sePqr1WR_Y3nZ1kiRn4Veu506uTs,2801
|
205
|
-
junifer/preprocess/__init__.py,sha256=
|
205
|
+
junifer/preprocess/__init__.py,sha256=QFDpEl6SnbWUhTXxZExpbIPNVSzxx5ynb2Y5BS0XGko,408
|
206
206
|
junifer/preprocess/base.py,sha256=Bn1VdonQ1f_DDPwFMpdaeyfLfNSnROulr-U8HuGQ81A,6697
|
207
207
|
junifer/preprocess/bold_warper.py,sha256=pEQ1GaWTV2Ili9WyqJgtq0PGHm4hNztXyY9ixoLNZnw,9060
|
208
208
|
junifer/preprocess/ants/__init__.py,sha256=Uobmbhh6_gOowkF2hQNSQOh3AYeaXzarBXEcLJzhERE,112
|
@@ -214,6 +214,12 @@ junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py,sha256=noKP
|
|
214
214
|
junifer/preprocess/fsl/__init__.py,sha256=DerGFQ-dIuX5PT9a_BH6QkIXkJZVymjYy-woXF7tYGc,111
|
215
215
|
junifer/preprocess/fsl/apply_warper.py,sha256=k6ZzoDhXgsqcJZYYdx45Y3rN9xJERc02953_qhTqMtE,5144
|
216
216
|
junifer/preprocess/fsl/tests/test_apply_warper.py,sha256=eCrSPYIGTKFDiBtseZFkghjhU7j7np59TZeGdKHkhMs,1324
|
217
|
+
junifer/preprocess/smoothing/__init__.py,sha256=3l8nay8Zm_BIZLEj4CwmIye5-q7lQ_niGO_Cv4Hd21c,151
|
218
|
+
junifer/preprocess/smoothing/_afni_smoothing.py,sha256=FLJIrlYGxMT8rJdhV3LjALFIC9EPp902OuXt0FqAA_s,3266
|
219
|
+
junifer/preprocess/smoothing/_fsl_smoothing.py,sha256=ZBdP4VsaQEYD9JYUitAXSccwvP3GZ0FyqhriV8gJxyk,3035
|
220
|
+
junifer/preprocess/smoothing/_nilearn_smoothing.py,sha256=bshMj2DKEFkNiUbpaBoBfFFI6O80FIN49Oa3nc6FgaA,1928
|
221
|
+
junifer/preprocess/smoothing/smoothing.py,sha256=Bb9_0wvt1CfwzpxN_svPiQ2euOZkAT9S--4qr8omhyQ,5355
|
222
|
+
junifer/preprocess/smoothing/tests/test_smoothing.py,sha256=t1j3zEvJk5XLO4fzcb-wQyBMH-xuvR1k6WYm8zriwik,2390
|
217
223
|
junifer/preprocess/tests/test_bold_warper.py,sha256=U_r7DwPWoO_it1LIkhuQWBe20a-6X5c8o0AvTOnWKEc,4636
|
218
224
|
junifer/preprocess/tests/test_preprocess_base.py,sha256=-0rpe8QjqYES36H6MHuDs3cv_6upHBdVHnFMgQsmEX4,2571
|
219
225
|
junifer/preprocess/warping/__init__.py,sha256=zW4DVt_RPJWT0-AsylGmh9wgFBDPkU-hx4VzV_qPayU,154
|
@@ -250,10 +256,10 @@ junifer/utils/logging.py,sha256=furcU3XIUpUvnpe4PEwzWWIWgmH4j2ZA4MQdvSGWjj0,9216
|
|
250
256
|
junifer/utils/tests/test_fs.py,sha256=WQS7cKlKEZ742CIuiOYYpueeAhY9PqlastfDVpVVtvE,923
|
251
257
|
junifer/utils/tests/test_helpers.py,sha256=k5qqfxK8dFyuewTJyR1Qn6-nFaYNuVr0ysc18bfPjyU,929
|
252
258
|
junifer/utils/tests/test_logging.py,sha256=l8oo-AiBV7H6_IzlsNcj__cLeZBUvgIGoaMszD9VaJg,7754
|
253
|
-
junifer-0.0.5.
|
254
|
-
junifer-0.0.5.
|
255
|
-
junifer-0.0.5.
|
256
|
-
junifer-0.0.5.
|
257
|
-
junifer-0.0.5.
|
258
|
-
junifer-0.0.5.
|
259
|
-
junifer-0.0.5.
|
259
|
+
junifer-0.0.5.dev27.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
|
260
|
+
junifer-0.0.5.dev27.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
|
261
|
+
junifer-0.0.5.dev27.dist-info/METADATA,sha256=jvrOkuBla5IlTKRbbmZz3d9Pxe8cPSEo60ZO30t3N9E,8234
|
262
|
+
junifer-0.0.5.dev27.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
263
|
+
junifer-0.0.5.dev27.dist-info/entry_points.txt,sha256=DxFvKq0pOqRunAK0FxwJcoDfV1-dZvsFDpD5HRqSDhw,48
|
264
|
+
junifer-0.0.5.dev27.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
|
265
|
+
junifer-0.0.5.dev27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|