Hello everyone,
I am trying to use imageJ in my project and want to know about the followings *1>*i am creating a new image by the following code *ImagePlus im = NewImage.createImage(** title,width,height, 1,bitdep, NewImage.FILL_WHITE);* * ImageProcessor ip=im.getProcessor(); im.show(); * so i am getting an image in white and for FILL_BLACK i m getting in black colour.*i want to know if i can get the image with any desired gray scale value.* *2>*secondly, after generating the image window i want to show different pixels with different pixel values which*(means the co-ordinates and their gray scale pixel values) i already have in form of a text file or .xls file. * Please help me so that it would be easier for me so solve the problem.If u can send me any important links where i can get more information regarding these,that could also be a great help for me. Thank you, Ashish |
For the first problem:
As you'll see at http://rsbweb.nih.gov/ij/developer/api/ij/gui/NewImage.html there is antoher parameter: FILL_RAMP which may be useful for you. For the second problem... I don't know exactly what you want to do. Do you want to get the value for a (x,y) pixel? Sincerelly, Juanjo. ashish ram escribió: > Hello everyone, > > I am trying to use imageJ in my project and want to know about the > followings > > *1>*i am creating a new image by the following code > > *ImagePlus im = NewImage.createImage(** title,width,height, 1,bitdep, > NewImage.FILL_WHITE);* > * ImageProcessor ip=im.getProcessor(); > im.show(); * > > so i am getting an image in white and for FILL_BLACK i m getting in black > colour.*i want to know if i can get the image with any desired gray scale > value.* > > *2>*secondly, after generating the image window i want to show different > pixels with different pixel values which*(means the co-ordinates and their > gray scale pixel values) i already have in form of a text file or .xls file. > * > > Please help me so that it would be easier for me so solve the problem.If u > can send me any important links where i can get more information regarding > these,that could also be a great help for me. > > Thank you, > Ashish > > -- Juanjo Vega ([hidden email]) Unidad de Biocomputación. Laboratorio B-13. Centro Nacional de Biotecnología. CNB-CSIC. C\ Darwin, 3. Campus de Cantoblanco. Universidad Autónoma de Madrid. 28049, Madrid, Spain. http://www.cnb.csic.es http://www.biocomp.cnb.uam.es +34 91 585 4510 "Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes. |
Thank you for ur reply.
In the second problem i already have a list in which the co-ordinates and their pixel valuse in a .xls file.For example lets say x=100,y=222,pixel value=250 x=110,y=200,pixel value=0 x=120,y=512,pixel value=30 x=158,y=200,pixel value=0 x=146,y=251,pixel value=255 x=156,y=154,pixel value=250 and so on.All these information about the image will be present in a different file (either text or .xls) and during running the program the program should read those points from the file and show those points with the pixel values specified for them. Hope u have understood my problem now.I hope to get a reply from you. Thank you. Ashish |
Well,
In order to parse whatever kind of file, you'll need to deal with another library or to implement it by yourself. For the imageJ related stuff: To get image pixels: short[] pixels = (short[]) source.getProcessor().convertToShort(true).getPixels(); (This sample works with short. You might need to look for other types) To assign values to the image: pixels[y * width + x] = value; I don't know how to "refresh" the image with the new values. Maybe anybody can help with this, but to show it in a new image: ImageProcessor ipp = new ShortProcessor(width, height, pixels, null); ImagePlus output = new ImagePlus("title", ipp); output.getProcessor().resetMinAndMax(); output.show(); (At least you can test your application until somebody tells us how to refresh images =P) Hope this helps :) Juanjo. ashish ram escribió: > Thank you for ur reply. > In the second problem i already have a list in which the co-ordinates and > their pixel valuse in a .xls file.For example lets say > > x=100,y=222,pixel value=250 > x=110,y=200,pixel value=0 > x=120,y=512,pixel value=30 > x=158,y=200,pixel value=0 > x=146,y=251,pixel value=255 > x=156,y=154,pixel value=250 > > and so on.All these information about the image will be present in a > different file (either text or .xls) and during running the program the > program should read those points from the file and show those points with > the pixel values specified for them. > > Hope u have understood my problem now.I hope to get a reply from you. > > Thank you. > Ashish > > -- Juanjo Vega ([hidden email]) Unidad de Biocomputación. Laboratorio B-13. Centro Nacional de Biotecnología. CNB-CSIC. C\ Darwin, 3. Campus de Cantoblanco. Universidad Autónoma de Madrid. 28049, Madrid, Spain. http://www.cnb.csic.es http://www.biocomp.cnb.uam.es +34 91 585 4510 "Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes. |
Thanak u Juanjo. I hope someone reply me abt that soon.
|
Hiiii Juanjo,
I hav checked the FILL_RAMP in NewImage Class but that can not be used for any desired colour.I am still looking for any solution for that. In the mean while if u get any solution for that please do inform me. Thank you, Ashish |
Just for short:
Why don't you try to write a macro first? I'm sure both of the mentioned tasks can easily be perform by a macro. Have a look at the documentation of the macro routines to get an impression of the IJ macro language. >Hiiii Juanjo, > >I hav checked the FILL_RAMP in NewImage Class but that can not be used for >any desired colour.I am still looking for any solution for that. In the mean >while if u get any solution for that please do inform me. > >Thank you, >Ashish HTH -- Herbie ------------------------ <http://www.gluender.de> |
Free forum by Nabble | Edit this page |