Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ nosetests.xml
coverage.xml
*.pyc
phantoms/MR_XCAT_qMRI/*.json
phantoms/MR_XCAT_qMRI/*.txt
phantoms/MR_XCAT_qMRI/*.txt
osipivenv/

9 changes: 9 additions & 0 deletions src/standardized wip/IAR_LU_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
super(IAR_LU_linear, self).__init__(bvalues, thresholds, bounds, initial_guess)

# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -61,6 +65,11 @@ def ivim_fit(self, signals, bvalues=None):
Returns:
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
Expand Down
13 changes: 11 additions & 2 deletions src/standardized/ETP_SRI_LinearFitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
Our OsipiBase object could contain functions that compare the inputs with
the requirements.
"""

super(ETP_SRI_LinearFitting, self).__init__(bvalues=bvalues, thresholds=thresholds, bounds=bounds, initial_guess=initial_guess)
super(ETP_SRI_LinearFitting, self).__init__(bvalues, thresholds, bounds, initial_guess)
if bounds is not None:
print('warning, bounds from wrapper are not (yet) used in this algorithm')
Expand All @@ -54,8 +54,12 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.ETP_stats = stats

# Check the inputs

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()


def ivim_fit(self, signals, bvalues=None, linear_fit_option=False, **kwargs):
"""Perform the IVIM fit

Expand All @@ -67,6 +71,11 @@ def ivim_fit(self, signals, bvalues=None, linear_fit_option=False, **kwargs):
Returns:
_type_: _description_
"""
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

signals[signals<0.0000001]=0.0000001
if bvalues is None:
bvalues = self.bvalues
Expand Down
16 changes: 15 additions & 1 deletion src/standardized/IAR_LU_biexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -69,7 +73,12 @@ def ivim_fit(self, signals, bvalues, **kwargs):
Returns:
_type_: _description_
"""


self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
bvalues = self.bvalues
Expand Down Expand Up @@ -102,6 +111,11 @@ def ivim_fit_full_volume(self, signals, bvalues, **kwargs):
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
bvalues = self.bvalues
Expand Down
9 changes: 9 additions & 0 deletions src/standardized/IAR_LU_modified_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -70,6 +74,11 @@ def ivim_fit(self, signals, bvalues, **kwargs):
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
bvalues = self.bvalues
Expand Down
9 changes: 9 additions & 0 deletions src/standardized/IAR_LU_modified_topopro.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -70,6 +74,11 @@ def ivim_fit(self, signals, bvalues, **kwargs):
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
bvalues = self.bvalues
Expand Down
9 changes: 9 additions & 0 deletions src/standardized/IAR_LU_segmented_2step.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -70,6 +74,11 @@ def ivim_fit(self, signals, bvalues, thresholds=None, **kwargs):
_type_: _description_
"""
print(thresholds)

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
Expand Down
9 changes: 9 additions & 0 deletions src/standardized/IAR_LU_segmented_3step.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -70,6 +74,11 @@ def ivim_fit(self, signals, bvalues, **kwargs):
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
bvalues = self.bvalues
Expand Down
9 changes: 9 additions & 0 deletions src/standardized/IAR_LU_subtracted.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm
if self.bvalues is not None:
Expand All @@ -70,6 +74,11 @@ def ivim_fit(self, signals, bvalues, **kwargs):
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.IAR_algorithm is None:
if bvalues is None:
bvalues = self.bvalues
Expand Down
14 changes: 12 additions & 2 deletions src/standardized/OGC_AmsterdamUMC_Bayesian_biexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class OGC_AmsterdamUMC_Bayesian_biexp(OsipiBase):

# Algorithm requirements
required_bvalues = 4
required_thresholds = [0,
0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
required_thresholds = [0,0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
required_bounds = False
required_bounds_optional = True # Bounds may not be required but are optional
required_initial_guess = False
Expand All @@ -47,6 +46,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
datain is a 2D array with values of D, f, D* (and S0) that will form the prior.
"""
super(OGC_AmsterdamUMC_Bayesian_biexp, self).__init__(bvalues=bvalues, bounds=bounds, thresholds=thresholds, initial_guess=initial_guess) #, fitS0, prior_in)
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()
self.OGC_algorithm = fit_bayesian
self.initialize(bounds, initial_guess, fitS0, prior_in)
self.fit_segmented=fit_segmented
Expand Down Expand Up @@ -86,6 +89,13 @@ def ivim_fit(self, signals, bvalues, initial_guess=None, **kwargs):
Returns:
_type_: _description_
"""
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if initial_guess is not None and len(initial_guess) == 4:
self.initial_guess = initial_guess
bvalues=np.array(bvalues)

epsilon = 0.000001
Expand Down
11 changes: 9 additions & 2 deletions src/standardized/OGC_AmsterdamUMC_biexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class OGC_AmsterdamUMC_biexp(OsipiBase):

# Algorithm requirements
required_bvalues = 4
required_thresholds = [0,
0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
required_thresholds = [0,0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
required_bounds = False
required_bounds_optional = True # Bounds may not be required but are optional
required_initial_guess = False
Expand All @@ -43,6 +42,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
"""
#super(OGC_AmsterdamUMC_biexp, self).__init__(bvalues, bounds, initial_guess, fitS0)
super(OGC_AmsterdamUMC_biexp, self).__init__(bvalues=bvalues, bounds=bounds, initial_guess=initial_guess)
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()
self.OGC_algorithm = fit_least_squares
self.fitS0=fitS0
self.initialize(bounds, initial_guess, fitS0)
Expand Down Expand Up @@ -73,6 +76,10 @@ def ivim_fit(self, signals, bvalues, **kwargs):
Returns:
_type_: _description_
"""
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

bvalues=np.array(bvalues)
fit_results = self.OGC_algorithm(bvalues, signals, p0=self.initial_guess, bounds=self.bounds, fitS0=self.fitS0)
Expand Down
12 changes: 11 additions & 1 deletion src/standardized/OGC_AmsterdamUMC_biexp_segmented.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def __init__(self, bvalues=None, thresholds=150, bounds=None, initial_guess=None
the requirements.
"""
super(OGC_AmsterdamUMC_biexp_segmented, self).__init__(bvalues, thresholds, bounds, initial_guess)
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()
self.OGC_algorithm = fit_segmented
self.initialize(bounds, initial_guess, thresholds)

Expand Down Expand Up @@ -74,7 +78,13 @@ def ivim_fit(self, signals, bvalues, **kwargs):
Returns:
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if initial_guess is not None and len(initial_guess) == 4:
self.initial_guess = initial_guess
bvalues=np.array(bvalues)
fit_results = self.OGC_algorithm(bvalues, signals, bounds=self.bounds, cutoff=self.thresholds, p0=self.initial_guess)

Expand Down
9 changes: 9 additions & 0 deletions src/standardized/OJ_GU_seg.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
self.use_bounds = False
self.use_initial_guess = False
# Check the inputs
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

# Initialize the algorithm

Expand All @@ -59,6 +63,11 @@ def ivim_fit(self, signals, bvalues=None):
Returns:
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if bvalues is None:
bvalues = self.bvalues
Expand Down
9 changes: 9 additions & 0 deletions src/standardized/PV_MUMC_biexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def __init__(self, bvalues=None, thresholds=None, bounds=None, initial_guess=Non
the requirements.
"""
super(PV_MUMC_biexp, self).__init__(bvalues=bvalues, thresholds=thresholds, bounds=bounds, initial_guess=initial_guess)
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()
self.PV_algorithm = fit_least_squares
if bounds is not None:
print('warning, bounds from wrapper are not (yet) used in this algorithm')
Expand All @@ -55,6 +59,11 @@ def ivim_fit(self, signals, bvalues=None):
_type_: _description_
"""

self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()

if self.thresholds is None:
self.thresholds = 200

Expand Down
11 changes: 9 additions & 2 deletions src/standardized/PvH_KB_NKI_IVIMfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class PvH_KB_NKI_IVIMfit(OsipiBase):

# Algorithm requirements
required_bvalues = 4
required_thresholds = [0,
0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
required_thresholds = [0,0] # Interval from "at least" to "at most", in case submissions allow a custom number of thresholds
required_bounds = False
required_bounds_optional = False # Bounds may not be required but are optional
required_initial_guess = False
Expand All @@ -41,6 +40,10 @@ def __init__(self, bvalues=None, thresholds=None,bounds=None,initial_guess=None)
the requirements.
"""
super(PvH_KB_NKI_IVIMfit, self).__init__(bvalues=bvalues, thresholds=thresholds,bounds=bounds,initial_guess=initial_guess)
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()
self.NKI_algorithm = generate_IVIMmaps_standalone
if bounds is not None:
print('warning, bounds from wrapper are not (yet) used in this algorithm')
Expand All @@ -58,6 +61,10 @@ def ivim_fit(self, signals, bvalues=None):
Returns:
_type_: _description_
"""
self.osipi_check_required_bvalues()
self.osipi_check_required_thresholds()
self.osipi_check_required_bounds()
self.osipi_check_required_initial_guess()
#bvalues = np.array(bvalues)
bvalues = bvalues.tolist() #NKI code expects a list instead of nparray
# reshape signal as the NKI code expects a 4D array
Expand Down
Loading
Loading