View test_gpus_accelerate.py
This file contains 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
#!/usr/bin/env python | |
""" | |
A simple example of how to use the Accelerator API | |
to train a vision model on a dummy dataset. | |
Accelerator enables training on a single or multiple GPUs. | |
Run once `accelerate config` to set up your configuration file. |
View quantization_experiments.py
This file contains 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
""" | |
Run the experiments for the quantization speedup and plot results. | |
""" | |
import subprocess | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns |
View fix_indica_tiff.py
This file contains 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 a TIFF file generated by IndicaLabs (HALO) to a usable TIFF file. | |
""" | |
import typing as tp | |
from pathlib import Path | |
from xml.etree import ElementTree | |
import tifffile | |
from tifffile.tiffcomment import tiffcomment |
View macsima_liver.py
This file contains 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 | |
import tifffile | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.backends.backend_pdf import PdfPages | |
from stardist.models import StarDist2D | |
from csbdeep.utils import normalize | |
_dir = Path("HumanLiverH35") | |
files = list( |
View markers_to_cell_type_labels.yaml
This file contains 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
# This annotation of cell type markers is tailored for surface proteins | |
# normally profilid with multiplexed imaging (IMC, CODEX). | |
# It is a simple reference for myself and may be more detailed in some parts than others. | |
# This reference is hierarchical. | |
# This annotation is generally pan-tissue. | |
# Author: Andre Rendeiro | |
# License: CC BY-SA 2.0 | |
cell_types: | |
structural: |
View mask_to_labelme_json.py
This file contains 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 pathlib | |
import numpy as np | |
def mask_to_labelme( | |
labeled_image: np.ndarray, | |
filename: pathlib.Path, | |
overwrite: bool = False, | |
simplify: bool = True, | |
simplification_threshold: float = 5.0, |
View triangular_clustermap.py
This file contains 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 string | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
# generate some data | |
n_groups = 4 | |
n_per_group = 5 |
View interactive_volume_viewer.py
This file contains 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
#!/usr/bin/env python | |
""" | |
An example program to display a volumetric image from the command line. | |
""" | |
import sys | |
import typing as tp | |
from urlpath import URL | |
from functools import partial |
View upload_zipfiles_to_box.py
This file contains 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
#!/usr/bin/env python | |
""" | |
Upload images inside zip files to box.com. | |
""" | |
import sys, time, webbrowser, json, zipfile, tempfile, urllib3 | |
from argparse import ArgumentParser | |
from pathlib import Path | |
from typing import Dict, List, Generator |
View dog_ex.py
This file contains 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 skimage import data, feature, color, filters, img_as_float | |
from matplotlib import pyplot as plt | |
original_image = img_as_float(data.chelsea()) | |
img = color.rgb2gray(original_image) | |
k = 1.6 | |
plt.subplot(2,3,1) |
NewerOlder