Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| from pathlib import Path | |
| from typing import List, Sequence, Tuple | |
| import einops | |
| import mrcfile | |
| import numpy as np | |
| import torch | |
| import typer | |
| cli = typer.Typer(name='raps_3d', no_args_is_help=True, add_completion=False) |
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 torch | |
| import numpy as np | |
| import mrcfile | |
| import einops | |
| import torch.nn.functional as F | |
| from torch_cubic_spline_grids import CubicBSplineGrid3d | |
| from libtilt.rotational_average import rotational_average_2d | |
| from libtilt.utils.coordinates import array_to_grid_sample |
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 torch | |
| import numpy as np | |
| import mrcfile | |
| import einops | |
| import torch.nn.functional as F | |
| from torch_cubic_spline_grids import CubicBSplineGrid3d | |
| from libtilt.utils.coordinates import array_to_grid_sample | |
| from libtilt.shift.phase_shift_2d import phase_shift_images_2d, phase_shift_dfts_2d |
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 einops | |
| import numpy as np | |
| import napari | |
| import imageio | |
| # variables to be set by user | |
| SPACING = 28 | |
| # load data | |
| labels = imageio.imread('matteo_labels_example.tif') |
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 sys | |
| import mrcfile | |
| import napari | |
| import torch | |
| import torch.nn.functional as F | |
| import numpy as np | |
| from scipy.stats import special_ortho_group | |
| from libtilt.utils.coordinates import generate_rotated_slice_coordinates |
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 starfile | |
| from scipy.spatial.transform import Rotation as R | |
| particle_star_file = 'hiv/01_10.00Apx_particles.star' | |
| star = starfile.read(particle_star_file) | |
| df = df = star['particles'].merge(star['optics'], on='rlnOpticsGroup') | |
| # get necessary info from dataframes |
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 starfile | |
| from scipy.spatial.transform import Rotation as R | |
| particle_star_file = 'hiv/01_10.00Apx_particles.star' | |
| df = starfile.read(particle_star_file) | |
| # get necessary info from dataframe | |
| xyz = df[['rlnCoordinateX', 'rlnCoordinateY', 'rlnCoordinateZ']].to_numpy() # (n, 3) | |
| shifts = df[['rlnOriginX', 'rlnOriginY', 'rlnOriginZ']].to_numpy() # (n, 3) |
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 numpy as np | |
| import napari | |
| from skimage import data | |
| # fake tomogram | |
| tomogram = np.random.random((300, 300, 300)) | |
| # fake mask | |
| mask = data.binary_blobs( | |
| length=300, n_dim=3, blob_size_fraction=0.3, volume_fraction=0.1 |
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 os | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| from typing import Tuple, Optional | |
| import einops | |
| import fast_histogram | |
| import mmdf | |
| import mrcfile | |
| import napari |