move displayed area to find a marker

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

move displayed area to find a marker

Csaba DÁVID
Hi,i would like write a macro to find markers (point selection ROIs) that were set earlier on an image. I would like to see them on the zoomed image. Unfortunately, when i click on a ROI in the ROI manager, it can set the layer, but it cannot set the location. The same if I do it with a macro. Is there any command, which moves the displayed are to specified coordinates? It would be extremely useful if i could jump from one ROI location to the next one without zooming out and zooming in again.Csaba

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

Re: move displayed area to find a marker

Michael Schmid
Hi Csaba,

here is a simple macro that takes a point selection with several points
and zooms on each of them, one after the other, each time you press the
F8 key.
(you have to install the macro or include it in your StatupMacros)

//global variables, these are remembered
var xpoints = newArray(0);  //empty array
var ypoints;
var pointIndex;
var zoom = 18; //actual zoom level will be slightly less, 16x

macro "zoomOnPoints [F8]" {
   if (pointIndex >= xpoints.length) {
     if (selectionType() != 10)
       exit("Multipoint selection needed to start");
     getSelectionCoordinates(xpoints, ypoints);
     pointIndex = 0;
   }
   getLocationAndSize(x, y, width, height); //window size
   x = xpoints[pointIndex];
   y = ypoints[pointIndex];
   w = width/zoom;
   h = height/zoom;
   makeRectangle(x-w/2, y-w/2, w, h);
   run("To Selection");  //zoom to selection
   run("Restore Selection");
   pointIndex++;
}


Michael
________________________________________________________________

> On 14/09/2017 09:25, Csaba DÁVID wrote:
>  > Hi,i would like write a macro to find markers (point selection ROIs)
> that were set earlier on an image. I would like to see them on the
> zoomed image. Unfortunately, when i click on a ROI in the ROI manager,
> it can set the layer, but it cannot set the location. The same if I do
> it with a macro. Is there any command, which moves the displayed are to
> specified coordinates? It would be extremely useful if i could jump from
> one ROI location to the next one without zooming out and zooming in
> again.Csaba

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html