Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
grp-bio-it
image-analysis-training-resources
Commits
17bf6fbb
Commit
17bf6fbb
authored
Apr 08, 2019
by
Christian Tischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EMBL Course
parent
b4043b32
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
826 additions
and
0 deletions
+826
-0
code/imagej-macro/CellAndSpotDetection.ijm
code/imagej-macro/CellAndSpotDetection.ijm
+24
-0
code/imagej-macro/CellAndSpotDetection_Batch.ijm
code/imagej-macro/CellAndSpotDetection_Batch.ijm
+76
-0
code/imagej-macro/CellAndSpotDetection_ChooseImage.ijm
code/imagej-macro/CellAndSpotDetection_ChooseImage.ijm
+74
-0
code/imagej-macro/CellAndSpotDetection_Improved.ijm
code/imagej-macro/CellAndSpotDetection_Improved.ijm
+52
-0
code/imagej-macro/CellDetection.ijm
code/imagej-macro/CellDetection.ijm
+4
-0
code/imagej-macro/CellDetection2.ijm
code/imagej-macro/CellDetection2.ijm
+20
-0
code/imagej-macro/SpotDetection.ijm
code/imagej-macro/SpotDetection.ijm
+8
-0
code/imagej-macro/closeEverything.ijm
code/imagej-macro/closeEverything.ijm
+32
-0
code/imagej-macro/closing-2d.ijm
code/imagej-macro/closing-2d.ijm
+6
-0
code/imagej-macro/create-noisy-spots-uneven-background.ijm
code/imagej-macro/create-noisy-spots-uneven-background.ijm
+47
-0
code/imagej-macro/create-test-image.ijm
code/imagej-macro/create-test-image.ijm
+24
-0
code/imagej-macro/deep-conv.ijm
code/imagej-macro/deep-conv.ijm
+27
-0
code/imagej-macro/distance-measurement-2d.ijm
code/imagej-macro/distance-measurement-2d.ijm
+30
-0
code/imagej-macro/dots-verticalLine--convolution.ijm
code/imagej-macro/dots-verticalLine--convolution.ijm
+21
-0
code/imagej-macro/dots-verticalLine-horizontalLine--convolution.ijm
...j-macro/dots-verticalLine-horizontalLine--convolution.ijm
+33
-0
code/imagej-macro/edge-of-dots--deep-convolution.ijm
code/imagej-macro/edge-of-dots--deep-convolution.ijm
+58
-0
code/imagej-macro/median-subtraction.ijm
code/imagej-macro/median-subtraction.ijm
+14
-0
code/imagej-macro/object-intensity-splitting-workflow.ijm
code/imagej-macro/object-intensity-splitting-workflow.ijm
+24
-0
code/imagej-macro/object-segmentation.ijm
code/imagej-macro/object-segmentation.ijm
+32
-0
code/imagej-macro/object-shape-measurement.ijm
code/imagej-macro/object-shape-measurement.ijm
+25
-0
code/imagej-macro/object-splitting-by-intensity-watershed.ijm
.../imagej-macro/object-splitting-by-intensity-watershed.ijm
+15
-0
code/imagej-macro/opening-2d.ijm
code/imagej-macro/opening-2d.ijm
+6
-0
code/imagej-macro/results_visualisation/color-objects-by-measurement.ijm
...ro/results_visualisation/color-objects-by-measurement.ijm
+6
-0
code/imagej-macro/results_visualisation/measurements-text-overlay.ijm
...macro/results_visualisation/measurements-text-overlay.ijm
+30
-0
code/imagej-macro/runAsBatch.ijm
code/imagej-macro/runAsBatch.ijm
+48
-0
code/imagej-macro/shape-based-watershed.ijm
code/imagej-macro/shape-based-watershed.ijm
+20
-0
code/imagej-macro/test.ijm
code/imagej-macro/test.ijm
+3
-0
code/imagej-macro/tophat-2d.ijm
code/imagej-macro/tophat-2d.ijm
+8
-0
code/imagej-macro/tophat-filter.ijm
code/imagej-macro/tophat-filter.ijm
+23
-0
code/imagej-macro/typical-image-analysis-workflow.ijm
code/imagej-macro/typical-image-analysis-workflow.ijm
+36
-0
image_data/xy_8bit_calibrated_anisotropic__mri_stack.tif
image_data/xy_8bit_calibrated_anisotropic__mri_stack.tif
+0
-0
No files found.
code/imagej-macro/CellAndSpotDetection.ijm
0 → 100644
View file @
17bf6fbb
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
run("Gaussian Blur...", "sigma=15");
run("Find Maxima...", "noise=50 output=[Segmented Particles]");
run("Analyze Particles...", "exclude add");
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
rename("raw");
run("Duplicate...", "title=median_bg");
run("Median...", "radius=5");
imageCalculator("Subtract", "raw","median_bg");
run("Find Maxima...", "noise=50 output=[Single Points]");
run("Divide...", "value=255");
rename("spots.tif")
selectWindow("spots.tif");
roiManager("Measure");
saveAs("Results", "/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/spot_count.csv");
close("*");
list = getList("window.titles");
for (i=0; i<list.length; i++) {
winame = list[i];
selectWindow(winame);
run("Close");
}
\ No newline at end of file
code/imagej-macro/CellAndSpotDetection_Batch.ijm
0 → 100644
View file @
17bf6fbb
dirIn = getDirectory("Choose input directory!");
imFileExtension = getString("What is the ending of your image files?",".tif");
files = getFileList(dirIn);
setBatchMode(true);
for(i=0; i<lengthOf(files); i++) {
if(endsWith(files[i],imFileExtension)) {
closeEverything();
print("Working on: "+dirIn+files[i]);
open(dirIn+files[i]); // opens the image
rename("inputImage");
///////////////////////////////////////////
// Copy and paste your macro code BELOW! //
///////////////////////////////////////////
// find cells
selectWindow("inputImage");
run("Duplicate...", "title=GaussianBlur");
run("Gaussian Blur...", "sigma=10");
run("Find Maxima...", "noise=50 output=[Segmented Particles]");
rename("Cells");
selectWindow("GaussianBlur");
setThreshold(230, 100000); // changed: set upper threshold super high
setOption("BlackBackground", false);
run("Convert to Mask");
rename("Foreground");
imageCalculator("AND create", "Foreground","Cells");
run("Analyze Particles...", "size=500-Infinity exclude add"); // changed: put minimum cell size higher
// find spots
selectWindow("inputImage");
run("Duplicate...", "title=median_bg");
run("Median...", "radius=5");
imageCalculator("Subtract create", "inputImage", "median_bg");
run("Find Maxima...", "noise=50 output=[Single Points]");
run("Divide...", "value=255");
rename("spots.tif");
// measure spots and save results
selectWindow("spots.tif");
roiManager("Measure");
saveAs("Results", dirIn+files[i]+"--spot_count.csv"); // changed: used dirIn to construct path
///////////////////////////////////////////
// Copy and paste your macro code ABOVE! //
///////////////////////////////////////////
}
}
///////////////
// functions //
///////////////
function closeEverything() {
// closes all image windows
close("*");
// closes all non-image windows
list = getList("window.titles");
for (i=0; i<list.length; i++) {
winame = list[i];
selectWindow(winame);
run("Close");
}
}
code/imagej-macro/CellAndSpotDetection_ChooseImage.ijm
0 → 100644
View file @
17bf6fbb
closeEverything(); // close all windows
////////////////
// load image //
////////////////
// get, open and rename the input file
path = File.openDialog("Select a File");
open(path);
rename("inputImage");
// hide windows during run (much faster!!)
//setBatchMode(true);
////////////////
// find cells //
////////////////
// removed: open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
selectWindow("inputImage"); // added
run("Duplicate...", "title=GaussianBlur"); // added (to avoid that input image is 'lost' as we need it later)
run("Gaussian Blur...", "sigma=10");
run("Find Maxima...", "noise=50 output=[Segmented Particles]");
rename("Cells");
selectWindow("GaussianBlur");
setThreshold(230, 100000); // changed: set upper threshold super high
setOption("BlackBackground", false);
run("Convert to Mask");
rename("Foreground");
imageCalculator("AND create", "Foreground","Cells");
run("Analyze Particles...", "size=100-Infinity exclude add");
////////////////
// find spots //
////////////////
// removed: open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
selectWindow("inputImage");
run("Duplicate...", "title=median_bg");
run("Median...", "radius=5");
imageCalculator("Subtract create", "inputImage", "median_bg");
run("Find Maxima...", "noise=70 output=[Single Points]");
run("Divide...", "value=255");
rename("spots.tif");
////////////////////////////
// measure and save spots //
////////////////////////////
selectWindow("spots.tif");
roiManager("Measure");
// removed: saveAs("Results", "/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/spot_count.csv");
saveAs("Results", path+"--spot_count.csv"); // added (to have a flexible output filename)
///////////////
// functions //
///////////////
function closeEverything() {
// closes all image windows
close("*");
// closes all non-image windows
list = getList("window.titles");
for (i=0; i<list.length; i++) {
winame = list[i];
selectWindow(winame);
run("Close");
}
}
\ No newline at end of file
code/imagej-macro/CellAndSpotDetection_Improved.ijm
0 → 100644
View file @
17bf6fbb
// close all windows
closeEverything();
// hide windows during run (much faster!!)
//setBatchMode(true);
// find cells
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
run("Gaussian Blur...", "sigma=10");
rename("blurredImage");
run("Find Maxima...", "noise=50 output=[Segmented Particles]");
rename("cells");
selectWindow("blurredImage");
setThreshold(230, 714);
setOption("BlackBackground", false);
run("Convert to Mask");
rename("foreground");
imageCalculator("AND create", "foreground","cells");
run("Analyze Particles...", "size=100-Infinity exclude add");
// find spots
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
rename("raw");
run("Duplicate...", "title=median_bg");
run("Median...", "radius=5");
imageCalculator("Subtract create", "raw","median_bg");
run("Find Maxima...", "noise=70 output=[Single Points]");
run("Divide...", "value=255");
rename("spots.tif");
// measure spots and save results
selectWindow("spots.tif");
roiManager("Measure");
saveAs("Results", "/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/spot_count.csv");
// functions ////////////////////////////////////////////////
function closeEverything() {
// closes all image windows
close("*");
// closes all non-image windows
list = getList("window.titles");
for (i=0; i<list.length; i++) {
winame = list[i];
selectWindow(winame);
run("Close");
}
}
\ No newline at end of file
code/imagej-macro/CellDetection.ijm
0 → 100644
View file @
17bf6fbb
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
run("Gaussian Blur...", "sigma=10");
run("Find Maxima...", "noise=100 output=[Segmented Particles]");
run("Analyze Particles...", "size=100-Infinity exclude add");
\ No newline at end of file
code/imagej-macro/CellDetection2.ijm
0 → 100644
View file @
17bf6fbb
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
run("Gaussian Blur...", "sigma=10");
rename("blurredImage");
run("Find Maxima...", "noise=100 output=[Segmented Particles]");
rename("cells");
selectWindow("blurredImage");
setThreshold(230, 714);
setOption("BlackBackground", false);
run("Convert to Mask");
rename("foreground");
imageCalculator("AND create", "foreground","cells");
run("Analyze Particles...", "size=100-Infinity exclude add");
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
rename("raw");
run("Duplicate...", "title=median_bg");
run("Median...", "radius=5");
imageCalculator("Subtract create", "raw","median_bg");
run("Find Maxima...", "noise=100 output=[Single Points]");
run("Divide...", "value=255");
rename("spots.tif")
code/imagej-macro/SpotDetection.ijm
0 → 100644
View file @
17bf6fbb
open("/Users/tischi/Dropbox/Presentations_Courses/2015--Tischi--Kopenhagen/0000--PracticalImagej/data/autophagosomes/autophagosomes_raw.tif");
rename("raw");
run("Duplicate...", "title=median_bg");
run("Median...", "radius=5");
imageCalculator("Subtract create", "raw","median_bg");
run("Find Maxima...", "noise=100 output=[Single Points]");
run("Divide...", "value=255");
rename("spots.tif")
code/imagej-macro/closeEverything.ijm
0 → 100644
View file @
17bf6fbb
// some options:
// selectWindow("Results");
// run("Close");
// selectWindow("ROI Manager");
// run("Close");
// closes all image windows (found on: http://rsb.info.nih.gov/ij/developer/macro/functions.html)
close("*");
// closes all non-image windows (found on:http://imagej.1557.x6.nabble.com/closing-non-picture-windows-from-a-macro-td3693084.html)
list = getList("window.titles");
for (i=0; i<list.length; i++) {
winame = list[i];
selectWindow(winame);
run("Close");
}
// make one function of it:
function closeEverything() {
// closes all image windows
close("*");
// closes all non-image windows
list = getList("window.titles");
for (i=0; i<list.length; i++) {
winame = list[i];
selectWindow(winame);
run("Close");
}
}
code/imagej-macro/closing-2d.ijm
0 → 100644
View file @
17bf6fbb
radius = 3;
rename("input");
run("Duplicate...", "title=closed");
run("Maximum...", "radius="+radius);
run("Minimum...", "radius="+radius);
code/imagej-macro/create-noisy-spots-uneven-background.ijm
0 → 100644
View file @
17bf6fbb
// create empty image
newImage("test", "8-bit black", 400, 400, 1);
// add offset
run("Add...", "value=10");
//
// draw uneven background
//
background = 100;
makeOval(150, 150, 100, 100);
run("Add...", "value=&background");
// remove selection (otherwise all following actions will only be executed in the selected region)
run("Select None");
// blur backgroud
run("Gaussian Blur...", "sigma=20");
//
// draw spots
//
diameter = 5;
spots = 40;
// draw spot
makeOval(170, 170, diameter, diameter);
run("Add...", "value=&spots");
// draw spot
makeOval(350, 350, diameter, diameter);
run("Add...", "value=&spots");
// remove selection (otherwise all following actions will only be executed in the selected region)
run("Select None");
// blur spots
run("Gaussian Blur...", "sigma=2");
//
// add noise
//
// add noise
run("Add Specified Noise...", "standard=5");
code/imagej-macro/create-test-image.ijm
0 → 100644
View file @
17bf6fbb
// create empty image
newImage("test", "8-bit black", 400, 400, 1);
// add offset
run("Add...", "value=25");
// draw object
setForegroundColor(164, 164, 164);
makeOval(72, 88, 14, 14);
run("Fill", "slice");
// draw object
setForegroundColor(210, 210, 210);
makeOval(168, 90, 14, 13);
run("Fill", "slice");
// remove selection (otherwise all following actions will only be executed in the selected region)
run("Select None");
// blur
run("Gaussian Blur...", "sigma=5");
// add noise
run("Add Specified Noise...", "standard=5");
code/imagej-macro/deep-conv.ijm
0 → 100644
View file @
17bf6fbb
selectWindow("line-of-dots.tif smallest structure eigenvalues");
close();
selectWindow("line-of-dots.tif largest structure eigenvalues");
close();
selectWindow("line-of-dots.tif");
run("FeatureJ Structure", "largest smallest smoothing=1 integration=1");
selectWindow("line-of-dots.tif largest structure eigenvalues");
close();
run("Bin...");
run("Duplicate...", "title=[line-of-dots.tif smallest structure eigenvalues-bin]");
run("Bin...", "x=3 y=3 bin=Average");
selectWindow("line-of-dots.tif smallest structure eigenvalues");
selectWindow("line-of-dots.tif smallest structure eigenvalues-bin");
run("Bin...", "x=3 y=3 bin=Average");
selectWindow("line-of-dots.tif");
selectWindow("line-of-dots.tif smallest structure eigenvalues");
selectWindow("line-of-dots.tif smallest structure eigenvalues-bin");
selectWindow("line-of-dots.tif smallest structure eigenvalues");
run("Duplicate...", "title=[line-of-dots.tif smallest structure eigenvalues-bin]");
run("Bin...", "x=3 y=3 bin=Average");
selectWindow("line-of-dots.tif smallest structure eigenvalues-bin");
run("FeatureJ Hessian", "largest smallest smoothing=1");
selectWindow("line-of-dots.tif smallest structure eigenvalues-bin largest Hessian eigenvalues");
selectWindow("line-of-dots.tif smallest structure eigenvalues-bin smallest Hessian eigenvalues");
selectWindow("line-of-dots.tif smallest structure eigenvalues-bin largest Hessian eigenvalues");
close();
run("Close");
code/imagej-macro/distance-measurement-2d.ijm
0 → 100644
View file @
17bf6fbb
#@File reference
#@File objects
run("Close All");
open(reference);
rename("reference");
open(objects);
rename("objects");
// select the binary image with the reference structure to which we want to compute the distances to
selectWindow("reference");
run("Duplicate...", "title=invert");
// we need to invert this, because the distance map measures distances to background pixels
run("Invert");
// run the distance map computation
run("Chamfer Distance Map", "distances=[Chessknight (5,7,11)] output=[32 bits] normalize");
rename("distances");
// measure "intensity" ( = distance ) of objects in the distance map image
run("Intensity Measurements 2D/3D", "input=distances labels=objects mean");
// show reference and objects as composite image
run("Merge Channels...", "c2=reference c4=objects create ignore");
code/imagej-macro/dots-verticalLine--convolution.ijm
0 → 100644
View file @
17bf6fbb
run("Close All");
// Load image
open("/Users/tischi/Documents/imagej-courses/data/convolution/dots-verticalLine/input01.tif");
input = getTitle();
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
run("Duplicate...", "title=dup");
run("Convolve...", "text1=[-1 +2 -1\n-1 +2 -1\n-1 +2 -1\n]");
rename("VerticalLineConvolution");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
run("Duplicate...", "title=dup");
setThreshold(4, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Invert LUT");
rename("Result");
run("Maximize");
code/imagej-macro/dots-verticalLine-horizontalLine--convolution.ijm
0 → 100644
View file @
17bf6fbb
run("Close All");
// Load image
open("/Users/tischi/Documents/imagej-courses/data/convolution/dots-verticalLine-horizontalLine/input01.tif");
input = getTitle();
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
selectWindow(input);
run("Duplicate...", "title=dup");
run("Convolve...", "text1=[-1 +2 -1\n-1 +2 -1\n-1 +2 -1\n]");
rename("VerticalLineConvolution");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
selectWindow(input);
run("Duplicate...", "title=dup");
run("Convolve...", "text1=[-1 -1 -1\n+2 +2 +2\n-1 -1 -1\n]");
rename("HorizontalLineConvolution");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
imageCalculator("Add create", "VerticalLineConvolution","HorizontalLineConvolution");
rename("HorizontalLineConvolution_Add_VerticalLineConvolution");
selectWindow("HorizontalLineConvolution_Add_VerticalLineConvolution");
run("Duplicate...", "title=dup");
setThreshold(5, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Invert LUT");
rename("Result");
run("Maximize");
code/imagej-macro/edge-of-dots--deep-convolution.ijm
0 → 100644
View file @
17bf6fbb
run("Close All");
// Load image
open("/Users/tischi/Documents/imagej-courses/data/deep-convolution/edge-of-dots/input-01.tif");
input = getTitle();
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
run("Duplicate...", "title=dup");
run("Convolve...", "text1=[-1 -1 -1\n-1 +2 -1\n-1 -1 -1\n]");
rename("SpotConvolution");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
run("Duplicate...", "title=dup");
run("Bin...", "x=2 y=2 bin=Max");
rename("SpotConvolution-MaxBin");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
selectWindow("SpotConvolution-MaxBin");
run("Duplicate...", "title=dup");
run("Convolve...", "text1=[-1 -1 -1\n+2 +2 +2\n-1 -1 -1\n]");
rename("SpotConvolution-MaxBin-HorizontalLine");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
selectWindow("SpotConvolution-MaxBin");
run("Duplicate...", "title=dup");
run("Convolve...", "text1=[-1 +2 -1\n-1 +2 -1\n-1 +2 -1\n]");
rename("SpotConvolution-MaxBin-VerticalLine");
run("Enhance Contrast", "saturated=0.35");
run("Maximize");
selectWindow("SpotConvolution-MaxBin-HorizontalLine");
run("Duplicate...", "title=dup");
run("Bin...", "x=5 y=5 bin=Max");
rename("SpotConvolution-MaxBin-HorizontalLine-MaxBin");
run("Maximize");
selectWindow("SpotConvolution-MaxBin-VerticalLine");
run("Duplicate...", "title=dup");
run("Bin...", "x=5 y=5 bin=Max");
rename("SpotConvolution-MaxBin-VerticalLine-MaxBin");
run("Maximize");
imageCalculator("Add create", "SpotConvolution-MaxBin-HorizontalLine-MaxBin","SpotConvolution-MaxBin-VerticalLine-MaxBin");
run("Enhance Contrast", "saturated=0.35");
rename("Addition");
run("Maximize");
run("Duplicate...", "title=dup");
setThreshold(17, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Invert LUT");
rename("Result");
run("Maximize");
code/imagej-macro/median-subtraction.ijm
0 → 100644
View file @
17bf6fbb
#@File image
#@Integer radius
// open
run("Close All");
open(image);
rename("input");
// median filter
run("Duplicate...", "title=median");
run("Median...", "radius=31");
// image subtraction
imageCalculator("Subtract create 32-bit", "input","median");
code/imagej-macro/object-intensity-splitting-workflow.ijm
0 → 100644
View file @
17bf6fbb
#@File image
#@Integer threshold
#@Double blurHalfWidth
// Notes
// - this only works for 8-bit images, because of 'max = 255 - threshold'
// open image
run("Close All");
open(image);
// smooth
run("Duplicate...", "title=blur");
run("Gaussian Blur...", "sigma="+blurHalfWidth);
// invert
run("Duplicate...", "title=invert");
run("Invert");
run("Enhance Contrast", "saturated=0.35");
// watershed
max = 255 - threshold; // this is because we inverted the 8-bit input image
run("Classic Watershed", "input=invert mask=None use min=0 max="+max);
run("16_colors");
code/imagej-macro/object-segmentation.ijm
0 → 100644
View file @
17bf6fbb
run("Close All"); // close all images
// get file from user (see: https://imagej.net/Script_Parameters)
#@File (label="Please select file") file
// open file
open(file);
rename("input");
// threshold
run("Duplicate...", "duplicate title=binary");
setThreshold(21, 255);
run("Convert to Mask", "method=Default background=Dark black");
// connected components labeling
run("Connected Components Labeling", "type=[8 bits]");
rename("labels");