Skip to content

Commit b96aca9

Browse files
created wrapper for PvH
1 parent affcd21 commit b96aca9

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
from src.wrappers.OsipiBase import OsipiBase
2+
from src.original.PvH_KB_NKI.DWI_functions_standalone import generate_IVIMmaps_standalone
3+
import numpy as np
4+
5+
class PvH_KB_NKI_IVIMfit(OsipiBase):
6+
"""
7+
Bi-exponential fitting algorithm by Petra van Houdt and Koen Baas, NKI
8+
"""
9+
10+
# I'm thinking that we define default attributes for each submission like this
11+
# And in __init__, we can call the OsipiBase control functions to check whether
12+
# the user inputs fulfil the requirements
13+
14+
# Some basic stuff that identifies the algorithm
15+
id_author = "Petra van Houdt and Koen Baas, NKI"
16+
id_algorithm_type = "Bi-exponential fit"
17+
id_return_parameters = "f, D*, D"
18+
id_units = "seconds per milli metre squared or milliseconds per micro metre squared"
19+
20+
# Algorithm requirements
21+
required_bvalues = 4
22+
required_thresholds = [0,
23+
0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
24+
required_bounds = False
25+
required_bounds_optional = False # Bounds may not be required but are optional
26+
required_initial_guess = False
27+
required_initial_guess_optional =False
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+
30+
def __init__(self, bvalues=None, bminADC=150, bmaxADC=1000,):
31+
"""
32+
Everything this algorithm requires should be implemented here.
33+
Number of segmentation thresholds, bounds, etc.
34+
35+
Our OsipiBase object could contain functions that compare the inputs with
36+
the requirements.
37+
"""
38+
super(PvH_KB_NKI_IVIMfit, self).__init__(bvalues, bminADC,bmaxADC)
39+
self.NKI_algorithm = generate_IVIMmaps_standalone
40+
41+
42+
def ivim_fit(self, signals, bvalues=None):
43+
"""Perform the IVIM fit
44+
45+
Args:
46+
signals (array-like)
47+
bvalues (array-like, optional): b-values for the signals. If None, self.bvalues will be used. Default is None.
48+
49+
Returns:
50+
_type_: _description_
51+
"""
52+
bvalues=np.array(bvalues)
53+
fit_results = self.NKI_algorithm(signals,bvalues)
54+
55+
D = fit_results[0]
56+
f = fit_results[1]
57+
Dstar = fit_results[2]
58+
59+
return f, Dstar, D

0 commit comments

Comments
 (0)