UCL/STIR

SPECT image xy-origin is half a pixel off for even-sized images

Opened this issue · 1 comments

When even-sized, STIR PET images are non-symmetric, running from (-N/2),...(N/2-1) * voxel_size. This is taken into account in the PET projectors. However, the SPECT projectors take the centre in the middle as far as I understand. This means that our origin is wrong, and therefore LPS coordinates are also half a voxel off.

Changing this would also need changing

x_size_used = 2*static_cast<int>(ceil(FOVradius_in_mm / get_voxel_size().x())) + 1;
, which means it would be backwards incompatible in 2 ways:

  • default num_voxels_xy would no longer be odd (i.e. would be 1 smaller)
  • origin would be different when using an even number of voxels

As briefly discussed with @varzakis : strategy for testing would be to use generate_image with a (small) cylinder on-axis at x,y=0, which should place it in the STIR "centre", forward project with SPECTUB and check if all views are the same. My prediction is that there will be (max 1 pixel) sin-curve in the sinogram, indicating half-a-pixel offset.

See also https://stir.sourceforge.net/wiki/index.php/STIR_FAQ#How_does_the_STIR_coordinate_system_work_.28e.g._for_generate_image.29