Problem with getting XStart

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

Problem with getting XStart

AndersS
Hello!

I have a problem when I try to analyze my images in ImageJ.
I run the line

run("Analyze Particles...", "  show=Outlines display clear record");

and save my results

saveAs("Results", imageName+".txt");

But when I extract the give XStart from the results it gives me what X is where YStart starts.
example image:


Is there a solution to this problem, or have I just done something wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting XStart

Jan Eglinger
Hi AndersS,

On 17.07.2014, 5:00 PM, AndersS wrote:

> I have a problem when I try to analyze my images in ImageJ.
> I run the line
>
> run("Analyze Particles...", "  show=Outlines display clear record");
>
> and save my results
>
> saveAs("Results", imageName+".txt");
>
> But when I extract the give XStart from the results it gives me what X is
> where YStart starts.
> example image:
> <http://imagej.1557.x6.nabble.com/file/n5008803/wat.jpg>
>
> Is there a solution to this problem, or have I just done something wrong?
>

XStart and YStart serve the purpose of re-creating a particle from a
mask after "Analyze Particles", since the point (XStart, YStart) is
guaranteed to be *inside* the particle.

What you want is most likely the dimensions of the bounding rectangle
that you get by activating 'Bounding rectangle' in the 'Analyze > Set
Measurements...' dialog. It will record BX and BY, the coordinates of
the upper left corner of the rectangle, with BX being the value you want.

See the documentation:
http://imagej.nih.gov/ij/docs/guide/146-30.html#sub:Set-Measurements...

Cheers,
Jan

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

Re: Problem with getting XStart

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by AndersS
On Jul 17, 2014, at 11:00 AM, AndersS wrote:

> Hello!
>
> I have a problem when I try to analyze my images in ImageJ.
> I run the line
>
> run("Analyze Particles...", "  show=Outlines display clear record");
>
> and save my results
>
> saveAs("Results", imageName+".txt");
>
> But when I extract the give XStart from the results it gives me what X is
> where YStart starts.
> example image:
> <http://imagej.1557.x6.nabble.com/file/n5008803/wat.jpg>

(XStart,YStart) are the coordinates of the first boundary point of particles found by the particle analyzer, not the coordinates of the left-most point. The following example macro finds the left-most points. If a particle has multiple left-most points, the top one is used.

The particle analyzer's "Record starts" option is obsolete. It has been replaced by the "Overlay Outlines" (used by this macro) and "Add to Manager options.

  run("Blobs (25K)");
  setAutoThreshold("Default");
  run("Analyze Particles...", "size=100 show=[Overlay Outlines] exclude");
  n = Overlay.size;
  run("Clear Results");
  for (i=0; i<n; i++) {
      Overlay.activateSelection(i);
      getSelectionCoordinates(xpoints, ypoints);
      x=9999; y=9999;
      for (j=0; j<xpoints.length; j++) {
         if (xpoints[j]<=x) {
            x = xpoints[j];
            y = ypoints[j];
         }
      }
      setResult("X", i, x);
      setResult("Y", i, y);
   }
   updateResults;


> Is there a solution to this problem, or have I just done something wrong?
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Problem-with-getting-XStart-tp5008803.html
> Sent from the ImageJ mailing list archive at Nabble.com.

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

Re: Problem with getting XStart

AndersS
In reply to this post by AndersS
Thank you both for your answers! They were very helpful.