analyzeskeleton

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

analyzeskeleton

RussellP
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
Reply | Threaded
Open this post in threaded view
|

Re: analyzeskeleton

Ignacio Arganda-Carreras
Hello Russel,

I've been playing with your macro and it looks like an ImageJ bug. For some
reason, while running the macro from command line only the branch
information table gets displayed, and that's why it only saves that
information.

You might want to use a script instead. It's a bit of more work but you'll
have direct access to all results and can call it the same way as a macro:

http://fiji.sc/AnalyzeSkeleton#Using_silent_mode_from_scripts

Best,

ignacio

On Sat, Feb 21, 2015 at 10:20 AM, Russell Price <
[hidden email]> wrote:

> 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
>



--
Ignacio Arganda-Carreras, Ph.D.
Seung's lab, 46-5065
Department of Brain and Cognitive Sciences
Massachusetts Institute of Technology
43 Vassar St.
Cambridge, MA 02139
USA

Phone: (001) 617-324-3747
Website: http://bioweb.cnb.csic.es/~iarganda/index_EN.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html