Some help needed with "multi-point" selections

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

Some help needed with "multi-point" selections

gael.combe
Hello,

I would like to create "multi-points" (like multi-point selection) by
reading some coordinates in a file with a MACRO.
Is it possible ?

Gaël
Reply | Threaded
Open this post in threaded view
|

Re: Some help needed with "multi-point" selections

ved sharma
Hi Gael,

Did you look at the following function in the macro language:

makePoint(x, y)
Creates a point selection at the specified location. Create a multi-point selection by using makeSelection("point",xpoints,ypoints). Use setKeyDown("shift"); makePoint(x, y); to add a point to an existing point selection.

Ved
Reply | Threaded
Open this post in threaded view
|

Re: Some help needed with "multi-point" selections

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by gael.combe
On Nov 9, 2011, at 10:27 AM, gael combe wrote:

> Hello,
>
> I would like to create "multi-points" (like multi-point selection) by
> reading some coordinates in a file with a MACRO.
> Is it possible ?

Here is a macro that opens a list of comma, tab or space delimited coordinates as a multi-point selection:

  lines = split(File.openAsString(""), "\n");
  n = lines.length;
  xpoints = newArray(n);
  ypoints = newArray(n);
  for (i=0; i<n; i++) {
     xy = split(lines[i], ",\t ");
     xpoints[i] = parseFloat(xy[0]);
     ypoints[i] = parseFloat(xy[1]);
  }
  makeSelection("point", xpoints, ypoints);

Here is an example list:

56,67
70,38
118,29
177,35
199,81
198,149
178,187
137,209
75,210
55,170
48,123

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Some help needed with "multi-point" selections

gael.combe
Great !
thank you.

Is there a way to choose the color of the markers ?
and is there a way to mix different marker colors ?

Gael

Le 10/11/11 02:30, Rasband, Wayne (NIH/NIMH) [E] a écrit :

> On Nov 9, 2011, at 10:27 AM, gael combe wrote:
>
>> Hello,
>>
>> I would like to create "multi-points" (like multi-point selection) by
>> reading some coordinates in a file with a MACRO.
>> Is it possible ?
> Here is a macro that opens a list of comma, tab or space delimited coordinates as a multi-point selection:
>
>    lines = split(File.openAsString(""), "\n");
>    n = lines.length;
>    xpoints = newArray(n);
>    ypoints = newArray(n);
>    for (i=0; i<n; i++) {
>       xy = split(lines[i], ",\t ");
>       xpoints[i] = parseFloat(xy[0]);
>       ypoints[i] = parseFloat(xy[1]);
>    }
>    makeSelection("point", xpoints, ypoints);
>
> Here is an example list:
>
> 56,67
> 70,38
> 118,29
> 177,35
> 199,81
> 198,149
> 178,187
> 137,209
> 75,210
> 55,170
> 48,123
>
> -wayne
>