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
| """ | |
| Extracts tissue from an overview montage and calculates the centroid. | |
| python resin_mask.py .../bladeseq-2025.02.03-11.41.01/s021-2025.02.03-11.41.01/ | |
| To install dependencies: | |
| pip install simplejpeg tqdm pyspng-seunglab numpy scipy connected-components-3d fill_voids tinybrain edt opencv-python -U | |
| """ | |
| from typing import List, Dict, Union, Optional, Tuple |
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
| # pip install caveclient osteoid cloud-volume vtk microviewer numpy | |
| from osteoid import Skeleton, Bbox | |
| from caveclient import CAVEclient | |
| from cloudvolume import CloudVolume | |
| import numpy as np | |
| # import microviewer | |
| import time | |
| import sys |
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
| """ | |
| Draws a 3D cube from a 3D image. | |
| Can be posed in any orientation. | |
| To install: | |
| pip install numpy cloud-volume mayavi fastremap | |
| pip install PyQt5 | |
| """ |
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
| """ | |
| Extracts tissue from an overview montage and calculates the centroid. | |
| To install dependencies: | |
| pip install simplejpeg pyspng-seunglab numpy scipy connected-components-3d tinybrain edt -U | |
| """ | |
| from typing import List, Dict, Union, Optional, Tuple | |
| import csv | |
| import io |
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 cloudvolume import CloudVolume | |
| cv = CloudVolume( | |
| 'graphene://https://fafbv2.dynamicannotationframework.com/segmentation/1.0/fly_v31', # neuroglancer layer | |
| use_https=True # uses the public access interface | |
| ) | |
| # Download and Save a Mesh to Disk | |
| mesh = cv.mesh.get(720575940621065107) | |
| with open('720575940621065107.ply', 'wb') as f: |
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 h5py | |
| from tqdm import tqdm | |
| from cloudvolume import view | |
| def find_section_clamping_values(zlevel, lowerfract, upperfract): | |
| filtered = np.copy(zlevel) | |
| # remove pure black from frequency counts as |
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
| def countless_stippled(data): | |
| """ | |
| Vectorized implementation of downsampling a 2D | |
| image by 2 on each side using the COUNTLESS algorithm | |
| that treats zero as "background" that doesn't count | |
| for the purposes of choosing the mode. | |
| data is a 2D numpy array with even dimensions. | |
| """ | |
| sections = [] |
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 itertools import combinations | |
| from functools import reduce | |
| import numpy as np | |
| def countlessND(data, factor): | |
| assert len(data.shape) == len(factor) | |
| sections = [] | |
| mode_of = reduce(lambda x,y: x * y, factor) |
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 itertools import combinations | |
| from functools import reduce | |
| import numpy as np | |
| def dynamic_zero_corrected_countless3d(data): | |
| sections = [] | |
| # shift zeros up one so they don't interfere with bitwise operators | |
| # we'll shift down at the end | |
| data += 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 itertools import combinations | |
| from functools import reduce | |
| import numpy as np | |
| def countless3d(data): | |
| """Now write countless8 in such a way that it could be used | |
| to process an image.""" | |
| sections = [] | |
| # shift zeros up one so they don't interfere with bitwise operators |
NewerOlder