Possible bug?
Posted by Richard Mort on Nov 21, 2008; 10:35am
URL: http://imagej.273.s1.nabble.com/Possible-bug-tp3694433.html
Hi,
From a polygon selection I'd like to copy a donut shaped ROI (15 pixels
either side of selection) paste this into a new image and then overlay
the same polygon selection onto the pasted image. The polygon is not
always centred. The first macro shows the problem with this (the final
polygon does not align). I worked out how to fix this by cropping the
image first but the 'setKeyDown("alt");' command does not function
correctly in the second macro. I can't find a workaround is this a bug
or am I missing something?
//Macro 1:
newImage("Untitled", "RGB White", 1250, 1250, 1);
makePolygon(264,96,308,104,348,130,392,138,436,144,490,146,514,134,568,118,600,104,656,108,696,124,716,172,722,244,700,314,646,374,584,410,510,412,418,412,356,396,316,374,258,348,226,312,212,266,190,224,184,166,216,120);
width = getWidth();
height = getHeight();
getSelectionCoordinates(x,y);
{
makeSelection("polygon", x, y);
run("Enlarge...", "enlarge=15");
setKeyDown("alt");
makeSelection("polygon", x, y);
run("Enlarge...", "enlarge-15");
run("Copy");
close();
newImage("PatchPlot", "RGB Black", width, height, 1);
run("Paste");
run("Make Binary");
run("Median...", "radius=2");
}
//make polyline
makeSelection("polygon", x, y);
//.....................................................................
///Macro 2:
newImage("Untitled", "RGB White", 1250, 1250, 1);
makePolygon(264,96,308,104,348,130,392,138,436,144,490,146,514,134,568,118,600,104,656,108,696,124,716,172,722,244,700,314,646,374,584,410,510,412,418,412,356,396,316,374,258,348,226,312,212,266,190,224,184,166,216,120);
width = getWidth();
height = getHeight();
getSelectionCoordinates(x,y);
{
makeSelection("polygon", x, y);
run("Enlarge...", "enlarge=15");
setKeyDown("alt");
makeSelection("polygon", x, y);
run("Enlarge...", "enlarge-15");
run("Copy");
close();
newImage("PatchPlot", "RGB Black", width, height, 1);
run("Paste");
run("Make Binary");
run("Median...", "radius=2");
}
//make polyline
makeSelection("polygon", x, y);
--
Dr Richard Mort
MRC Human Genetics Unit
Western General Hospital
Crewe Road
Edinburgh
EH4 2XU, UK.
Phone: +44 (0)131 332 2471 x 3205
Fax: +44 (0)131 467 8456