Skip to content

Commit

Permalink
Renamed folder due to conflicts, started work on
Browse files Browse the repository at this point in the history
algorithm conformance
  • Loading branch information
IvanARashid committed Aug 2, 2023
1 parent f13fc11 commit aae8cc0
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 9 deletions.
Binary file added src/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
4 changes: 1 addition & 3 deletions src/original/ETP_SRI/LinearFitting.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import numpy as np
import numpy.polynomial.polynomial as poly

from utils.data_simulation.GenerateData import GenerateData


from utilities.data_simulation.GenerateData import GenerateData

class LinearFit:
"""
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added src/original/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
32 changes: 32 additions & 0 deletions src/standardized/ETP_SRI_LinearFitting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import numpy as np
from src.wrappers.OsipiBase import OsipiBase
from src.original.ETP_SRI.LinearFitting import LinearFit


class ETP_SRI_LinearFitting(OsipiBase):
"""WIP
Implementation and execution of the submitted algorithm
"""

def ivim_fit(self, signals, b_bvalues):
ETP_object = LinearFit(self.thresholds[0])

f, D, Dstar = ETP_object.ivim_fit(b_values, signals)



return (f, Dstar, D)



# Simple test code...
b_values = np.array([0, 200, 500, 800])

def ivim_model(b, S0=1, f=0.1, Dstar=0.03, D=0.001):
return S0*(f*np.exp(-b*Dstar) + (1-f)*np.exp(-b*D))

signals = ivim_model(b_values)

model = ETP_SRI_LinearFitting()
model.thresholds = [200]
results = model.ivim_fit(b_values, signals)
File renamed without changes.
18 changes: 15 additions & 3 deletions src/wrappers/OsipiBase.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@



class ivim_fit_osipi:
class OsipiBase:
"""The base class for OSIPI IVIM fitting"""

#def __init__(self, author, data_dimension, thresholds_required, guess_required, bounds_required):
# pass

def fit_osipi(self, data=None, bvalues=None, initial_guess=None, bounds=None, **kwargs):
def fit_osipi(self, data=None, b_values=None, initial_guess=None, bounds=None, **kwargs):
"""Fits the data with the bvalues
Returns [S0, f, D, D*]
Returns [S0, f, D*, D]
"""
#self.parameter_estimates = self.ivim_fit(data, b_values)
pass

def accepted_dimensions_osipi(self):
Expand All @@ -24,6 +28,10 @@ def accepts_dimension_osipi(self, dim):
if dim < 0 or dim > len(accepted):
return False
return accepted[dim]

def thresholds_required_osipi():
"""How many segmentation thresholds does it require?"""
return 0

def guess_required_osipi():
"""Does it require an initial guess?"""
Expand All @@ -36,3 +44,7 @@ def bounds_required_osipi():
def author_osipi():
"""Author identification"""
return ''

def simple_test():
pass

Empty file added src/wrappers/__init__.py
Empty file.
Binary file not shown.
Binary file added src/wrappers/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/IVIMmodels/data/test_GenerateData.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
import torch

from utils.data_simulation.GenerateData import GenerateData
from utilities.data_simulation.GenerateData import GenerateData

#run using python -m pytest from the root folder

Expand Down
2 changes: 1 addition & 1 deletion tests/IVIMmodels/unit_tests/test_ivim_fit_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
import torch

from utils.data_simulation.GenerateData import GenerateData
from utilities.data_simulation.GenerateData import GenerateData
from src.original.ETP_SRI.LinearFitting import LinearFit


Expand Down
Empty file added utilities/__init__.py
Empty file.
Binary file added utilities/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
File renamed without changes.
Empty file.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
import numpy as np

from utils.ivim.forward_model import ivim_parameters_to_signal
from utilities.ivim.forward_model import ivim_parameters_to_signal


def simulate_ivim_signal(D, Dp, f, S0, bvalues, SNR_array, rg):
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit aae8cc0

Please sign in to comment.