|
| 1 | + |
1 | 2 | import cupy as cp |
2 | 3 | import numpy as np |
3 | 4 | import pytest |
@@ -70,7 +71,36 @@ def test_reconstruct_FBP3d_tomobar_i12_dataset1(i12_dataset1): |
70 | 71 | assert recon_data.shape == (2560, 50, 2560) |
71 | 72 |
|
72 | 73 |
|
73 | | -def test_reconstruct_LP_REC_i13_dataset1(i13_dataset1): |
| 74 | +def test_reconstruct_LPRec3d_tomobar_i12_dataset1(i12_dataset1): |
| 75 | + force_clean_gpu_memory() |
| 76 | + projdata = i12_dataset1[0] |
| 77 | + angles = i12_dataset1[1] |
| 78 | + flats = i12_dataset1[2] |
| 79 | + darks = i12_dataset1[3] |
| 80 | + del i12_dataset1 |
| 81 | + |
| 82 | + data_normalised = normalize(projdata, flats, darks, minus_log=True) |
| 83 | + data_normalised_cut = data_normalised[:, 5:8, :] |
| 84 | + del flats, darks, projdata, data_normalised |
| 85 | + force_clean_gpu_memory() |
| 86 | + |
| 87 | + recon_data = LPRec3d_tomobar( |
| 88 | + data_normalised_cut, |
| 89 | + np.deg2rad(angles), |
| 90 | + center=1253.75, |
| 91 | + filter_type="shepp", |
| 92 | + filter_freq_cutoff=1.0, |
| 93 | + ) |
| 94 | + assert recon_data.flags.c_contiguous |
| 95 | + recon_data = recon_data.get() |
| 96 | + assert isclose(np.sum(recon_data), 8973.755, abs_tol=10**-3) |
| 97 | + assert pytest.approx(np.max(recon_data), rel=1e-3) == 0.00640 |
| 98 | + assert pytest.approx(np.min(recon_data), rel=1e-3) == -0.00617 |
| 99 | + assert recon_data.dtype == np.float32 |
| 100 | + assert recon_data.shape == (2560, 3, 2560) |
| 101 | + |
| 102 | + |
| 103 | +def test_reconstruct_LPRec_tomobar_i13_dataset1(i13_dataset1): |
74 | 104 | force_clean_gpu_memory() |
75 | 105 | projdata = i13_dataset1[0] |
76 | 106 | angles = i13_dataset1[1] |
@@ -101,11 +131,15 @@ def test_reconstruct_LP_REC_i13_dataset1(i13_dataset1): |
101 | 131 | data=stiched_data_180degrees, |
102 | 132 | angles=np.deg2rad(angles[0:3000]), |
103 | 133 | center=2322.08, |
| 134 | + filter_type="shepp", |
| 135 | + filter_freq_cutoff=1.0, |
104 | 136 | ) |
105 | 137 |
|
106 | 138 | assert recon_data.flags.c_contiguous |
107 | 139 | recon_data = recon_data.get() |
108 | | - assert isclose(np.sum(recon_data), 620.856, abs_tol=10**-3) |
| 140 | + assert isclose(np.sum(recon_data), 1241.859, abs_tol=10**-3) |
| 141 | + assert pytest.approx(np.max(recon_data), rel=1e-3) == 0.00823 |
| 142 | + assert pytest.approx(np.min(recon_data), rel=1e-3) == -0.00656 |
109 | 143 | assert recon_data.dtype == np.float32 |
110 | 144 | assert recon_data.shape == (4646, 1, 4646) |
111 | 145 |
|
@@ -165,11 +199,15 @@ def test_reconstruct_LPRec3d_tomobar_i13_dataset2(i13_dataset2): |
165 | 199 | data=data_normalised, |
166 | 200 | angles=np.deg2rad(angles), |
167 | 201 | center=1286.25, |
| 202 | + filter_type="shepp", |
| 203 | + filter_freq_cutoff=1.0, |
168 | 204 | ) |
169 | 205 | assert recon_data.flags.c_contiguous |
170 | 206 | recon_data = recon_data.get() |
171 | 207 |
|
172 | | - assert isclose(np.sum(recon_data), 2044.953, abs_tol=10**-3) |
| 208 | + assert isclose(np.sum(recon_data), 4095.6257, abs_tol=10**-3) |
| 209 | + assert pytest.approx(np.max(recon_data), rel=1e-3) == 0.0105672 |
| 210 | + assert pytest.approx(np.min(recon_data), rel=1e-3) == -0.00839 |
173 | 211 | assert recon_data.dtype == np.float32 |
174 | 212 | assert recon_data.shape == (2560, 10, 2560) |
175 | 213 |
|
|
0 commit comments