Skip to content

Instantly share code, notes, and snippets.

@mutterer
mutterer / JACoP_Fluorogram.ijm
Created September 24, 2015 07:27
Pretty fluorogram for JACoP
/*
* Making a pretty fluorogram
* Olivier Burri, BioImaging & Optics Platform, EPFL
*/
run("Fluorescent Cells (400K)");
image = getTitle();
run("Split Channels");
@mutterer
mutterer / LineAndProfileTool.txt
Last active December 25, 2015 01:58
// This ImageJ macro tool draws a line, and overlays it's profile. // see https://list.nih.gov/cgi-bin/wa.exe?A2=IMAGEJ;197bef78.1310
// This tool draws a line, and overlays its profile and some infos
 
macro "Line and Profile Tool -C00bL1de0L1ee1" {
getCursorLoc(x, y, z, flags);
xstart = x; ystart = y;
x2=x; y2=y;
while (true) {
getCursorLoc(x, y, z, flags);
if (flags&16==0) {
dx=x2-xstart; dy=y2-ystart;
// CZI batch project macro
// parses the file metadata to work around a bioformat bug
// that assigns wrong channel colors.
// edit the first two lines to use DIC in the projection or not
// and what projection mode is needed (see Image>stacks>Z project...)
useDic = true;
projectionMode = "Max Intensity";
var r,g,b;
@mutterer
mutterer / multipage_montage.ijm
Created January 15, 2014 20:39
// creates series of montages // use case: input stack of 200 images // user wants 4x5 montage: 10 pages output.
// creates series of montages
// use case: input stack of 200 images
// user wants 4x5 montage: 10 pages output.
source = getImageID;
slices=nSlices;
cols = 4;
rows = 5;
imagesPerPage = cols*rows;
for (i=0; i<slices/imagesPerPage; i++) {
@mutterer
mutterer / MultiFreehand_Tool.ijm
Created January 31, 2016 17:54
A tool that allows drawing multiple freehand regions and adds them as overlay objects. In response to http://forum.imagej.net/t/test-if-roi-selection-is-closed-finished/723/3
macro "MultiFreehand Tool - C00cT0f18M" {
xs = newArray(1);
ys = newArray(1);
getCursorLoc(x, y, z, flags);
xs[0]=x; ys[0]=y;
lastx=x;lasty=y;
leftclick=16;
while (flags&leftclick>0) {
getCursorLoc(x, y, z, flags);
if ((x!=lastx)||(y!=lasty)) {
// written at the request of S.Mingle.
// https://gist.github.com/mutterer/8fc04d0bdcc72a56072c
var baselineIndex=0;
macro "Help Action Tool - C00cT0f18?" {
help = setup();
}
macro "Define BaseLine Action Tool - C00cT0f18BTaf18l" {
@mutterer
mutterer / drawCirclesAndQuadrants.ijm
Created June 24, 2016 14:36 — forked from lacan/drawCirclesAndQuadrants.ijm
Draws fractions of concentric circles
/*
* By Olivier Burri, BioImaging & Optics Platform EPFL
* June 2016
* Provided as-is from a request on the ImageJ Forum
* http://forum.imagej.net/t/dividing-circle-into-8-equal-areas/1995
*/
var count = 0; // Variable to know which circle we are working on
// If you install this macro, it will be mapped to the F2 Key
@mutterer
mutterer / minMaxContrastAllChannels.bsh
Created September 29, 2016 06:41
2 versions of color balance adjustment for MicroManager
// do auto contrast on all channels
// contrast is adjusted to min/max
import ij.*;
imp = IJ.getImage();
name = imp.getTitle();
print (name);
c = imp.getNChannels();
s=getMetadata('info');
s = split(substring (s,indexOf(s,'>')+2));
for (i=0;i<nSlices;i++){
setSlice(i+1);
setMetadata("Label", (1*s[i]-1*s[0])/1000+" s");
}
@mutterer
mutterer / move_overlay_elements.ijm
Created March 8, 2017 15:47
An ImageJ tool to interactively move all overlay elements. Idea by Steffie Strebel.
macro "move_overlay_elements Tool - C00cO11cc" {
getCursorLoc(x, y, z, flags);
while (flags&16>0) {
getCursorLoc(x1, y1, z, flags);
n = Overlay.size;
for (i=0;i<n;i++) {
Overlay.activateSelection(i);
Roi.getBounds(rx, ry, width, height);
Overlay.moveSelection(i, rx+x1-x, ry+y1-y);
}