Created
February 28, 2025 17:55
-
-
Save alisterburt/87761bb77d0d8d9c5c9d02abf4a5af4a to your computer and use it in GitHub Desktop.
render a projection below a volume in napari
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import napari | |
import mrcfile | |
import torch | |
from torch_fourier_slice import project_3d_to_2d | |
volume = torch.tensor(mrcfile.read("run_class001.mrc")).float() | |
projection = project_3d_to_2d(volume, rotation_matrices=torch.eye(3)) | |
d, h, w = volume.shape | |
viewer = napari.Viewer(ndisplay=3) | |
viewer.add_image(volume.numpy(), translate=[d, 0, 0], name="volume") | |
viewer.add_image(projection.numpy(), name="projection") | |
napari.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment