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

mask argument for mlem is not used internally #259

Open
jonwright opened this issue Mar 14, 2024 · 5 comments
Open

mask argument for mlem is not used internally #259

jonwright opened this issue Mar 14, 2024 · 5 comments

Comments

@jonwright
Copy link
Member

Within the iradon code, the calls to iradon and radon are using mask=None. I don't understand that. The point of adding the mask argument is to only run computations on a subset of the pixels. Probably something needs to be debugged.

If the aim is to 'zero' some part of the reconstruction then we need a different name for the argument .

@jonwright
Copy link
Member Author

If we pass in a 1/0 mask for startvalue I would expect that to be kept as zero later.

@jadball jadball self-assigned this Mar 14, 2024
@jadball
Copy link
Contributor

jadball commented Mar 18, 2024

To fix this, we need to clarify:

  • The mask currently isn't used at all in radon
  • The mask given to iradon currently isn't padded like we do with projection_shifts - should we add this?
  • We should clarify how we want to handle startvalue and mask arguments, what each means and what data types they are

@jonwright
Copy link
Member Author

The purpose of the mask is to only reconstruct real space pixels in the masked region. It is meant to be an optimisation for small grains in big maps. It tells the code to only look at a small region in the sample space and assume everything else is zero. The reason to fork from skimage was to add this mask ROI (because it should be >1e4 times faster for some cases)

For adding mask to radon, it is a "todo". We only need to project the masked region onto the sinogram, not the whole 2D image. This is an optimisation, assuming the recon is zero outside the mask.

  • output_size and projection_shifts have to match mask.shape. Padding may come up here. If people supply conflicting options I guess we just stop and complain.

  • startvalue in MLEM is what to start iterating from. If you want to add more iterations, you run again with startvalue as the last output reconstruction. To converge faster, I have tried starting from abs(iradon) + constant, but it is not clear if that helps.

@jadball
Copy link
Contributor

jadball commented Mar 21, 2024

Masking radon proving difficult as we're calling an external warp function, unassigning for now...

@jadball jadball removed their assignment Mar 21, 2024
@jonwright
Copy link
Member Author

A couple of bits of code to look at to resolve this:

  • numba radon function (no new dependency, can be parallel)
  • jax radon via bilinear interpolation and iradon via grad(radon). Means using jax.
    Notebooks in ~wright/Notebooks/senn/July2024. Surely needs fixing up to match the API here.

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

No branches or pull requests

2 participants