@@ -28,7 +28,7 @@ class OGC_AmsterdamUMC_Bayesian_biexp(OsipiBase):
28
28
accepted_dimensions = 1 # Not sure how to define this for the number of accepted dimensions. Perhaps like the thresholds, at least and at most?
29
29
accepts_priors = True
30
30
31
- def __init__ (self , bvalues = None , bounds = ([0 , 0 , 0.005 , 0.7 ],[0.005 , 0.7 , 0.2 , 1.3 ]), initial_guess = None , fitS0 = True , thresholds = None , prior_in = None ):
31
+ def __init__ (self , bvalues = None , thresholds = None , bounds = ([0 , 0 , 0.005 , 0.7 ],[0.005 , 0.7 , 0.2 , 1.3 ]), initial_guess = None , fitS0 = True , prior_in = None ):
32
32
"""
33
33
Everything this algorithm requires should be implemented here.
34
34
Number of segmentation thresholds, bounds, etc.
@@ -39,11 +39,11 @@ def __init__(self, bvalues=None, bounds=([0, 0, 0.005, 0.7],[0.005, 0.7, 0.2, 1.
39
39
Args:
40
40
datain is a 2D array with values of D, f, D* (and S0) that will form the prior.
41
41
"""
42
- super (OGC_AmsterdamUMC_Bayesian_biexp , self ).__init__ (bvalues , thresholds , bounds , initial_guess ) #, fitS0, prior_in)
42
+ super (OGC_AmsterdamUMC_Bayesian_biexp , self ).__init__ (bvalues , bounds , initial_guess ) #, fitS0, prior_in)
43
43
self .OGC_algorithm = fit_bayesian
44
- self .initialize (bounds , initial_guess , fitS0 , thresholds , prior_in )
44
+ self .initialize (bounds , initial_guess , fitS0 , prior_in )
45
45
46
- def initialize (self , bounds = ([0 , 0 , 0.005 , 0.7 ],[0.005 , 0.7 , 0.2 , 1.3 ]), initial_guess = None , fitS0 = True , thresholds = None , prior_in = None ):
46
+ def initialize (self , bounds = ([0 , 0 , 0.005 , 0.7 ],[0.005 , 0.7 , 0.2 , 1.3 ]), initial_guess = None , fitS0 = True , prior_in = None ):
47
47
if bounds is None :
48
48
self .bounds = ([0 , 0 , 0.005 , 0.7 ],[0.005 , 1 , 0.2 , 1.3 ])
49
49
else :
@@ -61,7 +61,7 @@ def initialize(self, bounds=([0, 0, 0.005, 0.7],[0.005, 0.7, 0.2, 1.3]), initial
61
61
self .initial_guess = initial_guess
62
62
self .fitS0 = fitS0
63
63
64
- def ivim_fit (self , signals , bvalues , bounds = None , initial_guess = None , fitS0 = True , thresholds = None , prior_in = None , ** kwargs ):
64
+ def ivim_fit (self , signals , bvalues , initial_guess = None , ** kwargs ):
65
65
"""Perform the IVIM fit
66
66
67
67
Args:
@@ -71,9 +71,10 @@ def ivim_fit(self, signals, bvalues, bounds=None, initial_guess=None, fitS0=True
71
71
Returns:
72
72
_type_: _description_
73
73
"""
74
- self .initialize (bounds , initial_guess , fitS0 , thresholds , prior_in )
74
+ if initial_guess is not None and len (initial_guess ) == 4 :
75
+ self .initial_guess = initial_guess
75
76
bvalues = np .array (bvalues )
76
- fit_results = fit_segmented (bvalues , signals ,bounds = self .bounds ,cutoff = 150 ,p0 = self .initial_guess )
77
+ fit_results = fit_segmented (bvalues , signals , bounds = self .bounds , cutoff = 150 , p0 = self .initial_guess )
77
78
fit_results = fit_results + (1 ,)
78
79
fit_results = self .OGC_algorithm (bvalues , signals , self .neg_log_prior , x0 = fit_results , fitS0 = self .fitS0 )
79
80
0 commit comments