Hello,
I need to take a data table made up of two columns, X and Y, select several rows of the data table and name the selection. This corresponds to select twenty rectangles in the x-y cartesian space and name them with a number (from 1 to 20) (I am working with an image).
I wrote a script but it does not work. I think I need to solve two problems: 1) how can I use a parameter, see X1, X2, .., in the argument of 'select where'? 2) how can I use a parameter, see n_patch, in the argument of 'name selection in column'?
Many thanks.
Here is the script:
dt = Current Data Table();
X0 = 2332;
Y0 = 558;
n_patch = 0;
delta_x = 100;
delta_y = 100;
dist_y = 488;
dist_x = 656;
L_x = 500;
L_y = 500;
For( n_x = 1, n_x <= 4, n_x++,
For( n_y = 1, n_y <= 5, n_y++,
Xc = X0 - (n_x - 1) * (dist_x) + L_x / 2;
Yc = Y0 + (n_y - 1) * (dist_y) + L_y / 2;
n_patch = n_patch + 1;
X1 = Xc - delta_x;
X2 = Xc + delta_x;
Y1 = Yc - delta_y;
Y2 = Yc + delta_y;
dt << Row Selection(
Select where( (:X >= X1 & :X <= X2) & (Y >= Y1 & Y <= Y2) )
);
dt << Name Selection in Column(
Column Name( "Patch#" ),
Selected( ("n_patch") ),
Unselected( "" )
);
)
);