macro curve fitting

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

macro curve fitting

Jeff Spector-2
Greetings,
 I would like to create a macro that fits data from a linescan. I know I
can get the XY values and then use the fitting functions. My quick and
dirty way to make macros is to always start with the macro recorder.
However, it seems to no record the Data->addFit from the plot window. If i
run the recorder, draw a line, plot the profile and then hit  Data>>Add
Fit  choose gaussian and hit "ok" the reorder only gives me the following :

makeLine(93, 72, 121, 138);
run("Plot Profile");
Plot.setStyle(1, "blue,#a0a0ff,1.0,Line");

It seems to be recording the drawing of the fit line, but not the action of
the Add Fit button. Is there a way to add this in a macro, or am I better
off just extracting the plot profile values and doing the fits directly on
that data?

Thanks.

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

Re: [EXTERNAL] macro curve fitting

vbindokas
this is my FWHM fitting macro:

ti=getTitle();
profile = getProfile();

getPixelSize(unit, pixelWidth, pixelHeight);

x=newArray(profile.length);
y=newArray(profile.length);

   for (i=0; i<profile.length; i++){
       x[i]=i*pixelWidth;
       y[i]=profile[i];
   }
Fit.logResults;
Fit.doFit("Gaussian", x, y);
d=Fit.p(3);
print(ti);
print("FWHM is:", 2.3548*d);


cheers




On 1/26/2021 1:06 PM, Jeff Spector wrote:

> Greetings,
>   I would like to create a macro that fits data from a linescan. I know I
> can get the XY values and then use the fitting functions. My quick and
> dirty way to make macros is to always start with the macro recorder.
> However, it seems to no record the Data->addFit from the plot window. If i
> run the recorder, draw a line, plot the profile and then hit  Data>>Add
> Fit  choose gaussian and hit "ok" the reorder only gives me the following :
>
> makeLine(93, 72, 121, 138);
> run("Plot Profile");
> Plot.setStyle(1, "blue,#a0a0ff,1.0,Line");
>
> It seems to be recording the drawing of the fit line, but not the action of
> the Add Fit button. Is there a way to add this in a macro, or am I better
> off just extracting the plot profile values and doing the fits directly on
> that data?
>
> Thanks.
>
> --
> ImageJ mailing list: https://urldefense.com/v3/__http://imagej.nih.gov/ij/list.html__;!!OaZRxjSJGsACmqMyc8s!Z0sbqgEAo0Coe3LGxkJtciS0K8D5OGkGzMPdFBl5dhQLq5R7U0kISFdXssnfHP1RAxioTN8$
>
> ----------------------------------------------------------------------
> “This message was received from outside of the organization. Please pay special attention and practice care when clicking on any links, or providing any information to the sender. Cyber attacks commonly attempt to trick you in to thinking the sender is a reputable individual who you can trust.”

--
     __

     Vytas Bindokas, M.S., Ph.D.
     Research Assoc. Prof.,
     Director, BSD Light Microscopy Core Facility
     phone: 773-702-4875 [alt's: 773-834-9040 or 773-834-2639]

          [address for letters ONLY (see shipping addr below):]
     Dept Pharmacol Physiol Sci MC0926
     947 E 58th Street
     The University of Chicago
     Chicago IL 60637
     Room Abbott 129


     shipping address (main KCBD site):
     V. Bindokas
     900 E 57th Street
     KCBD room 1250, Microscopy Core
     The University of Chicago
     Chicago IL 60637


     email [hidden email]
     web site for LMCF:
     http://digital.uchicago.edu

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