Skip to content

Commit 38f2b39

Browse files
authored
Merge pull request #33 from OSIPI/testing/fix_example
Prevent tests from trying to run the example
2 parents b8ee572 + 63dd153 commit 38f2b39

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

src/original/PvH_KB_NKI/DWI_Examples.py

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,47 @@
1414
import matplotlib.pyplot as plt
1515
import pathlib
1616

17-
#Load some DWI data
18-
file=pathlib.Path(__file__)
19-
file_path = file.with_name('IVIM_b0_15_150_500.npy').as_posix()
20-
DWI_data = np.load(file_path)
17+
def example():
18+
#Load some DWI data
19+
file=pathlib.Path(__file__)
20+
file_path = file.with_name('IVIM_b0_15_150_500.npy').as_posix()
21+
DWI_data = np.load(file_path)
2122

22-
# Specify b values that are in the data
23-
bvalues = [0, 15, 150, 500]
23+
# Specify b values that are in the data
24+
bvalues = [0, 15, 150, 500]
2425

25-
# Specifiy if you want to plot the results
26-
plot_results = False
26+
# Specifiy if you want to plot the results
27+
plot_results = False
2728

28-
# Generate ADC map and define the min and max b value that will be used for ADC fitting
29-
ADClog, b0_intercept, used_bvalues = generate_ADC_standalone(DWI_data,bvalues, bmin=150, bmax=500)
29+
# Generate ADC map and define the min and max b value that will be used for ADC fitting
30+
ADClog, b0_intercept, used_bvalues = generate_ADC_standalone(DWI_data,bvalues, bmin=150, bmax=500)
3031

31-
# Generate ADC and define the min and max b value that will be used for ADC fitting as well as the max b value
32-
# that will be used for separate Dstar fitting
33-
ADClog, perfFrac, Dstar = generate_IVIMmaps_standalone(DWI_data, bvalues, bminADC=150, bmaxADC=500, bmaxDstar=150)
34-
Slice = 5
32+
# Generate ADC and define the min and max b value that will be used for ADC fitting as well as the max b value
33+
# that will be used for separate Dstar fitting
34+
ADClog, perfFrac, Dstar = generate_IVIMmaps_standalone(DWI_data, bvalues, bminADC=150, bmaxADC=500, bmaxDstar=150)
35+
Slice = 5
3536

36-
if plot_results == True:
37-
# Plot the ADC, f and D* maps
38-
fig, axes = plt.subplots(1, 3, figsize=(10, 5))
37+
if plot_results == True:
38+
# Plot the ADC, f and D* maps
39+
fig, axes = plt.subplots(1, 3, figsize=(10, 5))
3940

40-
axes[0].imshow(ADClog[:,Slice,:], cmap='viridis', vmin=0, vmax=5)
41-
axes[0].set_title("ADC")
42-
axes[0].axis('off')
41+
axes[0].imshow(ADClog[:,Slice,:], cmap='viridis', vmin=0, vmax=5)
42+
axes[0].set_title("ADC")
43+
axes[0].axis('off')
4344

44-
axes[1].imshow(perfFrac[:,Slice,:], cmap='viridis', vmin=0, vmax=1)
45-
axes[1].set_title("f map")
46-
axes[1].axis('off')
45+
axes[1].imshow(perfFrac[:,Slice,:], cmap='viridis', vmin=0, vmax=1)
46+
axes[1].set_title("f map")
47+
axes[1].axis('off')
4748

48-
axes[2].imshow(Dstar[:,Slice,:], cmap='viridis', vmin=0, vmax=200)
49-
axes[2].set_title("D*")
50-
axes[2].axis('off')
49+
axes[2].imshow(Dstar[:,Slice,:], cmap='viridis', vmin=0, vmax=200)
50+
axes[2].set_title("D*")
51+
axes[2].axis('off')
5152

52-
plt.tight_layout() # Adjust spacing between subplots
53-
plt.show()
53+
plt.tight_layout() # Adjust spacing between subplots
54+
plt.show()
5455

55-
print("finish")
56+
print("finish")
5657

5758

59+
if __name__ == '__main__':
60+
example()

0 commit comments

Comments
 (0)