pls: how export an image into Excel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

pls: how export an image into Excel

Juan Francisco-2
Hi all:
  pls, how its possible to export the pixel value matrix corresponding to an Image into a Excel format (.xls)?
  Thanks a lot!!
  Juan Francisco

       
---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: pls: how export an image into Excel

Rigo Pantoja
Hola Juan,

 You can do this with Origin 7.0.   Select the matrix spreed sheet and then
import the TIFF image.

Rigo

On 5/8/07, Juan Francisco <[hidden email]> wrote:

>
> Hi all:
>   pls, how its possible to export the pixel value matrix corresponding to
> an Image into a Excel format (.xls)?
>   Thanks a lot!!
>   Juan Francisco
>
>
> ---------------------------------
>
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por minuto.
> http://es.voice.yahoo.com
>
Reply | Threaded
Open this post in threaded view
|

Re: pls: how export an image into Excel

Albert Cardona
In reply to this post by Juan Francisco-2
Francisco,

To create a text file with your image as a width x height matrix:

ImagePlus imp = IJ.getImage();
ImageProcessor ip = imp.getProcessor();

StringBuffer sb = new StringBuffer();

int width = ip.getWidth();
int height = ip.getHeight();

for (int y=0; y<height; y++) {
    for (int x=0; x<width; x++) {
        sb.append(ip.getf(x, y)).append(' ');  // using faster version
of getPixel
    }
    sb.append('\n');
}

new ij.text.TextPanel(sb.toString()).saveAs(""); // will show a file dialog


Voila. Super easy.

The above works for all kinds of images. You may want to change 'getf'
for 'get' to retrieve pixels as integers, or even call the pixels object
with getPixels() and cast it (it's an array, of type dependent on the
ImageProcessor type). You can also use getColumn() and getRow() (check
the ImageProcessor API, all you need is there:
http://rsb.info.nih.gov/ij/developer/api/index.html ).

Even easier would be to simple Save As / Text... and then cut the pixels
column into rows of image width length.


Albert
Reply | Threaded
Open this post in threaded view
|

Re: pls: how export an image into Excel

Wayne Rasband
In reply to this post by Juan Francisco-2
On May 8, 2007, at 11:31 AM, Juan Francisco wrote:

> Hi all:
>   pls, how its possible to export the pixel value matrix corresponding
> to an Image into a Excel format (.xls)?
>   Thanks a lot!!

Use the File>Save As>Text Image command and set the extension to ".xls".

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: pls: how export an image into Excel

Philip Ershler
On May 8, 2007, at 1:44 PM, Wayne Rasband wrote:

> On May 8, 2007, at 11:31 AM, Juan Francisco wrote:
>
>> Hi all:
>>   pls, how its possible to export the pixel value matrix  
>> corresponding to an Image into a Excel format (.xls)?
>>   Thanks a lot!!
>
> Use the File>Save As>Text Image command and set the extension to  
> ".xls".
>
> -wayne

In this case, how does Excel know the pixel dimensions of the image?

Thanks, Phil
Reply | Threaded
Open this post in threaded view
|

Re: pls: how export an image into Excel

Wayne Rasband
On May 8, 2007, at 4:11 PM, Philip Ershler wrote:

> On May 8, 2007, at 1:44 PM, Wayne Rasband wrote:
>
>> On May 8, 2007, at 11:31 AM, Juan Francisco wrote:
>>
>>> Hi all:
>>>   pls, how its possible to export the pixel value matrix
>>> corresponding to an Image into a Excel format (.xls)?
>>>   Thanks a lot!!
>>
>> Use the File>Save As>Text Image command and set the extension to
>> ".xls".
>>
>> -wayne
>
> In this case, how does Excel know the pixel dimensions of the image?

It figures out the dimensions by counting linefeeds and tabs, which is
what ImageJ does when you use the File>Import>Text Image command.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: pls: how export an image into Excel

TELLACHE Mohamed
In reply to this post by Philip Ershler
Philip Ershler a écrit :

> On May 8, 2007, at 1:44 PM, Wayne Rasband wrote:
>
>> On May 8, 2007, at 11:31 AM, Juan Francisco wrote:
>>
>>> Hi all:
>>>   pls, how its possible to export the pixel value matrix
>>> corresponding to an Image into a Excel format (.xls)?
>>>   Thanks a lot!!
>>
>> Use the File>Save As>Text Image command and set the extension to ".xls".
>>
>> -wayne
>
> In this case, how does Excel know the pixel dimensions of the image?
>
> Thanks, Phil
>
The only information that can provide a text image file is number of row
and line. The number of rows and lines correspond to size of the image
in pixel.

Ex :
A 512*512 pixel image will be a text image of 512 lines per 512 rows if
the image is in grey level

--
******************************************************
Mohamed Tellache
PhD student
Laboratory of Aerodynamics and Biomechanics of Motion
Mail : [hidden email]
Phone : +33(0) 491 266 230
        +33(0) 625 752 861
Université de Méditerranée LABM
Parc Scientifique et Technologique de Luminy
163, Avenue de Luminy, Case Postale 918
13288 Marseille cedex 9 FRANCE
*******************************************************