Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef VIL_NITF2_DATA_MASK_TABLE_H
00006 #define VIL_NITF2_DATA_MASK_TABLE_H
00007
00008
00009
00010 #include <vcl_vector.h>
00011 #include <vxl_config.h>
00012 #include <vcl_string.h>
00013 #include <vil/vil_pixel_format.h>
00014
00015 class vil_stream;
00016
00017
00018
00019
00020
00021 class vil_nitf2_data_mask_table
00022 {
00023 public:
00024 vil_nitf2_data_mask_table( unsigned int numBlocksX, unsigned int numBlocksY,
00025 unsigned int numBands, const vcl_string imode );
00026 bool parse( vil_stream* stream );
00027
00028
00029 bool has_offset_table() const { return BMR_n_BND_m.size() > 0; }
00030
00031
00032 bool has_pad_pixel_table() const { return TMR_n_BND_m.size() > 0; }
00033
00034 vxl_uint_32 blocked_image_data_offset() const;
00035
00036
00037
00038
00039
00040 vxl_uint_32 block_band_present( unsigned int block_x, unsigned int block_y, int band = -1) const;
00041
00042
00043
00044
00045
00046 vxl_uint_32 block_band_offset( unsigned int block_x, unsigned int block_y, int band = -1) const;
00047
00048
00049
00050 vxl_uint_32 pad_pixel( unsigned int block_x, unsigned int block_y, int band ) const;
00051
00052 vxl_uint_32 block_band_has_pad( unsigned int block_x, unsigned int block_y, int band = -1) const;
00053
00054 static void maybe_endian_swap( char* a, unsigned sizeOfAInBytes, vil_pixel_format pixFormat );
00055 static void maybe_endian_swap( char* a, unsigned sizeOfAInBytes, unsigned int bytesPerSample );
00056 protected:
00057
00058 vxl_uint_32 IMDATOFF;
00059
00060 vxl_uint_16 BMRLNTH;
00061
00062 vxl_uint_16 TMRLNTH;
00063
00064 vxl_uint_16 TPXCDLNTH;
00065
00066
00067 #if VXL_HAS_INT_64
00068 vxl_uint_64 TPXCD;
00069 #else
00070 vxl_uint_32 TPXCD;
00071 #endif //VXL_HAS_INT_64
00072
00073
00074
00075
00076 vcl_vector< vcl_vector< vcl_vector< vxl_uint_32 > > > BMR_n_BND_m;
00077
00078
00079
00080 vcl_vector< vcl_vector< vcl_vector< vxl_uint_32 > > > TMR_n_BND_m;
00081
00082 unsigned int num_blocks_x;
00083 unsigned int num_blocks_y;
00084 unsigned int num_bands;
00085 vcl_string i_mode;
00086 };
00087
00088 #endif // VIL_NITF2_DATA_MASK_TABLE_H