Skip to content

Instantly share code, notes, and snippets.

@tferr
Created June 8, 2017 19:20
Show Gist options
  • Save tferr/70b358d62d99f1189f8b0cf387a176c0 to your computer and use it in GitHub Desktop.
Save tferr/70b358d62d99f1189f8b0cf387a176c0 to your computer and use it in GitHub Desktop.
//@LogService log
//@UIService ui
import ij.IJ
import ij.gui.Overlay
import features.ComputeCurvatures
import tracing.TracerThread
import tracing.Path
start = [330, 390, 0] // Beginning of structure to be traced (pixel coordinates)
end = [565, 50, 0] // End-point (goal) of structure to be traced (pixel coordinates)
timeout = 60 // If things go awry give up tracing after how many seconds?
timeoutCheckRate = 3000 // How many miliseconds should timeout be evaluated?
reciprocal = true // use reciprocals when calculating the cost of moving to a new point?
log.info("Retrieving sample image...")
IJ.run("ddaC Neuron (84K)")
imp = IJ.getImage()
cal = imp.getCalibration()
log.info("Calculating Hessian curvatures...")
hessian = new ComputeCurvatures(imp, cal.pixelWidth, null, true)
hessian.run();
log.info("Running tracer...")
tracer = new TracerThread(imp, 0, 255, timeout, timeoutCheckRate,
start[0], start[1], start[2], end[0], end[1], end[2],
reciprocal, true, hessian, 4, null, true)
tracer.run()
log.info("Retrieving traced path...")
result = tracer.getResult();
result.setName(imp.getTitle())
log.info("Displaying path")
overlay = new Overlay()
result.drawPathAsPoints(overlay)
imp.setOverlay(overlay)
ui.showDialog(result.toString(), "Path details")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment