Macro: Zoom in without changing window size (tiled display)
Posted by mattjackson on Jan 28, 2015; 8:49pm
URL: http://imagej.273.s1.nabble.com/Macro-Zoom-in-without-changing-window-size-tiled-display-tp5011359.html
Hello,
I'm having some difficulties with a macro. I'm trying to do something that should be quite easy, and I would appreciate some help (thank you in advance).
The setup: I have a set of tiled fluorescence images. These are very large images (225 20X images of a well in a 96-well plate stitched together). I've identified nuclei via the particle analyzer, and they're arrayed in the ROI manager. I need to zoom in to each ROI on each channel so I can make calls of phenotype via a dialogue box, all of which is written.
The problem: When zooming in to the ROI, the channel windows expand, and they are no longer tiled (I can only see a single channel at a time). Here's the script, as well as attempts to fix this.
Script 1: There's a for loop here (index i) looping over the ROIs
selectWindow("Stitched_DAPI.tif");
roiManager("select",i);
run("To Selection");
run("Out [-]");
run("Out [-]");
run("Out [-]");
run("Out [-]");
run("Out [-]");
run("Out [-]");
run("Out [-]");
run("Out [-]");
run("Out [-]");
Script 2: Tried to define the window size with a rectangle selection and zoom into that. The rectangle was near the ROI but not overlaying. There's some error there, but the windows still expand.
selectWindow("Stitched_DAPI.tif");
roiManager("select",i);
Roi.getCoordinates(xroi, yroi);
Array.getStatistics(xroi, xmin, xmax);
Array.getStatistics(yroi, ymin, ymax);
xcenter = (xmax - xmin)/2 + xmin;
ycenter = (ymax - ymin)/2 + ymin;
recx = xcenter - 230;
recy = ycenter + 260;
makeRectangle(recx, recy, 460, 520);
run("To Selection");
Further attempts: Tried to trick ImageJ by moving the window off screen (to negative X,Y values) and then do the zooming, but the window still expanded. Also, running Tile again doesn't work because it zooms the image out again.
Anybody have an idea how to accomplish this in an ImageJ macro?
Thanks,
Matt Jackson