Analyze skeleton 2D/3D not working in headless mode

Tags: #<Tag:0x00007fd542ef3a20>


I am trying to run a macro in headless mode. The macro runs fine when launched from ImageJ itself.

It works almost fine in headless mode except it does not seem to recognise the Analyze skelton 2D/3D plugin. I got the following error:

at sc.fiji.analyzeSkeleton.AnalyzeSkeleton_.dialogItemChanged(
at sc.fiji.analyzeSkeleton.AnalyzeSkeleton_.createSettingsDialog(

Any idea what might be causing this and how to fix it?


It seems the code explicitly checks some options of the GUI dialog that, in your case, does not exist.

Let me modify that part and make a release.


OK, I made a new release. Please try it out and let me know if it works now.


Awesome! no error message anymore!

But I cannot find how to retrieve the data from the analysis. My code goes like this:

	run("Analyze Skeleton (2D/3D)", "prune=none calculate");
selectWindow("Longest shortest paths");
selectWindow("Tagged skeleton");

// Get the skeleton variables
nLateral = 0;
primLength = 0;
meanSkelLength = 0;
maxSkelLength = 0;
maxPrimLength = 0;
nBranches = 0;
nEndPoints = 0;
for(i = 0; i < nResults; i++){
	if(getResult("Longest Shortest Path", i) > maxPrimLength){
		maxPrimLength = getResult("Longest Shortest Path", i);
		primLength = getResult("Longest Shortest Path", i);
		nLateral = getResult("# Junctions", i);
		nBranches = getResult("# Branches", i);
		nEndPoints = getResult("# End-point voxels", i);			
		meanSkelLength = getResult("Average Branch Length", i);
		maxSkelLength = getResult("Maximum Branch Length", i);
run("Clear Results");

but print(nResults) returns 0. Are the results stored elsewhere?


I guess it has to do with collecting the results of a window when you are in headless mode. I would rather do it with an equivalent script. Have you tried converting your macro to any of the available scripting languages?