Skip to content

Instantly share code, notes, and snippets.

@mutterer
mutterer / better_RGB_split.ijm
Last active February 12, 2021 15:18
A macro that splits RGB images and colors produced windows
// better split RGB image.
// @egrandgirard1 & @jmutterer
if (bitDepth==24) {
run("Duplicate...","title="+getTitle);
run("Split Channels");
id=getImageID;
cols=newArray("#8888ff","#88ff88","#ff8888");
for(i=0;i<3;i++) {
selectImage(id+i);
@mutterer
mutterer / Menu_Tool.ijm
Created February 8, 2021 13:26
Example Menu Tool
var menu = newMenu( "Test Menu Tool",
newArray("Red","Green","Blue","-","Sample Image"));
macro "Test Menu Tool - T0h20M" {
cmd = getArgument();
if (cmd=="Sample Image")
run("Blobs");
else
run(cmd);
}
@mutterer
mutterer / Action_Tool.ijm
Created February 8, 2021 10:54
Example action tool
macro "Test Action Tool - C000 T0h24T" {
run("Blobs");
run("Green");
run("In [+]");
}
@mutterer
mutterer / Image_Tool.ijm
Last active February 8, 2021 13:25
Example Image Tool
var name="user";
macro "Test Tool - C000 T0h24T" {
getCursorLoc(x, y, z, modifiers);
print (name, "clicked:",x, y);
}
macro "Test Tool Options" {
name = getString("Name",name);
}
macro "Test Tool Selected" {
@mutterer
mutterer / Safe_Macro.java
Created February 2, 2021 16:07
This plugin can be used to "seal" your *.ijm files
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import ij.IJ;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;
@mutterer
mutterer / Random_color_picker_Tool.ijm
Created January 22, 2021 18:44
Random_color_picker_Tool.ijm
macro "digit1 Action Tool - C037N44R00nn" {
}
macro "digit2 Action Tool - C037N44R00nn" {
}
macro "digit3 Action Tool - C037N44R00nn" {
}
macro "play Action Tool - C037N44F0hf4 Fd64f Cf00 Va0bb " {
call("ij.gui.Toolbar.setIcon", "play Action Tool", "C037N44F0hf4 CfF0 Vadbb" );
wait(500);
call("ij.gui.Toolbar.setIcon", "play Action Tool", "C037N44F0hf4 Fd64f Cf00 Va0bb" );
@mutterer
mutterer / read_calibration_from_tif_meta_dot_xml.ijm
Created January 22, 2021 14:45
Read calibration from axiovision tif _meta.xml files
// reads and applies, the calibration, if any,
// from *_meta.xml files saved alongside
// *.tif files in Axiovision.
// jerome.mutterer@cnrs.fr
fname=getInfo("image.directory")+getInfo("image.filename");
if (File.exists(fname+"_meta.xml")) {
x=1;y=1;
s=split(File.openAsString(fname+"_meta.xml"),"\n");
@mutterer
mutterer / tool icon scrolling display.ijm
Created January 22, 2021 09:31
Scrolls some demo text in ImageJ tool icons
// scrolls some demo text in tool icons
// install then press play icon
function start() {
setBatchMode(1);
call("ij.gui.Toolbar.setIcon", "T0 Action Tool", "D00");
id = makeTemplate("ImageJ "+IJ.getFullVersion);
width=getWidth-24;
for (w=0;w<width*2;w=w+2){
for (t=0;t<7;t++) {
@mutterer
mutterer / Image_to_Tool_Icon_24.ijm
Created January 19, 2021 18:02 — forked from lannybroo/Image_to_Tool_Icon_24.ijm
A version of the ImageJ Image to Tool Icon macro that works with 24x24 images
// This macro converts a 24x24 8-bit image to a tool macro icon
// string. Ideally, the image should have no more than 16 colors.
// Includes a few examples.
macro "Convert Image to Tool Icon 24..." {
requires("1.53c"); // for the extended hex feature
if (bitDepth==24) // convert RGB to 16-color 8-bit
run("8-bit Color", "number=16");
if (bitDepth!=8 || getWidth>24 || getHeight>24)
exit("This macro requires an 8-bit 24x24 image");
@mutterer
mutterer / googly_eyes_Tool.ijm
Last active January 19, 2021 08:45
Googly eyes tool
// this example uses the Toolbar.setIcon(toolName,icon) method
// added in v1.53h, to dynamically update its icon.
macro "Left Eye Action Tool - N44 C000 o00nn" {
setTool("Googly Eyes Tool")
}
macro "Right Eye Action Tool - N44 C000 o00nn" {
setTool("Googly Eyes Tool")
}