Last active
March 29, 2019 01:13
-
-
Save lacan/74f550a21ea97f46c74f1a110583586d to your computer and use it in GitHub Desktop.
Points To Curve Distance using Distance Map imageJ Macro #ImageJ #Macro #Fiji
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Distance of points to freehand line | |
* using distance transform | |
* Inspired by work from 2011 For Dr. Giuseppe Lo Sasso | |
* | |
* Olivier BURRI November 2016 | |
* Provided as an example for a post on the ImageJ Forum | |
* http://forum.imagej.net/t/quantifying-distance-of-multiple-points-from-a-freehand-line/3287 | |
*/ | |
name = getTitle(); | |
roiManager("Show All"); | |
roiManager("Reset"); | |
run("Clear Results"); | |
// 1. Draw Curve | |
setTool("freeline"); | |
waitForUser("Draw your freehand curve and click OK"); | |
run("Fit Spline"); | |
Roi.setName("Curve"); | |
roiManager("Add"); | |
// 2. Draw Points | |
setTool("multipoint"); | |
waitForUser("Draw your points and click OK"); | |
Roi.setName("Points"); | |
roiManager("Add"); | |
// 3. Make Distance Map | |
getDimensions(x,y,c,z,t); | |
newImage(name+" - Distance Map", "8-bit white", x, y, 1); | |
setForegroundColor(0, 0, 0); | |
roiManager("Select",0); | |
run("Draw", "slice"); | |
setAutoThreshold("Default dark"); | |
run("Convert to Mask"); | |
run("Exact Euclidean Distance Transform (3D)"); | |
// 4. Measure Points | |
roiManager("Select", 1); | |
run("Measure"); | |
// Result appears in "Mean Column |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do you have any information about the "Exact Euclidean Distance Transform (3D)" plugin? I'm not seeing any online and would love to read more about it.
thanks!