Login  Register

Changing the line width of a freeline roi for displaying in a non-destrutive graphics overlay

Posted by Fernando Sales on Mar 31, 2008; 2:42pm
URL: http://imagej.273.s1.nabble.com/Changing-the-line-width-of-a-freeline-roi-for-displaying-in-a-non-destrutive-graphics-overlay-tp3696734.html

Hi,

I've been problems to change the line width of a freeline roi for displaying
it in a non-destrutive graphics overlay. I've made some tests based on the
example below.
http://rsb.info.nih.gov/ij/plugins/download/MultiColor_Graphic_Overlay.java

There is a piece of the code.

// Initalization
ImagePlus imp = WindowManager.getCurrentImage();
ImageCanvas ic = imp.getCanvas();
Vector list = new Vector();
int select = 4; // Parameter for select the ROi of interest
IJ.run("Add to Manager ");
IJ.runMacro("roiManager(\"Open\",\"C:\\\\Basutto1.zip\")"); // Load the roi
for ROI Manager
IJ.runMacro("roiManager(\"Select\","+select+ ")"); // Select thr roi of
interest

If the code below is used, the roi don't change the line width:

Roi roi = imp.getRoi();
addElement(list,roi,Color.red,4);
ic.setDisplayList(list);
ic.repaint();
IJ.runMacro("roiManager(\"Select\","+(select+1)+ ")");
Roi roi1 = imp.getRoi();
addElement(list,roi1,Color.green,1);
ic.repaint();

But, if i use this code (creating a ShapeRoi, adjusting the line width and
after deleting this ShapeRoi) it works:

Roi roi = imp.getRoi();
Shape shape = (Shape) roi.getPolygon();
addElement(list, shape, Color.BLACK, 2);
list.remove(shape);
addElement(list,roi,Color.red,4);
ic.setDisplayList(list);
ic.repaint();
IJ.runMacro("roiManager(\"Select\","+(select+1)+ ")");
Roi roi1 = imp.getRoi();
addElement(list,roi1,Color.green,1);
ic.repaint();
}

What kind of problem is happening? I can't see the difference between this
two pieces of code...is there somebody who could help me?

Thanks,
--
**************************************************
Fernando José Ribeiro Sales
**************************************************
Email: [hidden email]
Tel: +55(11) 82020303
**************************************************