29
29
from nifreeze .data .dmri import (
30
30
DEFAULT_CLIP_PERCENTILE ,
31
31
DTI_MIN_ORIENTATIONS ,
32
+ DWI ,
32
33
)
33
34
from nifreeze .model .base import BaseModel , ExpectationModel
34
35
@@ -51,7 +52,7 @@ class BaseDWIModel(BaseModel):
51
52
"_modelargs" : "Arguments acceptable by the underlying DIPY-like model." ,
52
53
}
53
54
54
- def __init__ (self , dataset , ** kwargs ):
55
+ def __init__ (self , dataset : DWI , ** kwargs ):
55
56
r"""Initialization.
56
57
57
58
Parameters
@@ -117,7 +118,7 @@ def _fit(self, index, n_jobs=None, **kwargs):
117
118
self ._model = None # Preempt further actions on the model
118
119
return n_jobs
119
120
120
- def fit_predict (self , index , ** kwargs ):
121
+ def fit_predict (self , index : int , ** kwargs ):
121
122
"""
122
123
Predict asynchronously chunk-by-chunk the diffusion signal.
123
124
@@ -140,7 +141,7 @@ def fit_predict(self, index, **kwargs):
140
141
if n_models == 1 :
141
142
predicted , _ = _exec_predict (self ._model , ** (kwargs | {"gtab" : gradient , "S0" : S0 }))
142
143
else :
143
- S0 = np .array_split (S0 , n_models ) if S0 is not None else [ None ] * n_models
144
+ S0 = np .array_split (S0 , n_models ) if S0 is not None else np . full ( n_models , None )
144
145
145
146
predicted = [None ] * n_models
146
147
@@ -173,7 +174,15 @@ class AverageDWIModel(ExpectationModel):
173
174
174
175
__slots__ = ("_th_low" , "_th_high" , "_detrend" )
175
176
176
- def __init__ (self , dataset , stat = "median" , th_low = 100 , th_high = 100 , detrend = False , ** kwargs ):
177
+ def __init__ (
178
+ self ,
179
+ dataset : DWI ,
180
+ stat : str = "median" ,
181
+ th_low : float = 100.0 ,
182
+ th_high : float = 100.0 ,
183
+ detrend : bool = False ,
184
+ ** kwargs ,
185
+ ):
177
186
r"""
178
187
Implement object initialization.
179
188
@@ -183,10 +192,10 @@ def __init__(self, dataset, stat="median", th_low=100, th_high=100, detrend=Fals
183
192
Reference to a DWI object.
184
193
stat : :obj:`str`, optional
185
194
Whether the summary statistic to apply is ``"mean"`` or ``"median"``.
186
- th_low : :obj:`numbers.Number `, optional
195
+ th_low : :obj:`float `, optional
187
196
A lower bound for the b-value corresponding to the diffusion weighted images
188
197
that will be averaged.
189
- th_high : :obj:`numbers.Number `, optional
198
+ th_high : :obj:`float `, optional
190
199
An upper bound for the b-value corresponding to the diffusion weighted images
191
200
that will be averaged.
192
201
detrend : :obj:`bool`, optional
0 commit comments