ROI scaling function or macro help
Posted by
Avi Leftin on
URL: http://imagej.273.s1.nabble.com/ROI-scaling-function-or-macro-help-tp5012084.html
Hi,
I am trying to write a macro that scales a freehand ROI in place multiple times on an image.
I would like to use a command such as the following:
run("Scale... ", "x=0.80 y=0.80 centered");
However, in my macro I want to be able to input double/numeric values for the x and y scale factors, while leaving the center position fixed in order to use a loop.
I found the following code snippet online that allows numeric scale factors for ROI:
function scaleROI(factor) {
type = selectionType();
getSelectionCoordinates(x, y);
for (i = 0; i < x.length; i++) {
x[i] = x[i] * factor;
y[i] = y[i] * factor;
}
makeSelection(type, x, y);
}
This does work but does not have a variable specifying the ROI center. Therefore, the ROI is scaled, but shifted because the center coordinates are also transformed.
Any suggestions?
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html