Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support masking backprojection #434

Open
eliyash opened this issue Apr 2, 2023 · 3 comments
Open

Support masking backprojection #434

eliyash opened this issue Apr 2, 2023 · 3 comments

Comments

@eliyash
Copy link

eliyash commented Apr 2, 2023

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!

@AnderBiguri
Copy link
Member

@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.

@eliyash
Copy link
Author

eliyash commented Apr 4, 2023

@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?

@AnderBiguri
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants