Using the BAR tool in a macro...writing

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

Using the BAR tool in a macro...writing

Ethan Cohen
Using Fiji, I can run the BAR tool find Peaks tool from the macro recorder, and find 1-D peaks.
This executes fine in ImageJ macro language..

However, the macro recorder does not pick up pressing the "List" or "Save" buttons. So I cannot see the arguments passed.

Q1: Could somebody provide an example of ImageJ macro code with BAR find Peaks that some how accesses these SAVE/LIST buttons?

Thanks,

Ethan.

Ethan Cohen, Ph.D.
Div of Biomedical Physics,
Office of Science and Engineering Labs,
FDA Center for Devices and Radiological Health
White Oak Federal Res Ctr.
10903 New Hampshire Ave.
Silver Spring, MD 20993
Office: 301-796-2485
Lab:301-796-2762
Fax: 301-796-9927
Cell: 301-538-7544

Excellent customer service is important to us. Please take a moment to provide feedback regarding the customer service you have received: https://www.research.net/s/cdrhcustomerservice?O=700&D=740&B=740&E=&S=E

"THIS MESSAGE FROM ETHAN COHEN IS INTENDED ONLY FOR THE USE OF THE PARTY TO WHOM IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL, AND PROTECTED FROM DISCLOSURE UNDER LAW. If you are not the addressee, or a person authorized to deliver the document to the addressee, you are hereby notified that any review, disclosure, dissemination, copying, or other action based on the content of this communication is not authorized. If you have received this document in error, please immediately notify the sender immediately by e-mail or phone."
________________________________


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Using the BAR tool in a macro...writing

Emanuele Martini
This post was updated on .
Hi Ethan,
I used "Find Peaks" once in a plugin writed in jython.
I used this workaround to retrieve the peaks values:
I get the Result table created by "Find Peaks"
in jython is:

1)retrieve the window of peak plot
MAX_plot=WindowManager.getWindow("Peaks in "+tit)
where tit is the title of the curve analyzed by "Find Peaks"


2) retrieve the *Results Table* of your find plot
MAX_rt_temp=MAX_plot.getResultsTable()

3) now you can access the peaks and any values like that
a=MAX_rt_temp.getValueAsDouble(column_index,row_index)


4) and/or if you want show the peaks like that
MAX_rt_temp.show("res peaks")
and then if you want save as you save resulttable

I use python/jython and I really don't know how to "translate" in Imagej Macro Language, since i use the macro language very few.

hoping to be in someway useful,
have a nice day
Emanuele
Image Analyst @Ifom-IEO research campus -MI-
Reply | Threaded
Open this post in threaded view
|

Re: Using the BAR tool in a macro...writing

Tiago Ferreira-2
In reply to this post by Ethan Cohen
Dear Ethan,

Cohen, Ethan D <Ethan.Cohen@...> writes:

> Using Fiji, I can run the BAR tool find Peaks tool from the macro recorder,
> and find 1-D peaks. This executes fine in ImageJ macro language..
>
> However, the macro recorder does not pick up pressing the "List" or "Save"
> buttons. So I cannot see the arguments passed.
>
> Q1: Could somebody provide an example of ImageJ macro code with BAR Find Peaks
> that some how accesses these SAVE/LIST buttons?
>
>
[Re-posting to the list: For whatever reason previous message went astray]

I just pushed an updated version that includes a "List values" option, that will
display the  Plot's table[1]. To save it programmatically, you can append the
following to your macro:

    selectWindow("Plot Values");
    saveAs("Results", "Path/to/Output/Directory/Plot Values.csv");
    run("Close");

In case you need to access tables from other Plot Windows:
The option to display the data table for _ALL_ IJ plots is set in 'Edit>Options>
Profile Plot Options' ("List values" checkbox). So, it can be set using the Macro
recorder. Here is an example:

// Set the "PlotWindow.listValues" option using Edit>Options>Profile Plot Options
run("Profile Plot Options...",
    "width=450 height=200 minimum=0 maximum=0 list interpolate");

// Generate your plot. The plot table will be displayed
run("Find Peaks",
    "min._peak_amplitude=20 min._peak_distance=0 min._value=NaN max._value=NaN");

// Save the plot's data table
selectWindow("Plot Values");
saveAs("Results", "/Path/to/Output/Directory/Plot Values.csv");

// Unset the "PlotWindow.listValues" option so it won't affect future plots.
// Note the omission of the keyword "list"
run("Profile Plot Options...",
    "width=450 height=200 minimum=0 maximum=0 interpolate");


Again, this should work for IJ generated plot.
-tiago

[1] https://github.com/tferr/Scripts/commit/ca5fe4a

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