Hi!
I am new with ImageJ plugins and I have a little problem. Inside a plugin, I would like to draw colored circles on a grey levels image such that the gray level image could be saved, for example as tif, with the circles too. Does anyone know the good class or the way I could do that? Thank you! Alessandra |
Hi Alessandra,
Here is a suggestion: 1: Change the type of the gray image to a color image, that should make the input to your plugin a ColorProcessor. 2: ColorProcessor has a method: setColor(java.awt.Color color), use that to set the color. 3: ImageProcessor / ColorProcessor has a drawOval(int x, int y, int width, int height), use that to draw the circle, by setting width = height. 4: Save the image. -Sami Badawi http://www.shapelogic.org On Mon, Jun 2, 2008 at 4:43 AM, alessandra griffa <[hidden email]> wrote: > Hi! > > I am new with ImageJ plugins and I have a little problem. > Inside a plugin, I would like to draw colored circles on a grey levels > image such that the gray level image could be saved, for example as tif, > with the circles too. > Does anyone know the good class or the way I could do that? > > Thank you! > > Alessandra > |
Thank you a lot!
It is exactly what I needed. Alessandra 2008/6/2 Sami Badawi <[hidden email]>: > Hi Alessandra, > > Here is a suggestion: > > 1: Change the type of the gray image to a color image, that should > make the input to your plugin a ColorProcessor. > 2: ColorProcessor has a method: setColor(java.awt.Color color), use > that to set the color. > 3: ImageProcessor / ColorProcessor has a drawOval(int x, int y, int > width, int height), use that to draw the circle, by setting width = > height. > 4: Save the image. > > -Sami Badawi > http://www.shapelogic.org > > On Mon, Jun 2, 2008 at 4:43 AM, alessandra griffa > <[hidden email]> wrote: > > Hi! > > > > I am new with ImageJ plugins and I have a little problem. > > Inside a plugin, I would like to draw colored circles on a grey levels > > image such that the gray level image could be saved, for example as tif, > > with the circles too. > > Does anyone know the good class or the way I could do that? > > > > Thank you! > > > > Alessandra > > > |
In reply to this post by alessandra griffa
Thank you ! it is helpfull! but I still can not to draw waht i want.
I want to draw "results" into my Image. dirImag=getDirectory("picture"); dirtxt=getDirectory("txt28032006_10H24"); listImag=getFileList(dirImag); listtxt = getFileList( dirtxt ); setBatchMode(true); run("Results... ", "open=["+dirtxt+listtxt[0]+"]"); open(dirImag+ listImag[0]); nbr_txt = listtxt.length; filestring=File.openAsString(dirtxt+ listtxt[0]); rows=split(filestring, "\n"); x=newArray(rows.length); y=newArray(rows.length); setColor(255,200,0); for(k=1; k<rows.length; k++)//because first is x y { columns=split(rows[k],"\t"); x[k]=parseInt(columns[1]); y[k]=parseInt(columns[2]); print(x[k],y[k]); setColor(255,175,125); setLineWidth(5); drawOval(x[k], y[k], 20 ,10 ); autoUpdate(1); } save(dirImag+ listImag[0]+".bmp"); Thank you ! |
In reply to this post by alessandra griffa
Thank you ! it is helpfull! but I still can not to draw waht i want.
I want to draw "results" into my Image. dirImag=getDirectory("picture"); dirtxt=getDirectory("txt28032006_10H24"); listImag=getFileList(dirImag); listtxt = getFileList( dirtxt ); setBatchMode(true); run("Results... ", "open=["+dirtxt+listtxt[0]+"]"); open(dirImag+ listImag[0]); nbr_txt = listtxt.length; filestring=File.openAsString(dirtxt+ listtxt[0]); rows=split(filestring, "\n"); x=newArray(rows.length); y=newArray(rows.length); setColor(255,200,0); for(k=1; k<rows.length; k++)//because first is x y { columns=split(rows[k],"\t"); x[k]=parseInt(columns[1]); y[k]=parseInt(columns[2]); print(x[k],y[k]); setColor(255,175,125); setLineWidth(5); drawOval(x[k], y[k], 20 ,10 ); autoUpdate(1); } save(dirImag+ listImag[0]+".bmp"); Thank you ! |
Free forum by Nabble | Edit this page |