AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
July 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.07.11 18:47 "sampleper pixel", by Balint Radics
2004.07.11 18:57 "Re: sampleper pixel", by Frank Warmerdam
2004.07.12 09:01 "Re: sampleper pixel", by Balint Radics
2004.07.12 10:57 "Re: sampleper pixel", by Diana Szleper
2004.07.12 15:46 "Re: sampleper pixel", by Balint Radics

2004.07.11 18:57 "Re: sampleper pixel", by Frank Warmerdam

Balint Radics wrote:
> Hi,
> 
> I am balint and I have some question concerning tiff and libtiff.
> I have a tiff picture.This picture was made such that there was a 
> measurment 
> where single photons fell into the pixels of a detector and thus we got a 
> matrix of (let's say) float or int data in each matrix element.Then we 
> saved the picture in .tiff format.There are only one directories in each 
> tiff file.I have a simple question:how can I read the data of each pixels 
> from the file?Because what I don't understand in libtiff is that I can 
> read the file following the "scanline" method to a buf:
> 
>     buf = _TIFFmalloc(TIFFScanlineSize(Tif));                                 
>      for (int row = 0; row < ImageHeight; row++){                                        
>       TIFFReadScanline(Tif, buf, row);             
>  	"reading the buff somehow";
>       }
> 
> but the problem is that I cannot get the single (let's say float or int
> type) datas of single pixels from the buff array.

Balint,

If the file has one sample per pixel and is of type float (4 bytes
per pixel, sampleformat ieeefloat) then you would do something like this:

      buf = _TIFFmalloc(TIFFScanlineSize(Tif));
      for (int row = 0; row < ImageHeight; row++){
        TIFFReadScanline(Tif, buf, row);
   	"reading the buff somehow";
        for( int pixel = 0; pixel < ImageWidth; pixel++ ) {
           printf( "value[%d,%d] = %f\n",
                   pixel, row, ((float *) buf)[pixel] );
        }
      }

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent