Skip to content
Snippets Groups Projects
Commit c6aa4b17 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Add unit test

parent 56bb7d31
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,32 @@ class TestHalftomo:
rot_center = sino.shape[-1] - 1 - self.rot_center
return self.test_halftomo_right_side(config, sino=sino, rot_center=rot_center)
def test_halftomo_plain_backprojection(self, config):
backprojector = self._get_backprojector(
config,
self.sino.shape,
rot_center=self.rot_center,
halftomo=True,
padding_mode="edges",
extra_options={"centered_axis": True},
)
d_sino_filtered = backprojector.sino_filter.filter_sino(self.sino) # device array
h_sino_filtered = d_sino_filtered.get()
reference_fbp = backprojector.fbp(self.sino)
def _check(rec, array_type):
assert (
np.max(np.abs(rec - reference_fbp)) < 1e-7
), "Something wrong with halftomo backproj using %s array and configuration %s" % (array_type, str(config))
# Test with device array
rec_from_already_filtered_sino = backprojector.backproj(d_sino_filtered)
_check(rec_from_already_filtered_sino, "device")
# Test with numpy array
rec_from_already_filtered_sino = backprojector.backproj(h_sino_filtered)
_check(rec_from_already_filtered_sino, "numpy")
def test_halftomo_cor_outside_fov(self, config):
sino = np.ascontiguousarray(self.sino[:, : self.sino.shape[-1] // 2])
backprojector = self._get_backprojector(config, sino.shape, rot_center=self.rot_center, halftomo=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment