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