rasdaman complete source
nitf.h
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 
29 #ifndef __RASNITF_NITF_H
30 #define __RASNITF_NITF_H
31 
32 #include<string>
33 #include<vector>
34 #include<iostream>
35 #include<fstream>
36 
37 
38 namespace RasNITF
39 {
40 
41 class image;
42 class graphic;
43 class text;
44 class des;
45 class res;
46 
47 class nitf
48 {
49 
50  char m_fhdr[9];
51  char m_clevel[2];
52  char m_stype[4];
53  char m_ostaid[10];
54  char m_fdt[14];
55  char m_ftitle[80];
56  char m_fsclas[1];
57  char m_fsclsy[2];
58  char m_fscode[11];
59  char m_fsctlh[2];
60  char m_fsrel[20];
61  char m_fsdctp[2];
62  char m_fsdcdt[8];
63  char m_fsdcxm[4];
64  char m_fsdg[1];
65  char m_fsdgdt[8];
66  char m_fscltx[43];
67  char m_fscatp[1];
68  char m_fscaut[40];
69  char m_fscrsn[1];
70  char m_fssrdt[8];
71  char m_fsctln[15];
72  char m_fscop[5];
73  char m_fscpys[5];
74  char m_encryp[1];
75  char m_fbkgc[3];
76  char m_oname[24];
77  char m_ophone[18];
78 
79  char m_fl[12];
80  char m_hl[6];
81  char m_numi[3];
82  char* m_li; // image sizes data
83  char m_nums[3];
84  char* m_ls; // graphic sizes data
85  char m_numx[3];
86  char m_numt[3];
87  char* m_lt; // text sizes data
88  char m_numdes[3];
89  char* m_ld; // des sizes data
90  char m_numres[3];
91  char* m_lr; // res sizes data
92  char m_udhdl[5];
93  char m_udhofl[3];
94  char* m_udhd;
95  char m_xhdl[5];
96  char m_xhdlofl[3];
97  char* m_xhd;
98 
99  // DATA
100 
101  //std::ifstream hNITF;
102 
103  long n_fl;
104  long n_hl;
105 
106  int n_numi;
107  std::vector<long> n_lish;
108  std::vector<long> n_li;
109  image *m_images;
110 
111  int n_nums;
112  std::vector<long> n_lssh;
113  std::vector<long> n_ls;
114  graphic *m_graphics;
115 
116  int n_numt;
117  std::vector<long> n_ltsh;
118  std::vector<long> n_lt;
119  text *m_texts;
120 
121  int n_numdes;
122  std::vector<long> n_ldsh;
123  std::vector<long> n_ld;
124  des *m_des;
125 
126  int n_numres;
127  std::vector<long> n_lrsh;
128  std::vector<long> n_lr;
129  res *m_res;
130 
131  int n_udhdl;
132  int n_xhdl;
133 
134  bool isEmpty;
135 
136 public:
137 
138  nitf();
139  ~nitf();
140 
141  int read_file(std::string filename);
142  int read_headers_from(char* file_data, long file_length);
143  int read(std::istream &hNITF, bool read_image_data);
144 
145  int write_file(std::string filename);
146 
147  void image_to_pixel_sequential(int index);
148 
149  void stats() const;
150  void empty();
151  bool checkempty();
152 
153  long get_image_size(int index = 0) const;
154  int get_image_width(int index = 0) const;
155  int get_image_height(int index = 0) const;
156  int get_image_pixel_type(int index = 0) const;
157  long get_image_offset(int index = 0) const;
158 
159  bool isRGB(int image_index);
160  bool isGRAY(int image_index);
161  bool isBOOL(int image_index);
162 
163 };
164 
165 }
166 
167 #endif
Definition: image.h:53
bool isRGB(int image_index)
int read_headers_from(char *file_data, long file_length)
Definition: nitf.h:47
void image_to_pixel_sequential(int index)
int get_image_width(int index=0) const
Definition: graphic.h:35
bool isBOOL(int image_index)
int write_file(std::string filename)
int read_file(std::string filename)
long get_image_size(int index=0) const
bool isGRAY(int image_index)
int read(std::istream &hNITF, bool read_image_data)
Definition: text.h:38
void stats() const
int get_image_pixel_type(int index=0) const
long get_image_offset(int index=0) const
Definition: res.h:34
int get_image_height(int index=0) const
Definition: des.h:35
bool checkempty()