Skip to content

Instantly share code, notes, and snippets.

newImage("Untitled", "8-bit ramp", 512, 256, 1);
setFont("SansSerif", 58, " antialiased");
setColor("yellow");
Overlay.drawString("Hello World!", 91, 250, 30.0);
Overlay.show();
@mutterer
mutterer / curvature_radius.bsh
Created September 10, 2020 12:13 — forked from lacan/curvature_radius.bsh
Curvature radius simple calculation for ImageJ/fiji #Fiji #Beanshell #Curvature #ImageJ
/*
* Simple script that takes a selection and computes the curvature radius for the whole perimeter of the shape.
*
* By Olivier Burri,
* BioImaging and Optics Platform, BIOP
* Ecole Polytechnique Fédérale de Lausanne (EPFL)
* Last update: May 2017
*
*
*/
@mutterer
mutterer / My_DialogWithDirChooser.java
Last active July 4, 2020 11:45
example for using the new directory chooser field in generic dialogs in ImageJ
import ij.*;
import ij.gui.*;
import ij.plugin.*;
// requires ImageJ 1.53d8 or later
public class My_DialogWithDirChooser implements PlugIn {
String dir;
public void run(String arg) {
@mutterer
mutterer / nicolas_02.stl
Created June 27, 2020 14:02
3D model part to fix biorad Mini-PROTEAN gel casting device, see https://twitter.com/jmutterer/status/1276855056843898881
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mutterer
mutterer / calibrate_AMT_Image.ijm
Created June 26, 2020 13:06
ImageJ macro that reads calibration from "AMT Camera System" image metadata and applies it to the current image.
List.setList( getMetadata( "Info" ) );
desc = List.get( "ImageDescription" );
if( desc.indexOf( "AMT" )< 0 ) {
print( "Not an AMT image file" );
exit( );
}
unit = List.get( "Unit" );
cal = List.get( "XpixCal" );
cal = parseFloat( cal.replace( ',', '.' ) );
setVoxelSize( 1 / cal, 1 / cal, 1, unit );
@mutterer
mutterer / LUT_Utils.ijm
Last active March 10, 2022 15:01
ImageJ Menu Tool that provides commands to create a LUT from a line selection or multipoints selection, store and restore LUT in/from Prefs
var cmd = newMenu( "LUT Utils Menu Tool",
newArray( "LUT from RGB Points", "LUT from ROI", "Store LUT in Prefs", "Restore LUT from Prefs" ) );
macro "LUT Utils Menu Tool - C037T0b12LT6b10uTbb10T" {
cmd = getArgument( );
if ( cmd == "Store LUT in Prefs" ) {
getLut( reds, greens, blues );
r = reds [ 0 ];
g = greens [ 0 ];
b = blues [ 0 ];
for ( i = 1; i < reds.length; i ++ ) {
@mutterer
mutterer / ijmacros.xml
Created June 23, 2020 13:48
jEdit mode (syntax highlighting file) for ImageJ macros
<?xml version="1.0"?>
<!DOCTYPE MODE SYSTEM "xmode.dtd">
<MODE>
<PROPS>
<PROPERTY NAME="commentStart" VALUE="/*" />
<PROPERTY NAME="commentEnd" VALUE="*/" />
<PROPERTY NAME="lineComment" VALUE="//" />
@mutterer
mutterer / tape_text_effect.ijm
Last active June 21, 2020 20:33
tape text effect macro
// reproduce tape text effect seen here: https://twitter.com/Ulrike_Boehm/status/1274720476548476929
lines = newArray("@ahklemm rocks","and yes, ImageJ macros are", "so satisfying");
tape = newArray("#ffdd5d","8ba4ff","#ffb9d1");
letters = "#ffffff";
shadow = "#444444";
run("Blobs");
run("Remove Overlay");
setFont("American Typewriter", 12, " antialiased");
@mutterer
mutterer / _fires.pde
Last active June 18, 2020 11:37
An in-situ comparison of ImageJ Fire lookup tables
// inspired by https://twitter.com/junkiyoshi/status/1273210733375795200
// sketch compares two ImageJ LUTs side by side
// LUTs files obtained using ImageJ>Image>Color>Show LUT...>List...
int s=5;
Table greenfire, fire;
void setup() {
size(640, 240);
greenfire = loadTable("greenfireblue.csv", "header");
fire = loadTable("fire.csv", "header");
@mutterer
mutterer / auto_updater.ijm
Created June 17, 2020 09:51
a basic ImageJ macro that will prompt you for update at given intervals.
/*
// run just those 3 lines to reset update preferences
call( 'ij.Prefs.set', 'update.freq', 1 );
call( 'ij.Prefs.set', 'update.mode', "stable release" );
call( 'ij.Prefs.set', 'update.last', 0 );
*/
lastUpdate = parseInt( call( 'ij.Prefs.get', 'update.last', 0 ) );
updateFreq = parseInt( call( 'ij.Prefs.get', 'update.freq', 1 ) );
updateMode = call( 'ij.Prefs.get', 'update.mode', "stable release" );