AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1994.08.26 20:39 "alpha bug report", by Ron Steriti
1994.08.26 22:18 "Re: alpha bug report", by Dan McCoy

1994.08.26 20:39 "alpha bug report", by Ron Steriti

I'm having trouble with the alpha version, i do the simplest of things... lifted from the example in README.TOP, which has changed slightly, my fixes (?) didn't work - see below

fortunately the older version on our dec works, but much slower

Initial error:

/usr/lib/cmplrs/cc/cfe: Error: subs.c, line 36: Number of arguments doesn't agree with number in declaration
     TIFFWriteScanline( tif, buf, row );
 ---------------------^
/usr/lib/cmplrs/cc/cfe: Error: subs.c, line 60: Number of arguments doesn't agree with number in declaration
     TIFFReadScanline(tif, buf, row);
 --------------------^

Of course, this is due to the new argument t_sample_t sample in tif_read.c

I, of course, simply added it to the code, but now it tries to read too many rows...

[many lines deleted]
data/AXTBFT1.TIF: 509: Row out of range, max 480.
data/AXTBFT1.TIF: 510: Row out of range, max 480.
data/AXTBFT1.TIF: 511: Row out of range, max 480.
data/AXTBFT1.TIF: 512: Row out of range, max 480.
data/AXTBFT1.TIF: 513: Row out of range, max 480.

i checked the sizes:

imagewidth = 512,i-l = 480

and finally here's my code:

typedef struct {
  
  float   **real;
  float   **imag;
  int     **byte;
  int     x_size;
  int     y_size;
  int     type;
  int     file;

} Matrix;
#define  REAL  1
#define  IMAG  2
#define  CMPLX 3
#define  BYTES 4

void ReadTIFF ( char *filename, Matrix *in )

{
  
  TIFF       *tif;
  char       *buf;
  int       row, column;
  tsample_t  sample;
  unsigned long  imagelength, imagewidth;

  tif = TIFFOpen( filename, "r");
  TIFFGetField ( tif, TIFFTAG_IMAGELENGTH, &imagelength);
  TIFFGetField ( tif, TIFFTAG_IMAGEWIDTH,  &imagewidth );
  buf = (char *)malloc(TIFFScanlineSize(tif));

  printf ( "imagewidth = %d,i-l = %d \n", imagewidth, imagelength );

  in->byte = i_matrix (1,imagewidth+1,1,imagelength+1);

  for (row = 0; row < imagelength; row++) {
    TIFFReadScanline(tif, buf, row, sample);
    for ( column = 0; column < imagewidth; column++ ) {
      in->byte[row+1][column+1] = buf[column];
    }
  }

  TIFFClose(tif);

  in->x_size = imagewidth  + 1;
  in->y_size = imagelength + 1;
  in->type   = BYTES;
  
  free ( buf );

}


int **i_matrix (int nrl, int nrh, int ncl, int nch)

{
      int   i;
      int **m;

      m=(int **) malloc((unsigned) (nrh-nrl+1)*sizeof(int*));
      if (!m ) printf( "allocation failure in matrix()\n" );
      m -= nrl;
      for(i=nrl;i<=nrh;i++){
        m[i] = (int *)malloc((unsigned)(nch-ncl+1)*sizeof(int));
        if (!m[i] ) printf( "allocation failure in matrix() \n" );
        m[i] -= ncl;
      }
      return m;
}

ron

Ron Steriti

Doctorate in Electrical Engineering
Research fields include image reconstruction
and blind deconvolution. Am interested in applying
this to medical imaging (PET, SPECT, etc).
Willing to relocate (hopefully close to great windsurfing).

University of Massachusetts Lowell

Department of Electrical Engineering
Center for Imaging and Optical Computing
Center for Productivity Enhancement
1 University Ave Lowell, MA 01854

steriti@dragon.cpe.uml.edu
http://dragon.cpe.uml.edu/~steriti/Home.html

My list of interesting WWW sites
http://dragon.cpe.uml.edu/~steriti/Interesting.html