Skip to content

Commit a3f8a8f

Browse files
committed
Merge branch 'standardized_PV_MUMC_triexp' of github.com:OSIPI/TF2.4_IVIM-MRI_CodeCollection into standardized_PV_MUMC_triexp
2 parents 267c303 + ef50339 commit a3f8a8f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import numpy as np
2+
from src.wrappers.OsipiBase import OsipiBase
3+
from src.original.PV_MUMC.triexp_fitting_algorithms import fit_least_squares_tri_exp, fit_NNLS
4+
5+
6+
class PV_MUMC_triexp(OsipiBase):
7+
"""
8+
Tri-exponential least squares 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 = "Tri-exponential fit"
14+
id_return_parameters = "Dpar, Fint, Dint, Fmv, Dmv"
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=None, 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_triexp, self).__init__(bvalues, None, bounds, None)
35+
self.PV_algorithm = fit_least_squares_tri_exp
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+
Dpar, Fint, Dint, Fmv, Dmv = fit_results
52+
53+
return Dpar, Fint, Dint, Fmv, Dmv

0 commit comments

Comments
 (0)