Login  Register

Re: can i import pixel data from outside??????

Posted by Juanjo Vega on Jul 03, 2009; 3:16pm
URL: http://imagej.273.s1.nabble.com/can-i-import-pixel-data-from-outside-tp3691918p3691921.html

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.