Line ROIs and Fit: a few "how-to" questions in ImageJ Javascript

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

Line ROIs and Fit: a few "how-to" questions in ImageJ Javascript

lechristophe
Hi,

I'm trying to convert a macro into javascript. On a side note, this is
mainly because:
- the macro loops on ROIs in the ROI manager, which prevents benefiting
from the speed of the macro batch mode,
- the macro gathers new images iteratively into a stack during processing,
which is only doable via copy/paste ( I think), and is painfully slow
without batch mode.

In a word, the macro takes thick straight lines from the Roi Manager
(several dozens of them), fits a gaussian along the line profile, reports
the fit parameters and collect all fits (Fit windows) as a stack. So, there
are a few things I'm trying to do and I'm not sure how to do them
efficiently and elegantly (leveraging direct access to the ImageJ API via
javascript).

1- I have the ROI manager filled with straight line, 20-pixels wide ROIs.
I'd like to get them as Line objects, in order to use the getPixels method
and get the profiles along the thick line. getPixels does not seem to exist
for general ROI objects, that are retrieved from the RoiManager with
methods such as getRoisAsArray. How can I get Line objects? For now I use a
ProfilePlot object to retrieve the pixel values along the lines, which
seems a bit of an overkill.

2- How can I retrieve the Fit plot window from a script, ideally without
displaying it, similar to what can be done with getPlot method of the
PlotProfile object? That would allow to rapidly collect them into a stack,
but seems to be absent from the CurveFitter or Fitter classes.
Alternatively, if I want to build the fit plot by myself, how can I
retrieve the fit curve (as an x and y array of points) from a CurveFitter
object? Do I have to calculate them manually from the fit equation?

Thanks for your help,

Christophe

--
Christophe Leterrier
Researcher
Axonal Domains Architecture Team
CRN2M CNRS UMR 7286
Aix Marseille University, France

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

Re: Line ROIs and Fit: a few "how-to" questions in ImageJ Javascript

bnorthan
Hi Christophe

Someone was asking about using CurvePlotter API in beanshell yesterday.
Maybe this will be helpful?? It is a beanshell script that uses the
CurvePlotter API and RoiManager API directly... if it works it should be
easy to convert to javascript.

ROI version...

https://github.com/bnorthan/RogueImageJPlugins/blob/master/CurveFitter_BeanShell/CurveFitterWithROI.bsh<https://github.com/bnorthan/RogueImageJPlugins/blob/master/CurveFitter_BeanShell/CurveFitter.bsh>

Simple version...

https://github.com/bnorthan/RogueImageJPlugins/blob/master/CurveFitter_BeanShell/CurveFitter.bsh


On Tue, Apr 1, 2014 at 3:45 AM, Christophe Leterrier <
[hidden email]> wrote:

> Hi,
>
> I'm trying to convert a macro into javascript. On a side note, this is
> mainly because:
> - the macro loops on ROIs in the ROI manager, which prevents benefiting
> from the speed of the macro batch mode,
> - the macro gathers new images iteratively into a stack during processing,
> which is only doable via copy/paste ( I think), and is painfully slow
> without batch mode.
>
> In a word, the macro takes thick straight lines from the Roi Manager
> (several dozens of them), fits a gaussian along the line profile, reports
> the fit parameters and collect all fits (Fit windows) as a stack. So, there
> are a few things I'm trying to do and I'm not sure how to do them
> efficiently and elegantly (leveraging direct access to the ImageJ API via
> javascript).
>
> 1- I have the ROI manager filled with straight line, 20-pixels wide ROIs.
> I'd like to get them as Line objects, in order to use the getPixels method
> and get the profiles along the thick line. getPixels does not seem to exist
> for general ROI objects, that are retrieved from the RoiManager with
> methods such as getRoisAsArray. How can I get Line objects? For now I use a
> ProfilePlot object to retrieve the pixel values along the lines, which
> seems a bit of an overkill.
>
> 2- How can I retrieve the Fit plot window from a script, ideally without
> displaying it, similar to what can be done with getPlot method of the
> PlotProfile object? That would allow to rapidly collect them into a stack,
> but seems to be absent from the CurveFitter or Fitter classes.
> Alternatively, if I want to build the fit plot by myself, how can I
> retrieve the fit curve (as an x and y array of points) from a CurveFitter
> object? Do I have to calculate them manually from the fit equation?
>
> Thanks for your help,
>
> Christophe
>
> --
> Christophe Leterrier
> Researcher
> Axonal Domains Architecture Team
> CRN2M CNRS UMR 7286
> Aix Marseille University, France
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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