diff --git a/CHANGELOG.md b/CHANGELOG.md index b6159df7..d16f16d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.7.1 (January 19, 2024) +- BUGFIX: correct bug in the "chunking" of TOF sinogram projections in the python interface + ## 1.7.0 (January 15, 2024) - update of documentation - addition of more examples diff --git a/package.json b/package.json index 6076f7d2..96bed229 100644 --- a/package.json +++ b/package.json @@ -1,3 +1,3 @@ { - "version": "1.7.0" + "version": "1.7.1" } diff --git a/python/parallelproj/backend.py b/python/parallelproj/backend.py index 5a6d3949..a37aa447 100644 --- a/python/parallelproj/backend.py +++ b/python/parallelproj/backend.py @@ -768,7 +768,7 @@ def joseph3d_fwd_tof_sino( d_img, np.asarray(img_origin, dtype=np.float32), np.asarray(voxsize, dtype=np.float32), - img_fwd.ravel()[ic[i] : (ic[i + 1])], + img_fwd.ravel()[ntofbins*ic[i] : ntofbins*(ic[i + 1])], ic[i + 1] - ic[i], np.asarray(img.shape, dtype=np.int32), np.float32(tofbin_width), @@ -935,7 +935,7 @@ def joseph3d_back_tof_sino( d_back_img, np.asarray(img_origin, dtype=np.float32), np.asarray(voxsize, dtype=np.float32), - np.asarray(img_fwd, dtype=np.float32).ravel()[ic[i] : ic[i + 1]], + np.asarray(img_fwd, dtype=np.float32).ravel()[ntofbins*ic[i] : ntofbins*ic[i + 1]], ic[i + 1] - ic[i], np.asarray(back_img.shape, dtype=np.int32), np.float32(tofbin_width), diff --git a/test/parallelproj/test_nontof_joseph.py b/test/parallelproj/test_nontof_joseph.py index 314aa0d0..a2d8e54b 100644 --- a/test/parallelproj/test_nontof_joseph.py +++ b/test/parallelproj/test_nontof_joseph.py @@ -64,7 +64,7 @@ def test_fwd( xstart = vstart * voxel_size + img_origin xend = vend * voxel_size + img_origin - img_fwd = parallelproj.joseph3d_fwd(xstart, xend, img, img_origin, voxel_size) + img_fwd = parallelproj.joseph3d_fwd(xstart, xend, img, img_origin, voxel_size, num_chunks=3) # setup the expected values for the projection expected_projections = xp.zeros_like(img_fwd, device=dev) @@ -153,12 +153,12 @@ def test_adjointness( xend[:, 2] = R * costheta # forward project - img_fwd = parallelproj.joseph3d_fwd(xstart, xend, img, img_origin, voxel_size) + img_fwd = parallelproj.joseph3d_fwd(xstart, xend, img, img_origin, voxel_size, num_chunks=3) # backward project sino = xp.asarray(np.random.rand(*img_fwd.shape), dtype=xp.float32, device=dev) back_img = parallelproj.joseph3d_back( - xstart, xend, img.shape, img_origin, voxel_size, sino + xstart, xend, img.shape, img_origin, voxel_size, sino, num_chunks=5 ) ip_a = float(xp.sum((back_img * img))) diff --git a/test/parallelproj/test_toflm_joseph.py b/test/parallelproj/test_toflm_joseph.py index 3d5591e4..af12de16 100644 --- a/test/parallelproj/test_toflm_joseph.py +++ b/test/parallelproj/test_toflm_joseph.py @@ -70,6 +70,7 @@ def test_tof_lm_fwd( tofcenter_offset, nsigmas, tof_bin, + num_chunks=3 ) # check if sum of the projection is correct (should be equal to the voxel @@ -237,6 +238,7 @@ def test_adjointness( tofcenter_offset, nsigmas, tof_bin, + num_chunks=7 ) # backward project @@ -254,6 +256,7 @@ def test_adjointness( tofcenter_offset, nsigmas, tof_bin, + num_chunks=11 ) ip_a = float(xp.sum(back_img * img)) diff --git a/test/parallelproj/test_tofsino_joseph.py b/test/parallelproj/test_tofsino_joseph.py index fd6e639d..0d2a93c6 100644 --- a/test/parallelproj/test_tofsino_joseph.py +++ b/test/parallelproj/test_tofsino_joseph.py @@ -63,6 +63,7 @@ def test_tof_sino_fwd( tofcenter_offset, nsigmas, num_tof_bins, + num_chunks=3, ) # check if sum of the projection is correct (should be equal to the voxel @@ -196,6 +197,7 @@ def test_adjointness( tofcenter_offset, nsigmas, num_tof_bins, + num_chunks=3, ) # backward project @@ -212,6 +214,7 @@ def test_adjointness( tofcenter_offset, nsigmas, num_tof_bins, + num_chunks=5, ) ip_a = float(xp.sum((back_img * img)))