convertBand

[ XITE Reference Manual | XITE home ]

Name

convertBand, mkConvertBand - convert a band to another pixel type

Syntax

 #include <xite/convert.h>

 int convertBand( IBAND b1, IBAND b2 );

 IBAND mkConvertBand( IBAND b, IPIXTYP pixtyp );

Description

convertBand converts the data in <b1> into <b2>. Although typed as IBAND above, <b1> and <b2> may be of any combination of the following pixel types.

  Pixel Type   Band Type   IPIXTYP     IPIXTYP value
 ----------------------------------------------------
  UNS_BYTE     IUB_BAND    Iu_byte_typ      3
  SIGN_BYTE    ISB_BAND    Is_byte_typ      4
  UNS_SHORT    IUS_BAND    Iu_short_typ     5
  SIGN_SHORT   ISS_BAND    Is_short_typ     6
  INTEGER      II_BAND     Integer_typ      7
  REAL         IR_BAND     Ireal_typ        8
  COMPLEX      IC_BAND     Icomplex_typ     9
  DOUBLE       ID_BAND     Idouble_typ     10
  DCOMPLEX     IDC_BAND    Id_complex_typ  11

Only the overlapping part of the two bands is converted. Conversion is as simple as possible, no scaling is performed. If overflow, the result is set to the closest legal value.

mkConvertBand creates a new band of the same size as the input band <b>, but with pixel type <pixtyp>, then converts the data in <b> into the new band, and returns the new band.

Bugs

There is a large number of combinations, the routines are NOT thoroughly tested!! Please report any problems.

Return value

For convertBand:
 0 => ok
 1 => Can't handle that input pixel type
 2 => Can't handle that output pixel type

For mkConvertBand:
 The new band => ok
 (IBAND) 0    => error

Author

Tor Loennestad, BLAB, ifi, UiO