ocssw  1.0
Functions
/disk01/web/ocssw/build/src/libmeris/epr_band.c File Reference
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "epr_api.h"
#include "epr_core.h"
#include "epr_string.h"
#include "epr_ptrarray.h"
#include "epr_swap.h"
#include "epr_field.h"
#include "epr_record.h"
#include "epr_param.h"
#include "epr_dsd.h"
#include "epr_msph.h"
#include "epr_band.h"
#include "epr_bitmask.h"
#include "epr_dddb.h"

Go to the source code of this file.

Functions

EPR_SPtrArray * epr_create_band_ids (EPR_SProductId *product_id)
epr_uint epr_get_num_bands (EPR_SProductId *product_id)
EPR_SBandId * epr_get_band_id_at (EPR_SProductId *product_id, epr_uint index)
EPR_SBandId * epr_get_band_id (EPR_SProductId *product_id, const char *band_name)
const char * epr_get_band_name (EPR_SBandId *band_id)
void epr_free_band_id (EPR_SBandId *band_id)
float epr_get_scaling_params (EPR_SProductId *product_id, const char *str)
float epr_get_scaling_factor (EPR_SProductId *product_id, const char *str)
EPR_SDatasetRef epr_get_ref_struct (EPR_SProductId *product_id, const char *str)
EPR_EScalingMethod epr_str_to_scaling_method (const char *str)
EPR_ESampleModel epr_str_to_sample_offset (const char *str)
EPR_SRaster * epr_create_bitmask_raster (epr_uint source_width, epr_uint source_height, epr_uint source_step_x, epr_uint source_step_y)
EPR_SRaster * epr_create_raster (EPR_EDataTypeId data_type, epr_uint source_width, epr_uint source_height, epr_uint source_step_x, epr_uint source_step_y)
EPR_SRaster * epr_create_compatible_raster (EPR_SBandId *band_id, epr_uint source_width, epr_uint source_height, epr_uint source_step_x, epr_uint source_step_y)
void epr_free_raster (EPR_SRaster *raster)
int epr_read_band_raster (EPR_SBandId *band_id, int offset_x, int offset_y, EPR_SRaster *raster)
int epr_read_band_measurement_data (EPR_SBandId *band_id, int offset_x, int offset_y, EPR_SRaster *raster)
int epr_read_band_annotation_data (EPR_SBandId *band_id, int offset_x, int offset_y, EPR_SRaster *raster)
epr_uint epr_get_raster_elem_size (const EPR_SRaster *raster)
void * epr_get_raster_elem_addr (const EPR_SRaster *raster, epr_uint offset)
void * epr_get_raster_pixel_addr (const EPR_SRaster *raster, epr_uint x, epr_uint y)
void * epr_get_raster_line_addr (const EPR_SRaster *raster, epr_uint y)
epr_uint epr_get_raster_width (EPR_SRaster *raster)
epr_uint epr_get_raster_height (EPR_SRaster *raster)
EPR_FLineDecoder select_line_decode_function (EPR_EDataTypeId band_tid, EPR_ESampleModel band_smod, EPR_EDataTypeId raw_tid)
EPR_FArrayTransformer select_transform_array_function (EPR_EDataTypeId band_tid, EPR_EDataTypeId raw_tid)
void decode_line_uchar_1_of_1_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_char_1_of_1_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_ushort_1_of_1_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_short_1_of_1_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_short_1_of_2_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_short_2_of_2_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_1_of_1_to_uchar (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_1_of_2_to_uchar (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_2_of_2_to_uchar (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_ushort_1_of_1_to_ushort (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_2_to_f_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_1_of_2_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_2_of_2_to_float (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_line_uchar_3_to_i_to_uint (void *source_array, EPR_SBandId *band_id, int offset_x, int raster_width, int step_x, void *raster_buffer, int raster_pos)
void decode_tiepoint_band (float *sa_beg, float *sa_end, epr_uint samples_per_tie_pt, epr_uint num_elems, EPR_SBandId *band_id, int offset_x, float scan_offset_x, float y_mod, int raster_width, int s_x, float *raster_buffer, int raster_pos)
float epr_interpolate2D (float wi, float wj, float x00, float x10, float x01, float x11)
void transform_array_short_to_float (void *sourceArray, EPR_SBandId *band_id, float *raster_buffer, epr_uint nel)
void transform_array_ushort_to_float (void *sourceArray, EPR_SBandId *band_id, float *raster_buffer, epr_uint nel)
void transform_array_int_to_float (void *sourceArray, EPR_SBandId *band_id, float *raster_buffer, epr_uint nel)
void transform_array_uint_to_float (void *sourceArray, EPR_SBandId *band_id, float *raster_buffer, epr_uint nel)
void mirror_float_array (float *raster_buffer, epr_uint raster_width, epr_uint raster_height)
void mirror_uchar_array (epr_uchar *raster_buffer, epr_uint raster_width, epr_uint raster_height)
void mirror_ushort_array (epr_ushort *raster_buffer, epr_uint raster_width, epr_uint raster_height)
void mirror_uint_array (epr_uint *raster_buffer, epr_uint raster_width, epr_uint raster_height)
void epr_zero_invalid_pixels (EPR_SRaster *raster, EPR_SRaster *bm_raster)

Function Documentation

void decode_line_char_1_of_1_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1211 of file epr_band.c.

void decode_line_short_1_of_1_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1271 of file epr_band.c.

void decode_line_short_1_of_2_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1300 of file epr_band.c.

void decode_line_short_2_of_2_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1330 of file epr_band.c.

void decode_line_uchar_1_of_1_to_float ( void *  sourceArray,
EPR_SBandId *  band_id,
int  xo,
int  raster_width,
int  s_x,
void *  raster_buffer,
int  raster_pos 
)

This group of functions is for scaling the field element for a physical measurement values.
The type is located in the field info.
One field must have one type only.

Parameters:
sourceArraythe sourse array identifier (to be scaled)
band_idthe band ID with the information about the field's physical properties
xo[PIXEL] X-coordinate (0-bazed) of the upper right corner raster to search
raster_width[PIXEL] the width of the raster is been research
s_xX-step to get the next raster to search
raster_buffer[BYTE] the memory buffer to save information was scaled
raster_posshows the point of filling of the array raster_buffer

Definition at line 1181 of file epr_band.c.

void decode_line_uchar_1_of_1_to_uchar ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1360 of file epr_band.c.

void decode_line_uchar_1_of_2_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1469 of file epr_band.c.

void decode_line_uchar_1_of_2_to_uchar ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1379 of file epr_band.c.

void decode_line_uchar_2_of_2_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1500 of file epr_band.c.

void decode_line_uchar_2_of_2_to_uchar ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1399 of file epr_band.c.

void decode_line_uchar_2_to_f_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1437 of file epr_band.c.

void decode_line_uchar_3_to_i_to_uint ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1529 of file epr_band.c.

void decode_line_ushort_1_of_1_to_float ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1241 of file epr_band.c.

void decode_line_ushort_1_of_1_to_ushort ( void *  source_array,
EPR_SBandId *  band_id,
int  offset_x,
int  raster_width,
int  step_x,
void *  raster_buffer,
int  raster_pos 
)

Definition at line 1418 of file epr_band.c.

void decode_tiepoint_band ( float *  sa_beg,
float *  sa_end,
epr_uint  samples_per_tie_pt,
epr_uint  num_elems,
EPR_SBandId *  band_id,
int  offset_x,
float  scan_offset_x,
float  y_mod,
int  raster_width,
int  s_x,
float *  raster_buffer,
int  raster_pos 
)

Computes the physical values for the annotation data.

Parameters:
sa_begthe float array of tie points "before" Y-coordinate of the point to search
sa_endthe float array of tie points "after" Y-coordinate of the point to search
samples_per_tie_ptthe "distance" between two neighbour tie points (in scan-line direction)
num_elemsnumber of elements in one tie point scan-line
band_idthe information about properties and quantities of ENVISAT data.
offset_x[PIXEL] X-coordinate (0-based) of the upper right raster corner to search
y_mod[PIXEL] relative location of the point is being searched for (in flight direction)
raster_width[PIXEL] the width of the raster is being searched for
s_x[PIXEL] X-step to get the next point (in source coordinates) to search
raster_bufferthe float user array to be filled with physical values
raster_posthe actual "filled" position in raster_buffer-array

Definition at line 1565 of file epr_band.c.

EPR_SPtrArray* epr_create_band_ids ( EPR_SProductId *  product_id)

Obtains all bands infos from the dddb.

Definition at line 43 of file epr_band.c.

void epr_free_band_id ( EPR_SBandId *  band_id)

Release the memory allocated through a band ID.

Parameters:
bandthe dataset description identifier, if NULL the function immediately returns zero.
Returns:
zero for success, an error code otherwise

Definition at line 292 of file epr_band.c.

EPR_SDatasetRef epr_get_ref_struct ( EPR_SProductId *  product_id,
const char *  str 
)

Gets the dataset_id, field_index and elem_index

Parameters:
product_idthe the product file identifier
strthe string with the name, separator ('.') and indexes.
Returns:
the dataset_id, field_index and elem_index (-1 if no). NULL if correspondent dataset name was not found.

Definition at line 391 of file epr_band.c.

float epr_get_scaling_factor ( EPR_SProductId *  product_id,
const char *  str 
)

Gets the scaling factor by the given dataset_id, field_index, elem_index

Parameters:
product_idthe the product file identifier
strthe string with the name, separator ('.') and indexes.
Returns:
the dataset_id, field_index and elem_index (-1 if no). NULL if correspondent dataset name was not found.

Definition at line 360 of file epr_band.c.

float epr_get_scaling_params ( EPR_SProductId *  product_id,
const char *  str 
)

Gets the scaling params: factor or offset by the given dataset_id, field_index, elem_index

Parameters:
product_idthe the product file identifier
strthe string with the name, separator ('.') and indexes.
Returns:
the dataset_id, field_index and elem_index (-1 if no). NULL if correspondent dataset name was not found.

Definition at line 328 of file epr_band.c.

float epr_interpolate2D ( float  wi,
float  wj,
float  x00,
float  x10,
float  x01,
float  x11 
)

Two dimenzional interpolation

Parameters:
withe interpolation point location in [0,1] in "horizontal" direction
wjthe interpolation point location in [0,1] in "vertical" direction
x00the first point in "horizontal" direction
x10the second point in "horizontal" direction
x01the first point in "vertical" direction
x11the second point in "vertical" direction
Returns:
float interpolated value

Definition at line 1647 of file epr_band.c.

int epr_read_band_annotation_data ( EPR_SBandId *  band_id,
int  offset_x,
int  offset_y,
EPR_SRaster *  raster 
)

Reads the annotation data and converts its into physical values.

Parameters:
band_idthe information about properties and quantities of ENVISAT data.
offset_xX-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search
offset_yY-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search
rasterthe instance to the buffer information was used
Returns:
zero for success, an error code otherwise

! was 0.5F !!

! was 0.5F !!

! EPR-7: was 0.5F !!

Definition at line 828 of file epr_band.c.

int epr_read_band_measurement_data ( EPR_SBandId *  band_id,
int  offset_x,
int  offset_y,
EPR_SRaster *  raster 
)

Reads the measurement data and converts its into physical values.

Parameters:
band_idthe information about properties and quantities of ENVISAT data.
offset_xX-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search
offset_yY-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search
rasterthe instance to the buffer information was used
Returns:
zero for success, an error code otherwise

Definition at line 697 of file epr_band.c.

Converts the given string into a sample offset identifier.

Parameters:
strthe string to be converted.
Returns:
the sample offset identifier represented by the given string. If the string is equal of '*' the value e_none_samoff is returned.

Definition at line 456 of file epr_band.c.

Converts the given string into a scaling method identifier.

Parameters:
strthe string to be converted.
Returns:
the scaling method identifier represented by the given string. If the string is equal of '*' the value e_non_smid is returned.

Definition at line 437 of file epr_band.c.

void epr_zero_invalid_pixels ( EPR_SRaster *  raster,
EPR_SRaster *  bm_raster 
)

Masks the band information out. The band information will be masked dependent on bit mask filter for the same selected area (described in raster).

Parameters:
rasterselected and physically processed the ENVISAT product data band information
bm_rasterselected the ENVISAT flag bit mask filter

Definition at line 1760 of file epr_band.c.

void mirror_float_array ( float *  raster_buffer,
epr_uint  raster_width,
epr_uint  raster_height 
)

This group of functions is for mirroring the scaled line of a physical MERIS values.

Parameters:
raster_buffer[BYTE] the memory buffer to be Y-mirrored
raster_width[PIXEL] the width of the raster is been Y-mirrored
raster_height[PIXEL] the height of the raster is been Y-mirrored

Definition at line 1700 of file epr_band.c.

void mirror_uchar_array ( epr_uchar raster_buffer,
epr_uint  raster_width,
epr_uint  raster_height 
)

Definition at line 1715 of file epr_band.c.

void mirror_uint_array ( epr_uint raster_buffer,
epr_uint  raster_width,
epr_uint  raster_height 
)

Definition at line 1745 of file epr_band.c.

void mirror_ushort_array ( epr_ushort raster_buffer,
epr_uint  raster_width,
epr_uint  raster_height 
)

Definition at line 1730 of file epr_band.c.

Selects the line decode function, depended on measurement data type.

Definition at line 1096 of file epr_band.c.

Selects the transform array function, dependent on annotation data type.

Definition at line 1163 of file epr_band.c.

void transform_array_int_to_float ( void *  sourceArray,
EPR_SBandId *  band_id,
float *  raster_buffer,
epr_uint  nel 
)

Definition at line 1676 of file epr_band.c.

void transform_array_short_to_float ( void *  sourceArray,
EPR_SBandId *  band_id,
float *  raster_buffer,
epr_uint  nel 
)

This group of functions is for scaling the field element for a physical annotation values.
The type is located in the field info.
One field must have one type only.

Parameters:
sourceArraythe sourse array identifier (to be scaled)
band_idthe band ID with the information about the field's physical properties
raster_buffer[BYTE] the memory buffer to save information was scaled
nelnumber of element to scale

Definition at line 1652 of file epr_band.c.

void transform_array_uint_to_float ( void *  sourceArray,
EPR_SBandId *  band_id,
float *  raster_buffer,
epr_uint  nel 
)

Definition at line 1688 of file epr_band.c.

void transform_array_ushort_to_float ( void *  sourceArray,
EPR_SBandId *  band_id,
float *  raster_buffer,
epr_uint  nel 
)

Definition at line 1664 of file epr_band.c.