Skip to content

Commit 14fe4cb

Browse files
committed
Build if statement around plotting to prevent unit test error
1 parent 5d7d9bd commit 14fe4cb

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/original/PvH_KB_NKI/DWI_Examples.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
# Specify b values that are in the data
2323
bvalues = [0, 15, 150, 500]
2424

25+
# Specifiy if you want to plot the results
26+
plot_results = False
27+
2528
# Generate ADC map and define the min and max b value that will be used for ADC fitting
2629
ADClog, b0_intercept, used_bvalues = generate_ADC_standalone(DWI_data,bvalues, bmin=150, bmax=500)
2730

@@ -30,24 +33,24 @@
3033
ADClog, perfFrac, Dstar = generate_IVIMmaps_standalone(DWI_data, bvalues, bminADC=150, bmaxADC=500, bmaxDstar=150)
3134
Slice = 5
3235

33-
# Plot the ADC, f and D* maps
34-
fig, axes = plt.subplots(1, 3, figsize=(10, 5))
35-
36-
axes[0].imshow(ADClog[:,Slice,:], cmap='viridis', vmin=0, vmax=5)
37-
axes[0].set_title("ADC")
38-
axes[0].axis('off')
36+
if plot_results == True:
37+
# Plot the ADC, f and D* maps
38+
fig, axes = plt.subplots(1, 3, figsize=(10, 5))
3939

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

44-
axes[2].imshow(Dstar[:,Slice,:], cmap='viridis', vmin=0, vmax=200)
45-
axes[2].set_title("D*")
46-
axes[2].axis('off')
44+
axes[1].imshow(perfFrac[:,Slice,:], cmap='viridis', vmin=0, vmax=1)
45+
axes[1].set_title("f map")
46+
axes[1].axis('off')
4747

48-
plt.tight_layout() # Adjust spacing between subplots
49-
plt.show()
48+
axes[2].imshow(Dstar[:,Slice,:], cmap='viridis', vmin=0, vmax=200)
49+
axes[2].set_title("D*")
50+
axes[2].axis('off')
5051

52+
plt.tight_layout() # Adjust spacing between subplots
53+
plt.show()
5154

5255
print("finish")
5356

0 commit comments

Comments
 (0)