Skip to content

Instantly share code, notes, and snippets.

macro"drawGrids"{
newImage("Untitled", "8-bit black", 400, 400, 1);
y1=0;
y2=399;
setColor("white");
setLineWidth(1);
for (x1=20;x1<400;x1+=20){
drawLine(x1,y1,x1,y2);
}
x2=0;
macro "grid_perp" {
width = getNumber("width?",400);
height = getNumber("height?",400);
factor = getNumber("how many lines?",10)
newImage("grid", "8-bit black", width, height, 1);
setColor("white");
for (i = width/factor; i < width; i+=width/factor)
drawLine(i, 0, i, height);
for (i = width/factor; i < height; i+=height/factor)
drawLine(0, i, width, i);
from ij.plugin import ChannelSplitter as CS
imp = IJ.getImage()
chs = CS.split(imp)
for aimp in chs:
aimp.show()
macro "delete even frames" {
for (i=2; i<=nSlices; i++) {
setSlice(i);
run("Delete Slice");
}
}
var Gtitle = "map";
var Rtitle = "nuc";
twoImageChoice();
selectWindow(Rtitle);
//makeLine(0, 0, 0, 0);
run("Gaussian Blur...", "sigma=0.75 scaled stack");
//setAutoThreshold("IsoData dark");
//setOption("BlackBackground", false);
@miura
miura / gist:6412898
Last active December 22, 2015 03:49
from fiji.threshold import Auto_Local_Threshold as ALT
# nucleus selection
#imp = IJ.getImage()
imp = IJ.openImage("/Users/miyanari/Desktop/EMBL_with Kota/FISH_data/DNA-FISH_Demo.tif")
#IJ.run(imp, "Split Channels", "")
imps = ChannelSplitter.split(imp)
nucimp = imps[0]
#nucimp.show()
imp = IJ.getImage()
midslice = int(imp.getStackSize() / 2)
imp.setSlice(midslice)
#IJ.setThreshold(-50, -0.62)
ip.setAutoThreshold(AutoThresholder.Method.Default, False)
IJ.setThreshold(ip.getMinThreshold(), ip.getMaxThreshold())
print ip.getMaxThreshold()
print ip.getMinThreshold()
#th = ip.getMaxThreshold()
IJ.run("Convert to Mask", "method=Default background=Light black")
def floatStackThresholder(ip, pix, th):
for i in range(pix):
if ip.get(i) > th:
ip.setf(i, 255.0)
else:
ip.setf(i, 0.0)
ip = ip.convertToByte(False)
return ip
imp = IJ.getImage()
def stacklistGenerate(imp):
stk = imp.getStack()
imglist = []
print len(imglist)
for i in range(imp.getStackSize()):
ip = stk.getProcessor(i+1)
title = "img" + str(i+1)
impsingle = ImagePlus(title, ip.duplicate())
@miura
miura / ZenLSMSeriesMerger.py
Created September 5, 2013 17:11
Choose a file among the file series, and this script searchs all the files with a pattern (basename)_R(fixed)_GR(.*)_B(block number)_L(location number)\.lsm with GR (group repetition) number being left to be variable, and then these files are merged in the orfer of the GR value.
'''
Opens series of .lsm files as a single hyperstack
20130712 Kota Miura (cmci.embl.de)
Choose a file among the file series, and this script searchs all the
files with a pattern
(basename)_R(fixed)_GR(.*)_B(block number)_L(location number)\.lsm