7 #ifndef VIL_NITF2_IMAGE_H 8 #define VIL_NITF2_IMAGE_H 14 # include <vcl_msvc_warnings.h> 30 char const *
tag()
const override;
87 unsigned nplanes()
const override;
88 unsigned ni()
const override;
89 unsigned nj()
const override;
122 unsigned j0,
unsigned nj,
123 double i_factor,
double j_factor )
const;
128 unsigned j0,
unsigned nj)
const override;
141 bool get_property (
char const *tag,
void *property_value=
nullptr)
const override;
148 const std::vector< vil_nitf2_des* >&
get_des()
const 164 virtual unsigned int nimages()
const;
175 unsigned i0,
unsigned ni,
176 unsigned j0,
unsigned nj,
177 double i_factor,
double j_factor );
186 unsigned j0,
unsigned nj)
const;
210 unsigned int blockIndexX,
211 unsigned int blockIndexY,
212 int bandIndex )
const;
221 std::vector< vil_nitf2_des* >
m_des;
237 T
get_bits(
const T* in_val,
unsigned int i0,
unsigned int ni )
239 unsigned int sample_offset = i0 / (
sizeof(T)*8 );
240 unsigned int bit_offset = i0 % (
sizeof(T)*8 );
242 unsigned int strip_left = bit_offset;
243 int strip_right = (
sizeof( T ) * 8 ) - ( bit_offset + ni );
244 T temp = in_val[sample_offset];
245 if ( strip_left > 0 ){
247 temp = temp << strip_left;
248 temp = temp >> strip_left;
250 if ( strip_right > 0 ){
254 for (
int i = 0 ; i < strip_right ; i++ ) temp /= 2;
257 else if ( strip_right < 0 ){
260 for (
int i = 0 ; i < (-strip_right) ; i++ ) temp *= 2;
261 temp += get_bits<T>( in_val+sample_offset+1, 0, -strip_right );
320 T*
byte_align_data( T* in_data,
unsigned int num_samples,
unsigned int in_bits_per_sample, T* out_data )
322 assert( in_bits_per_sample <
sizeof(T)*8 );
325 unsigned int bit_offset = 0;
326 for (
unsigned int o = 0 ; o < num_samples ; o++ ){
327 out_data[o] = get_bits<T>( in_data, bit_offset, in_bits_per_sample );
328 bit_offset+=in_bits_per_sample;
334 template<>
bool*
byte_align_data<bool>(
bool* in_data,
unsigned int num_samples,
unsigned int in_bits_per_sample,
bool* out_data );
336 #endif // VIL_NITF2_IMAGE_H
char const * file_format() const override
returns "nitf vM.N".
virtual vil_image_view_base_sptr get_copy_view_decimated_j2k(unsigned i0, unsigned ni, unsigned j0, unsigned nj, double i_factor, double j_factor) const
Stream interface for VIL image loaders.
An abstract base class of smart pointers to actual image data in memory.
vil_smart_ptr< vil_image_view_base > vil_image_view_base_sptr
~vil_nitf2_image() override
enum vil_pixel_format pixel_format() const override
Pixel Format.
unsigned n_block_i() const override
Number of blocks in image width.
bool * byte_align_data< bool >(bool *in_data, unsigned int num_samples, unsigned int in_bits_per_sample, bool *out_data)
unsigned size_block_i() const override
Block size in columns.
bool put_block(unsigned, unsigned, const vil_image_view_base &) override
put the block into the resource at the indicated location.
bool get_property(char const *tag, void *property_value=nullptr) const override
Extra property information.
virtual vil_image_view_base_sptr get_copy_view_uncompressed(unsigned i0, unsigned ni, unsigned j0, unsigned nj) const
void clear_image_headers()
vil_nitf2_image(vil_stream *is)
Instantiate an image resource, but doesn't read anything.
vil_nitf2_classification::file_version file_version() const
std::vector< vil_nitf2_des * > m_des
const vil_nitf2_header & get_header() const
static vil_image_view_base_sptr(* s_decode_jpeg_2000)(vil_stream *vs, unsigned i0, unsigned ni, unsigned j0, unsigned nj, double i_factor, double j_factor)
All instances of vil_nitf2_image will use s_decode_jpeg_2000() to decode JPEG 2000 streams if you set...
vil_streampos size_to(vil_nitf2_header::section_type sec, vil_nitf2_header::portion_type por, int index) const
vil_image_view_base_sptr get_block(unsigned int blockIndexX, unsigned int blockIndexY) const override
virtual void set_current_image(unsigned int index)
Since the VIL API (eg.
T get_bits(const T *in_val, unsigned int i0, unsigned int ni)
This function does a lot of work for.
unsigned ni() const override
Dimensions: Planes x ni x nj.
vil_streampos get_offset_to(vil_nitf2_header::section_type sec, vil_nitf2_header::portion_type por, unsigned int index=0) const
Stream interface for VIL image loaders.
A blocked representation of the image_resource.
virtual vil_nitf2_field::field_tree * get_tree() const
Class for reading NITF 2.1 imagery files.
const std::vector< vil_nitf2_image_subheader * > & get_image_headers() const
virtual unsigned int current_image() const
const std::vector< vil_nitf2_des * > & get_des() const
unsigned int m_current_image_index
vil_streampos get_offset_to_image_data_block_band(unsigned int imageIndex, unsigned int blockIndexX, unsigned int blockIndexY, int bandIndex) const
unsigned n_block_j() const override
Number of blocks in image height.
bool is_jpeg_2000_compressed() const
bool put_view(const vil_image_view_base &, unsigned, unsigned) override
Put the data in this view back into the image source.
unsigned nplanes() const override
return the image info of the current image.
std::vector< vil_nitf2_image_subheader * > m_image_headers
virtual vil_image_view_base_sptr get_copy_view_decimated_j2k(double i_factor, double j_factor) const
vil_nitf2_header m_file_header
T * byte_align_data(T *in_data, unsigned int num_samples, unsigned int in_bits_per_sample, T *out_data)
This function will byte align the data in in_data and store the result in out_data.
virtual vil_image_view_base_sptr get_block_j2k(unsigned int blockIndexX, unsigned int blockIndexY) const
const vil_nitf2_image_subheader * current_image_header() const
virtual vil_image_view_base_sptr get_copy_view() const
virtual unsigned int nimages() const
unsigned size_block_j() const override
Block size in rows.
unsigned nj() const override
Dimensions: Planes x ni x nj.