CERN/TIGRE

Support masking backprojection

eliyash opened this issue · 3 comments

Use cases

  • Sinogram's image shape is not rectangler
  • Masking of problematic objects, like metal for MAR (metal artifact reduction)

How should it work IMO
A mask per sinogram's image or one for all images in the sinogram.
the mask values should not be backprojected into the volume, and the pixel should not be considered in the diff calculation

Additional context
mask implementation in astra: https://www.astra-toolbox.com/docs/misc.html

hope it make sense,
Thanks!

@eliyash fair point! The best way to impement this in TIGRE is likely not touching the backprojector, and instead just allowing the algorithms to mask the output of the fp/bp in MATLAB/Python itself, not unlike the detector offset weights are implemented. Ultimately a zero in the detector is the same as "not backprojecting".

Its likely the most efficient way, as otherwise more memory needs to be passed (the mask) to CUDA, and this overhead of reading the mask is likely larger than just backprojecting zeroes and masking the output of forward projections at the algorithm level.

In any case, great suggestion. I won't be able to implement it anytime soon, but if you feel like it, I can guide you doing it so, it's quite a simple thing, but many algorithms need to be updated.

@AnderBiguri thanks for the (fast) response!

I do feel like it, although I am unsure when I will be able to allocate the time for it.
Can you give me general guidance on how should I do it?

@eliyash absolutely!

Its not too hard. say, given SART.

1- Make it an optional parameter, i.e. let parse_inputs take an optional parameter for e.g. 'image_mask' or 'sinogram_mask'. These values can be initialized to the scalar 1.
2- Everytime the algorithm uses Ax() multiply the output by the mask, similarly for Atb().

I think a priori that would work.