Skip to content

Instantly share code, notes, and snippets.

@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 / Grid_Tool.ijm
Last active March 10, 2017 08:24
An imageJ tool for overlaying grids on images at arbitrary angles. Rescued from nabble ImageJ mailing list by Steffie Strebel.
var step =90;
var step_in_unit =90;
var angle =90;
var colors =newArray("red", "green", "blue", "orange");
var color = "red";
macro "Grid Tool - C00cT1f1aG" {
max = maxOf(getWidth,getHeight);
getCursorLoc(x0, y0, z, flags);
while (flags&16!=0) {
@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);
}
@mutterer
mutterer / zoom_movie_ImageJ_v2.ijm
Created March 17, 2017 13:59 — forked from ekatrukha/zoom_movie_ImageJ_v2.ijm
ImageJ macro making a movie (stack) of zooming on selected rectangle (ROI)
//ImageJ macro making a movie (stack) of zooming on selected rectangle (ROI)
//Eugene Katrukha katpyxa at gmail.com
requires("1.48h");
//check if there is rectangular selection
if(selectionType() ==0)
{
sTitle=getTitle();
sMovieTitle=sTitle+"_zoom_movie";
setBatchMode(true);
setBatchMode(true);
id = getImageID();
n = nSlices();
for(i=1; i<=n; i++) {
setSlice(i);
run("FFT");
run("Select All");
run("Copy");
run("Close");
if (!isOpen("Stack of FFT"+id)) {
setBatchMode(true);
t = getTitle();
if (!startsWith(t,"Stack of FFT")) exit ("Requires an FFT stack");
original = 1*substring (t,indexOf(t,"-"));
if (!isOpen(original)) exit("Original image has been closed");
fft = getImageID();
selectImage(original);
run("Duplicate...", "title=Results duplicate");
results= getImageID;
selectImage(original);
// cuts a closed freehand selection
// into 2 free line selections
// after selecting two points
// click and drag to move selection along area
// press shift to define first point
// drag to define second point, release to split
// see https://www.youtube.com/watch?v=qrZgbqSFv68
var shift=1;
var firstPointSet=false;
@mutterer
mutterer / 10PRINT 'rosette'.pde
Last active October 2, 2017 04:25
// 10PRINT rosette Processing 3 code, thanks to @shiffman !
// 10PRINT rosette Processing 3 code
// thanks to @shiffman !
float r=20;
float s=10;
void setup() {
size(300, 300);
frameRate(1);
}