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

Spherical mask issues #46

Open
jojoelfe opened this issue Aug 9, 2024 · 2 comments
Open

Spherical mask issues #46

jojoelfe opened this issue Aug 9, 2024 · 2 comments

Comments

@jojoelfe
Copy link
Contributor

jojoelfe commented Aug 9, 2024

  • ttmask version: 0.1.0
  • Python version: 3.11.9
  • Operating System: Ubuntu 20.0

Description

Thanks @milesagraham for this awesome tool!

I've tried to generate a spherical mask using this command:

ttmask sphere --sidelength 12 --sphere-diameter 12 --output ../../../mask.mrc

but the resulting mrc was all 0.

When I manually run this code (whithout edge moothing and shell creation) things seem to work:

from ttmask.box_setup import box_setup
sphere_radius = 6

# establish our coordinate system and empty mask
coordinates_centered, mask = box_setup(12)

#determine distances of each pixel to the center
distance_to_center = np.linalg.norm(coordinates_centered, axis=-1)

# set up criteria for which pixels are inside the sphere and modify values to 1.
inside_sphere = distance_to_center < (sphere_radius / 1)
mask[inside_sphere] = 1

but the resulting spherical mask does appear to not be quite centered:

image

Happy to dig into this myself at some point, but thought I should let you know first.

@milesagraham
Copy link
Member

milesagraham commented Aug 12, 2024

Hi @jojoelfe , thanks for this. I hadn't updated the package to fix the sphere bug. Sorry about that - it is done now so the mrc will no longer be blank if you upgrade.

Re. mis-centering, I'm taking a look and hopefully find what I've got wrong. It isn't immediately obvious to me, so bear with me while I figure it out!

Many thanks for your catch,
Miles

@milesagraham
Copy link
Member

Hi @jojoelfe
Have provided the option for the shape to be 'visually' centered. Is this as you had hoped? Happy to make more changes. Will work on providing the option of centering on custom coordinates next.
Cheers,
Miles

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