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
## Convert all mitochondria STL files in current directory to SFF/HFF files | |
## Usage: python stl2sff.py FOLDERNAME | |
## Assumes there are multiple mitochondria per tomogram and up to one ER per tomogram. | |
## Performs both per-segment and global annotations based on assumption of MitoGFP MEF cells treated with thapsigargin (sometimes) | |
## Outputs HFF format sff files. | |
## Author: Benjamin Barad <[email protected]> with guidance from Paul Korir | |
import os | |
import sys | |
import glob |
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
# Take two binary segmentations in mrc format and combine them, with the first segmentation having label 1 and the second segmentation having label 2. | |
import mrcfile | |
import numpy as np | |
import argparse | |
def combine_segmentations(seg1, seg2, clear_overlaps=True): | |
""" | |
Combine two binary segmentations into one, with the first segmentation having label 1 and the second segmentation having label 2. |
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
## Segmentation values and names are hardcoded (line 7). | |
## All segmentations should be in a single "segmentations" folder. | |
## This should match what is used in the config.yml for surface morphometrics | |
from sys import argv | |
import mrcfile | |
import os | |
import numpy as np | |
component_values = {"vesicle":1, | |
"er":2, |
OlderNewer