Skip to content

Instantly share code, notes, and snippets.

Hung-Yi Wu hywu0110

Block or report user

Report or block hywu0110

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hywu0110
hywu0110 / get_ometif_metadata.py
Created Oct 9, 2019
Get metadata of .ome.tif file without loading the pixel data into memory.
View get_ometif_metadata.py
from skimage.external import tifffile
with tifffile.TiffFile('/path/to/image.ome.tif') as infile:
print(infile.info())
@hywu0110
hywu0110 / slurmjob.sh
Created Oct 9, 2019
SLURM job submission scripts
View slurmjob.sh
#!/bin/bash
#SBATCH --job-name=newjob
#SBATCH -n 1 # Number of cores
#SBATCH -N 1 # Ensure that all cores are on one machine
#SBATCH -t 0-01:00 # Runtime in D-HH:MM, minimum of 10 minutes
#SBATCH -p shared,general # Partition to submit to, whichever is faster
#SBATCH --mem-per-cpu=4G # Memory (see also --mem)
#SBATCH -o joboutput_%j.out # File to which STDOUT will be written, %j inserts jobid
#SBATCH -e joberrors_%j.err # File to which STDERR will be written, %j inserts jobid
#SBATCH --mail-type=ALL # Type of email notification- BEGIN,END,FAIL,ALL
@hywu0110
hywu0110 / get_data_from_omero.py
Created Oct 9, 2019
Contact with OMERO server and retrieve data.
View get_data_from_omero.py
from __future__ import print_function # OMERO currently seems to only support Python 2.7
from omero.gateway import BlitzGateway
import getpass
def print_obj(obj, indent=0):
'''
Helper method to display info about OMERO objects.
Not all objects will have a "name" or owner field.
'''
View custom_colormap.py
import numpy as np
from matplotlib.colors import ListedColormap
def get_cmap_list():
'''
Low being black and high being either blue, green, yellow, or red.
Colors chosen for typical multiplexed fluorescence microscopy imaging data, such as CyCIF (https://www.cycif.org/).
'''
N = 256
cmap_list = []
@hywu0110
hywu0110 / auto_contrast.py
Created Oct 9, 2019
Percentile-based auto-contrast of image
View auto_contrast.py
import numpy as np
def auto_contrast(
image_in: np.ndarray,
p_low: float=1.,
p_high: float=99.):
'''
Scale an image using a percentile approach.
reference: https://stackoverflow.com/questions/9744255/instagram-lux-effect/9761841#9761841
You can’t perform that action at this time.