1
+ import numpy as np
2
+ from src .wrappers .OsipiBase import OsipiBase
3
+ from src .original .PV_MUMC .ivim_fit_method_biexp import fit_least_squares_array
4
+
5
+
6
+ class PV_MUMC_biexp (OsipiBase ):
7
+ """
8
+ Bi-exponential fitting algorithm by Paulien Voorter, Maastricht University
9
+ """
10
+
11
+ # Some basic stuff that identifies the algorithm
12
+ id_author = "Paulien Voorter MUMC"
13
+ id_algorithm_type = "Bi-exponential fit"
14
+ id_return_parameters = "f, D*, D"
15
+ id_units = "seconds per milli metre squared or milliseconds per micro metre squared"
16
+
17
+ # Algorithm requirements
18
+ required_bvalues = 4
19
+ required_thresholds = [0 ,0 ] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
20
+ required_bounds = False
21
+ required_bounds_optional = True # Bounds may not be required but are optional
22
+ required_initial_guess = False
23
+ required_initial_guess_optional = True
24
+ accepted_dimensions = 1 # Not sure how to define this for the number of accepted dimensions. Perhaps like the thresholds, at least and at most?
25
+
26
+ def __init__ (self , bvalues = None , thresholds = None , bounds = ([0.9 , 0.0001 , 0.0 , 0.0025 ], [1.1 , 0.0025 , 0.2 , 0.2 ]), initial_guess = None , weighting = None , stats = False ):
27
+ """
28
+ Everything this algorithm requires should be implemented here.
29
+ Number of segmentation thresholds, bounds, etc.
30
+
31
+ Our OsipiBase object could contain functions that compare the inputs with
32
+ the requirements.
33
+ """
34
+ super (PV_MUMC , self ).__init__ (bvalues , None , bounds , None )
35
+ self .PV_algorithm = fit_least_squares_array
36
+
37
+
38
+ def ivim_fit (self , signals , bvalues = None ):
39
+ """Perform the IVIM fit
40
+
41
+ Args:
42
+ signals (array-like)
43
+ bvalues (array-like, optional): b-values for the signals. If None, self.bvalues will be used. Default is None.
44
+
45
+ Returns:
46
+ _type_: _description_
47
+ """
48
+
49
+
50
+ fit_results = self .PV_algorithm (bvalues , signals )
51
+
52
+ f = fit_results [1 ]
53
+ Dstar = fit_results [2 ]
54
+ D = fit_results [0 ]
55
+
56
+ return f , Dstar , D
0 commit comments