@@ -43,28 +43,31 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
4343 the requirements.
4444 """
4545 super (IAR_LU_segmented_2step , self ).__init__ (bvalues , thresholds , bounds , initial_guess )
46- if bounds is not None :
47- print ('warning, bounds from wrapper are not (yet) used in this algorithm' )
4846 if bounds is None :
49- self .use_bounds = False
47+ self .use_bounds = {"f" : False , "Dp" : False , "D" : False , "S0" : False }
48+ else :
49+ self .use_bounds = {"f" : True , "Dp" : True , "D" : True , "S0" : True }
50+
5051 if initial_guess is None :
51- self .use_initial_guess = False
52+ self .use_initial_guess = {"f" : False , "Dp" : False , "D" : False , "S0" : False }
53+ else :
54+ self .use_initial_guess = {"f" : True , "Dp" : True , "D" : True , "S0" : True }
55+
5256 # Check the inputs
5357
54- # Adapt the bounds to the format needed for the algorithm
55- self .bounds = [[self .bounds ["S0" ][0 ], self .bounds ["f" ][0 ], self .bounds ["Dp" ][0 ], self .bounds ["D" ][0 ]], \
56- [self .bounds ["S0" ][1 ], self .bounds ["f" ][1 ], self .bounds ["Dp" ][1 ], self .bounds ["D" ][1 ]]]
57-
58- # Adapt the initial guess to the format needed for the algorithm
59- self .initial_guess = [self .initial_guess ["S0" ], self .initial_guess ["f" ], self .initial_guess ["Dp" ], self .initial_guess ["D" ]]
6058
6159 # Initialize the algorithm
6260 if self .bvalues is not None :
6361 bvec = np .zeros ((self .bvalues .size , 3 ))
6462 bvec [:,2 ] = 1
6563 gtab = gradient_table (self .bvalues , bvec , b0_threshold = 0 )
64+ bounds = [[self .bounds ["S0" ][0 ], self .bounds ["f" ][0 ], self .bounds ["Dp" ][0 ], self .bounds ["D" ][0 ]], \
65+ [self .bounds ["S0" ][1 ], self .bounds ["f" ][1 ], self .bounds ["Dp" ][1 ], self .bounds ["D" ][1 ]]]
66+
67+ # Adapt the initial guess to the format needed for the algorithm
68+ initial_guess = [self .initial_guess ["S0" ], self .initial_guess ["f" ], self .initial_guess ["Dp" ], self .initial_guess ["D" ]]
6669
67- self .IAR_algorithm = IvimModelSegmented2Step (gtab , bounds = self . bounds , initial_guess = self . initial_guess , b_threshold = self .thresholds )
70+ self .IAR_algorithm = IvimModelSegmented2Step (gtab , bounds = bounds , initial_guess = initial_guess , b_threshold = self .thresholds )
6871 else :
6972 self .IAR_algorithm = None
7073
@@ -79,7 +82,12 @@ def ivim_fit(self, signals, bvalues, thresholds=None, **kwargs):
7982 Returns:
8083 _type_: _description_
8184 """
82- print (thresholds )
85+ # Adapt the bounds to the format needed for the algorithm
86+ bounds = [[self .bounds ["S0" ][0 ], self .bounds ["f" ][0 ], self .bounds ["Dp" ][0 ], self .bounds ["D" ][0 ]], \
87+ [self .bounds ["S0" ][1 ], self .bounds ["f" ][1 ], self .bounds ["Dp" ][1 ], self .bounds ["D" ][1 ]]]
88+
89+ # Adapt the initial guess to the format needed for the algorithm
90+ initial_guess = [self .initial_guess ["S0" ], self .initial_guess ["f" ], self .initial_guess ["Dp" ], self .initial_guess ["D" ]]
8391
8492 if self .IAR_algorithm is None :
8593 if bvalues is None :
@@ -94,7 +102,7 @@ def ivim_fit(self, signals, bvalues, thresholds=None, **kwargs):
94102 if self .thresholds is None :
95103 self .thresholds = 200
96104
97- self .IAR_algorithm = IvimModelSegmented2Step (gtab , bounds = self . bounds , initial_guess = self . initial_guess , b_threshold = self .thresholds )
105+ self .IAR_algorithm = IvimModelSegmented2Step (gtab , bounds = bounds , initial_guess = initial_guess , b_threshold = self .thresholds )
98106
99107 fit_results = self .IAR_algorithm .fit (signals )
100108
0 commit comments