Skip to content

Commit 69f4c4d

Browse files
committed
STY: Re-use the lower-bound b and S0 thresholds from dMRI data module
Re-use the lower-bound b and S0 thresholds from dMRI data module in the dMRI model for the sake of consistency. The data module minimum S0 value is 1e-5 as opposed to the 1e-6 value that was being used in the model module.
1 parent bb3d129 commit 69f4c4d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/nifreeze/model/dmri.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
from dipy.core.gradients import gradient_table_from_bvals_bvecs
2929
from joblib import Parallel, delayed
3030

31-
from nifreeze.data.dmri import DTI_MIN_ORIENTATIONS, DWI
31+
from nifreeze.data.dmri import DEFAULT_LOWB_THRESHOLD, DEFAULT_MIN_S0, DTI_MIN_ORIENTATIONS, DWI
3232
from nifreeze.data.filtering import BVAL_ATOL, dwi_select_shells, grand_mean_normalization
3333
from nifreeze.model.base import BaseModel, ExpectationModel
3434

35-
S0_EPSILON = 1e-6
36-
B_MIN = 50
37-
3835

3936
def _exec_fit(model, data, chunk=None, **kwargs):
4037
return model.fit(data, **kwargs), chunk
@@ -79,7 +76,7 @@ def __init__(self, dataset: DWI, max_b: float | int | None = None, **kwargs):
7976
f"DWI dataset is too small ({dataset.gradients.shape[0]} directions)."
8077
)
8178

82-
if max_b is not None and max_b > B_MIN:
79+
if max_b is not None and max_b > DEFAULT_LOWB_THRESHOLD:
8380
self._max_b = max_b
8481

8582
self._data_mask = (
@@ -96,7 +93,7 @@ def __init__(self, dataset: DWI, max_b: float | int | None = None, **kwargs):
9693

9794
# If b=0 is present and not to be ignored, update brain mask and set
9895
if not kwargs.pop("ignore_bzero", False) and dataset.bzero is not None:
99-
self._data_mask[dataset.bzero < S0_EPSILON] = False
96+
self._data_mask[dataset.bzero < DEFAULT_MIN_S0] = False
10097
self._S0 = dataset.bzero[self._data_mask]
10198

10299
super().__init__(dataset, **kwargs)

0 commit comments

Comments
 (0)