Skip to content

Instantly share code, notes, and snippets.

View PingjunChen's full-sized avatar
🎯
Focusing

Pingjun Chen PingjunChen

🎯
Focusing
View GitHub Profile
@PingjunChen
PingjunChen / tile
Created January 27, 2022 20:51 — forked from dellsystem/tile
converting tifs to pyramidal tiffs
#!/usr/bin/env bash
# A bash script for converting all the files in a directory to pyramidal tiff
# Pass the directory the images are stored in as an argument
# But it will put the images in the current directory ... to be fixed
if [ $# -lt 3 ]; then
echo 'Usage: tile <directory> <extension> <desired_prefix>'
else
echo 'Looking for all files in directory: $1/'
@PingjunChen
PingjunChen / r_gist.md
Last active February 8, 2019 03:52
R Gist

Clear sonsole

Ctrl+l

Set working directory

setwd(dir)

Get working directory

getwd()

Clear environment

remove(list = ls())

How to use a package

install.packages('fortunes') # install

@PingjunChen
PingjunChen / parse_txt.py
Last active June 9, 2018 04:31
Parsing txt file
# -*- coding: utf-8 -*-
__author__ = "Pingjun Chen"
__email__ = "chenpingjun@gmx.com"
import os, sys, pdb
def organize_images(txt_path, image_path):
with open(txt_path) as f:
content = f.readlines()
@PingjunChen
PingjunChen / convert_svs_img.py
Last active December 13, 2023 16:39
Convert SVS file to TIFF image
# -*- coding: utf-8 -*-
__author__ = "Pingjun Chen"
__email__ = "chenpingjun@gmx.com"
import os, sys, pdb
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
from skimage import io
import openslide
@PingjunChen
PingjunChen / json_save_load.py
Last active June 7, 2018 19:17
Json Load and Save
# -*- coding: utf-8 -*-
__author__ = "Pingjun Chen"
__email__ = "chenpingjun@gmx.com"
import os, sys, pdb
import json
# load json file
json_in = json.load(open('***.json'))