Skip to content

Commit 7084adf

Browse files
committed
updated wrapper of NKI, simple test run works
1 parent d28d20e commit 7084adf

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/standardized/PVH_KB_NKI_IVIMfit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ def ivim_fit(self, signals, bvalues=None):
4949
Returns:
5050
_type_: _description_
5151
"""
52-
bvalues=np.array(bvalues)
53-
# reshape signal as the function expects a 4D array
54-
signals = np.reshape(signals, (1, 1, 1, len(signals))) # Question = signals always a 1D array in the tests?
55-
# to do reshape signals into a 4D array as this is what the function expects as input
52+
#bvalues = np.array(bvalues)
53+
bvalues = bvalues.tolist() #NKI code expects a list instead of nparray
54+
# reshape signal as the NKI code expects a 4D array
55+
signals = np.reshape(signals, (1, 1, 1, len(signals))) # assuming that in this test the signals are always single voxel
5656
fit_results = self.NKI_algorithm(signals,bvalues)
5757

5858
D = fit_results[0]/1000

tests/IVIMmodels/unit_tests/simple_test_run_of_algorithm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from pathlib import Path
44
#from src.standardized.ETP_SRI_LinearFitting import ETP_SRI_LinearFitting
55
from src.standardized.IAR_LU_biexp import IAR_LU_biexp
6-
from src.standardized.IAR_LU_segmented_2step import IAR_LU_segmented_2step
6+
#from src.standardized.IAR_LU_segmented_2step import IAR_LU_segmented_2step
7+
from src.standardized.PVH_KB_NKI_IVIMfit import PVH_KB_NKI_IVIMfit
78
#from src.standardized.PV_MUMC_biexp import PV_MUMC_biexp
89

910
## Simple test code...
@@ -26,7 +27,7 @@ def ivim_model(b, S0=1, f=0.1, Dstar=0.01, D=0.001):
2627

2728
#model1 = ETP_SRI_LinearFitting(thresholds=[200])
2829
#model2 = IAR_LU_biexp()
29-
model2 = IAR_LU_segmented_2step()
30+
model2 = PVH_KB_NKI_IVIMfit()
3031

3132
#dev_test_run(model1, linear_fit_option=True)
32-
dev_test_run(model2, thresholds="Arbitrary kwarg for ivim_fit")
33+
dev_test_run(model2)

0 commit comments

Comments
 (0)