Posted by
RussellP on
Feb 21, 2015; 9:20am
URL: http://imagej.273.s1.nabble.com/analyzeskeleton-tp5011720.html
Hi
I had successfully been using a image analyzeskeleton plugin to skeletonize and then produce two output files, results and branch information. When I run the following code from inside the macro editor, I get two files saved, BranchInformation_1.txt and resultstable_2, and they are different. i.e. BranchInfo contains headings (skeleton, branch length, vx,vy etc) and resultstable_2 has (#branches, #junctions, #endpoint etc).
I call the macro from a windows cmd prompt with
java -jar C:\Users\Russell\Downloads\fiji-win32\Fiji.app\jars\ij-1.49m.jar -batch Macro1
When running it as part of a batch file, it saves the two output files, but they have identical content, that is both file are equal to BranchInformation_1.txt.
I can go back and forwards confirming that the content changes with whether it is called from a cmd prompt or not.
So, my questions is whether there is a way to reliably save the two files that are created by plugin analyse skeleton? Or am I missing something?
Thanks in advance.
Russell
arg_array = newArray(3) // I am planning to pass some arguments in the future
arg_array[0] = 1;
arg_array[1] = 2;
name1 = "BranchInformation_" + arg_array[0] +".txt";
name2 = "ResultsTable_" + arg_array[1] +".txt";
open("C:\\c6work \\Test.jpeg"); // this is the image I want to analyse
run("8-bit");
run("Auto Threshold", "method=Huang ignore_black ignore_white white");
run("Auto Threshold", "method=Default");
run("Skeletonize (2D/3D)");
wait(2000); // added because I thought a delay might help
run("Analyze Skeleton (2D/3D)","prune=none show");
saveAs("results", "C:\\Users\\Russell\\Downloads\\fiji-win32\\Fiji.app\\output\\macros\\" + name2);
saveAs("measurements", "C:\\Users\\Russell\\Downloads\\fiji-win32\\Fiji.app\\output\\macros\\" + name1);
//end of macro
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html