Login  Register

import xy coordinates

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

import xy coordinates

Pouletaut
2 posts
Dear IJ users,

is there a way to import a xy coordinates file in order to plot and
overlay a contour on a image ?
The file consists of two columns of float coordinates in ASCII format,
gathering ordered points of a contour.

Any help will be greatly appreciated

--
Philippe
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: import xy coordinates

dscho
1631 posts
Hi Philippe,

On Mon, 24 Oct 2011, Pouletaut wrote:

> is there a way to import a xy coordinates file in order to plot and
> overlay a contour on a image ? The file consists of two columns of float
> coordinates in ASCII format, gathering ordered points of a contour.

The easiest method would probably to write a macro. It would use the
following functions:

- File.openAsString() (or File.openAsRawString() if the file is larger
  than 5000 bytes) to read in the contents

- split() to separate the lines

- newArray() to make one array for the x and one for the y coordinates

- a loop iterating over all the lines

- inside the loop another split() to separate the numbers

- parseFloat() to convert the textual representation of the numbers into
  numeric values

- after the loop, makeSelection() to turn the arrays into a ROI

- run() to call the "Add selection..." plugin to add the ROI to the overlay

Ciao,
Johannes
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: import xy coordinates

Pouletaut
2 posts
Hi Johannes,

many thanks for your quick answer.
I've found a plugin which does all the job : ROI_Importer.java

Have a nice day.

Yours faithfully
Philippe

Johannes Schindelin <[hidden email]> a écrit :

> Hi Philippe,
>
> On Mon, 24 Oct 2011, Pouletaut wrote:
>
>> is there a way to import a xy coordinates file in order to plot and
>> overlay a contour on a image ? The file consists of two columns of float
>> coordinates in ASCII format, gathering ordered points of a contour.
>
> The easiest method would probably to write a macro. It would use the
> following functions:
>
> - File.openAsString() (or File.openAsRawString() if the file is larger
>   than 5000 bytes) to read in the contents
>
> - split() to separate the lines
>
> - newArray() to make one array for the x and one for the y coordinates
>
> - a loop iterating over all the lines
>
> - inside the loop another split() to separate the numbers
>
> - parseFloat() to convert the textual representation of the numbers into
>   numeric values
>
> - after the loop, makeSelection() to turn the arrays into a ROI
>
> - run() to call the "Add selection..." plugin to add the ROI to the overlay
>
> Ciao,
> Johannes
>



--
*--------------------------------------*
Philippe POULETAUT

Université de Technologie de Compiègne
Dpt Génie Biologique. UMR CNRS 6600
BP 20529
F 60205 Compiègne Cedex - France

bureau : RD201c (Centre de Recherches)
Tél.: +33 (0)3.44.23.44.23 poste  53.11 (CR)

courrier : CR / GB
courriel : [hidden email]
site : http://www.utc.fr/~pouletau/
fax : 03.44.20.79.04
*--------------------------------------*