Issue with setSlice

Posted by SimonBohn on
URL: http://imagej.273.s1.nabble.com/Issue-with-setSlice-tp5013105.html

Hello,

I'm trying to write a macro that cycles through all the slices of an avi stack and applies a plugin to them. Here's my code:

  selectWindow("CIMG2136.avi");
  s = nSlices
  print(s)
  for (i = 1; i < s; i++) {
  setSlice(i);
  makeSelection("point", newArray(782,822,1050,1016), newArray(852,298,298,902));
  selectWindow("square.png");
   makeSelection("point", newArray(272,272,583,583), newArray(364,53,53,364));
  run("Landmark Correspondences", "source_image=CIMG2136.avi template_image=square.png transformation_method=[Least Squares] alpha=1 mesh_resolution=32 transformation_class=Perspective interpolate");
  }

The error message I get when I run this is

Argument must be >=1 and <=1 in line 6
setSlice (i<)>;

What am I doing wrong, or is there something wrong with setSlice? Thanks in advance!