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 scipy.interpolate import splprep, splev | |
| n = 10 | |
| w = np.linspace(0, 8*np.pi, num=n) | |
| x = [0, 1, 1, 1,] | |
| y = [0, 0, 10, 10] | |
| z = [0, 0, 0, 100] | |
| xyz = np.stack((x, y, z), axis=-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
| from typing import Tuple | |
| import einops | |
| import imageio | |
| import numpy as np | |
| from scipy.interpolate import LSQBivariateSpline | |
| import napari | |
| image = imageio.imread('image/EMPIAR-10164_TS_01_000_0.0.tif') | |
| mask = imageio.imread('mask/EMPIAR-10164_TS_01_000_0.0.tif') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| import os | |
| import numpy as np | |
| import pandas as pd | |
| import mrcfile | |
| from pathlib import Path | |
| def components_from_cryosparc(cs_file): | |
| data = np.load(cs_file) |
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 gemmi | |
| import numpy as np | |
| pdb = '4v6x-ribo.cif' | |
| structure = gemmi.read_structure(pdb) | |
| model = structure[0] # assumes one model in the file | |
| ca_coords = np.array([ | |
| [cra.atom.pos.x, cra.atom.pos.y, cra.atom.pos.z] |
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 einops | |
| import starfile | |
| from yet_another_imod_wrapper.utils.io import read_xf, read_tlt | |
| XF_FILE = 'imod_TS_01/TS_01.xf' | |
| TLT_FILE = 'imod_TS_01/TS_01.tlt' | |
| TILT_IMAGE_DIMENSIONS = (3710, 3838) # (x, y) |
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 typing import Tuple | |
| import napari | |
| import scipy.ndimage as ndi | |
| import numpy as np | |
| from psygnal import EventedModel | |
| viewer = napari.Viewer(ndisplay=3) | |
| mask_layer = viewer.add_image(mask := np.zeros((128, 128, 128))) |
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 numpy as np | |
| import scipy.ndimage as ndi | |
| SIZE = 42 | |
| # small circle | |
| circle = np.linalg.norm( | |
| np.indices(dimensions=(SIZE, SIZE)) - (SIZE / 2), axis=0 |