// This macro demonstrates how to use the Roi.setAntiAlias() // macro function added in ImageJ 1.52p. // Author: Stein Rorvik run("Close All"); newImage("temp", "RGB black", 70, 200, 1); color = "yellow"; fontsize = 12; xPos = 10; yPos = 10; length = 20; width = 2; style = "notched small"; setColor(color); setJustification("left"); //arrow makeArrow(xPos*1, yPos*1, xPos*1+length, yPos*1, style); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeArrow(xPos*4, yPos*1, xPos*4+length, yPos*1, style); Roi.setAntiAlias(false); Overlay.addSelection(color,width); length = 15; //oval makeOval(xPos*1, yPos*2, length, length); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeOval(xPos*4, yPos*2, length, length); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //regular rectangle makeRectangle(xPos*1, yPos*4, length, length); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeRectangle(xPos*4, yPos*4, length, length); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //rounded rectangle makeRectangle(xPos*1, yPos*6, length, length, 5); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeRectangle(xPos*4, yPos*6, length, length, 5); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //rotated rectangle makeRotatedRectangle(xPos*1, yPos*9, xPos*1+length, yPos*8+length, length*0.7); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeRotatedRectangle(xPos*4, yPos*9, xPos*4+length, yPos*8+length, length*0.7); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //ellipse makeEllipse(xPos*1, yPos*11, xPos*1+length, yPos*10+length, 0.7); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeEllipse(xPos*4, yPos*11, xPos*4+length, yPos*10+length, 0.7); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //polygon makePolygon(20,123,30,127,23,131,7,131,7,124,13,126); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makePolygon(50,123,60,127,53,131,37,131,37,124,43,126); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //segmented line makeLine(7,140,16,144,21,139,26,144,21,151,11,150,7,152,7,151); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeLine(37,140,46,144,51,139,56,144,51,151,41,150,37,152,37,151); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //normal line makeLine(xPos*1, yPos*16, xPos*3, yPos*17, width); Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeLine(xPos*4, yPos*16, xPos*6, yPos*17, width); Roi.setAntiAlias(false); Overlay.addSelection(color,width); //text ROI setFont("SanSerif", fontsize, "bold"); makeText("test", xPos*1, yPos*17) Roi.setAntiAlias(true); Overlay.addSelection(color,width); makeText("test", xPos*4, yPos*17) Roi.setAntiAlias(false); Overlay.addSelection(color,width); //direct text instead of ROI options = "antialiased,bold"; setFont("SanSerif", fontsize, options); Overlay.drawString("test", xPos*1, yPos*20); options = "aliased,bold"; setFont("SanSerif", fontsize, options); Overlay.drawString("test", xPos*4, yPos*20); run("Flatten"); run("In [+]"); run("In [+]"); run("In [+]"); run("Select None");