Centre and zoom on multiple ROI's

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

Centre and zoom on multiple ROI's

Michael Doube-2
Hi All,

I'm writing a macro that parses a CSV file containing a list of x,y
coordinates (7-800 points), then draws an ROI and takes some
measurements for each point.

I'd like to check whether each ROI is landing in the right spot in the
image, so would like to track the ROI at 100% zoom. The coordinates are
spread over a much larger area than my monitor can display at 100%.  
What I can imagine is the image window zooming to 100% and adjusting the
image's position as each new ROI is drawn, to keep the ROI in the centre
of the window, as the image seemingly moves below the ROI.

Is there any way to do this? I can see there is a getZoom() macro
function, but no setZoom(). I can get the ROI position with
getSelectionBounds(), but how do I set the image position relative to
the window? What would be great is a setZoom() function with x, y and
zoom arguments that would zoom and shift the image each time.

Cheers,

Mike

--
Michael Doube  BPhil BVSc MRCVS
PhD Student
Dental Institute
Queen Mary, University of London
New Rd
London  E1 1BB
United Kingdom

Phone +44 (0)20 7377 7000 ext 2681
Reply | Threaded
Open this post in threaded view
|

Re: Centre and zoom on multiple ROI's

Gabriel Landini
On Wednesday 11 October 2006 14:18, Michael Doube wrote:
> Is there any way to do this? I can see there is a getZoom() macro
> function, but no setZoom().

You could use the macro recorder to find out what command are available with
the zoom menu entries:
run("In");
run("Out");
run("View 100%");
run("Original Scale");
run("To Selection");

> I can get the ROI position with
> getSelectionBounds(), but how do I set the image position relative to
> the window? What would be great is a setZoom() function with x, y and
> zoom arguments that would zoom and shift the image each time.

Create a selection and use:
run("To Selection");

I hope it helps,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Centre and zoom on multiple ROI's

Michael Doube-2
Thanks Gabriel,

I got it to go by drawing a big rectangular ROI centred on the
measurement point and zooming in on that (to 200%) with run("To
Selection"), then drawing my little circular ROI for measurement within
the zoomed field. I can now pause and classify the tissue, and adjust
the little circular ROI's position if necessary.

The code is simple, it goes like this:

makeRectangle(x-120, y-120, 255, 255);
run("To Selection");
makeOval(x-5, y-5, 10, 10);

where x and y are the centre coordinates of the point of interest.

Cheers,

Mike


Gabriel Landini wrote:

> On Wednesday 11 October 2006 14:18, Michael Doube wrote:
>  
>> Is there any way to do this? I can see there is a getZoom() macro
>> function, but no setZoom().
>>    
>
> You could use the macro recorder to find out what command are available with
> the zoom menu entries:
> run("In");
> run("Out");
> run("View 100%");
> run("Original Scale");
> run("To Selection");
>
>  
>> I can get the ROI position with
>> getSelectionBounds(), but how do I set the image position relative to
>> the window? What would be great is a setZoom() function with x, y and
>> zoom arguments that would zoom and shift the image each time.
>>    
>
> Create a selection and use:
> run("To Selection");
>
> I hope it helps,
>
> Gabriel
>  

--
Michael Doube  BPhil BVSc MRCVS
PhD Student
Dental Institute
Queen Mary, University of London
New Rd
London  E1 1BB
United Kingdom

Phone +44 (0)20 7377 7000 ext 2681