OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | Friends | List of all members
ossimJ2kSizRecord Class Reference

#include <ossimJ2kSizRecord.h>

Public Member Functions

 ossimJ2kSizRecord ()
 default constructor More...
 
 ~ossimJ2kSizRecord ()
 destructor More...
 
void parseStream (ossim::istream &in)
 Parse method. More...
 
void writeStream (std::ostream &out)
 Write method. More...
 
ossimScalarType getScalarType () const
 Gets the scalar type. More...
 
std::ostream & print (std::ostream &out, const std::string &prefix=std::string()) const
 print method that outputs a key/value type format adding prefix to keys. More...
 

Public Attributes

ossim_uint16 m_marker
 segmet marker 0xff51 (big endian) More...
 
ossim_uint16 m_Lsiz
 length of segment minus marker More...
 
ossim_uint16 m_Rsiz
 profile More...
 
ossim_uint32 m_Xsiz
 width of reference grid More...
 
ossim_uint32 m_Ysiz
 height of reference grid More...
 
ossim_uint32 m_XOsiz
 Horizontal offset from the orgin of reference grid to the left side of image. More...
 
ossim_uint32 m_YOsiz
 Vertical offset from the orgin of reference grid to the top of image. More...
 
ossim_uint32 m_XTsiz
 width of one reference tile More...
 
ossim_uint32 m_YTsiz
 height of one reference tile More...
 
ossim_uint32 m_XTOsiz
 Horizontal offset from the orgin of reference grid to the left edge of first tile. More...
 
ossim_uint32 m_YTOsiz
 Vertical offset from the orgin of reference grid to the top edge of first tile. More...
 
ossim_uint16 m_Csiz
 number of component in the image More...
 
std::vector< ossim_uint8m_Ssiz
 One for each component: More...
 
std::vector< ossim_uint8m_XRsiz
 One for each component: More...
 
std::vector< ossim_uint8m_YRsiz
 One for each component: More...
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &out, const ossimJ2kSizRecord &obj)
 operator<< More...
 

Detailed Description

Definition at line 16 of file ossimJ2kSizRecord.h.

Constructor & Destructor Documentation

◆ ossimJ2kSizRecord()

ossimJ2kSizRecord::ossimJ2kSizRecord ( )

default constructor

Definition at line 23 of file ossimJ2kSizRecord.cpp.

24  :
25  m_marker(0xff51),
26  m_Lsiz(0),
27  m_Rsiz(0),
28  m_Xsiz(0),
29  m_Ysiz(0),
30  m_XOsiz(0),
31  m_YOsiz(0),
32  m_XTsiz(0),
33  m_YTsiz(0),
34  m_XTOsiz(0),
35  m_YTOsiz(0),
36  m_Csiz(0),
37  m_Ssiz(0),
38  m_XRsiz(0),
39  m_YRsiz(0)
40 {
41 }
ossim_uint32 m_XTOsiz
Horizontal offset from the orgin of reference grid to the left edge of first tile.
ossim_uint32 m_YTOsiz
Vertical offset from the orgin of reference grid to the top edge of first tile.
ossim_uint32 m_Xsiz
width of reference grid
std::vector< ossim_uint8 > m_XRsiz
One for each component:
ossim_uint32 m_YTsiz
height of one reference tile
ossim_uint16 m_Csiz
number of component in the image
ossim_uint16 m_Rsiz
profile
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
std::vector< ossim_uint8 > m_Ssiz
One for each component:
ossim_uint32 m_XTsiz
width of one reference tile
ossim_uint16 m_Lsiz
length of segment minus marker
ossim_uint16 m_marker
segmet marker 0xff51 (big endian)
std::vector< ossim_uint8 > m_YRsiz
One for each component:
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
ossim_uint32 m_Ysiz
height of reference grid

◆ ~ossimJ2kSizRecord()

ossimJ2kSizRecord::~ossimJ2kSizRecord ( )

destructor

Definition at line 43 of file ossimJ2kSizRecord.cpp.

44 {
45 }

Member Function Documentation

◆ getScalarType()

ossimScalarType ossimJ2kSizRecord::getScalarType ( ) const

Gets the scalar type.

Currently assumes all components are the same scalar type. I.e., only looks at first component.

Returns
scalar type based on bit depth and signed bit from theSsiz.

Definition at line 157 of file ossimJ2kSizRecord.cpp.

References ossim::isSigned(), m_Ssiz, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_SINT8, OSSIM_UINT16, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, and OSSIM_USHORT15.

Referenced by ossimKakaduJ2kReader::getOutputScalarType(), and ossimOpjJp2Reader::getOutputScalarType().

158 {
159  // Currently assumes all components the same scalar type.
160 
162 
163  if ( m_Ssiz.size() )
164  {
165  // Bits per pixel first seven bits plus one.
166  ossim_uint8 bpp = ( m_Ssiz[0] & 0x3f ) + 1;
167 
168  // Signed bit is msb.
169  bool isSigned = ( m_Ssiz[0] & 0x80 ) ? true : false;
170 
171  if ( bpp <= 8 )
172  {
173  if ( isSigned == 0 )
174  {
175  result = OSSIM_UINT8;
176  }
177  else if (isSigned == 1)
178  {
179  result = OSSIM_SINT8;
180  }
181  }
182  else if ( bpp == 11 )
183  {
184  if ( isSigned == 0 )
185  {
186  result = OSSIM_USHORT11;
187  }
188  else
189  {
190  result = OSSIM_SINT16;
191  }
192  }
193  else if ( bpp == 12 )
194  {
195  if ( isSigned == 0 )
196  {
197  result = OSSIM_USHORT12;
198  }
199  else
200  {
201  result = OSSIM_SINT16;
202  }
203  }
204  else if ( bpp == 13 )
205  {
206  if ( isSigned == 0 )
207  {
208  result = OSSIM_USHORT13;
209  }
210  else
211  {
212  result = OSSIM_SINT16;
213  }
214  }
215  else if ( bpp == 14 )
216  {
217  if ( isSigned == 0 )
218  {
219  result = OSSIM_USHORT14;
220  }
221  else
222  {
223  result = OSSIM_SINT16;
224  }
225  }
226  else if ( bpp == 15 )
227  {
228  if ( isSigned == 0 )
229  {
230  result = OSSIM_USHORT15;
231  }
232  else
233  {
234  result = OSSIM_SINT16;
235  }
236  }
237  else if( bpp <= 16 )
238  {
239  if( isSigned == 0 )
240  {
241  result = OSSIM_UINT16;
242  }
243  else if( isSigned == 1 )
244  {
245  result = OSSIM_SINT16;
246  }
247  }
248  }
249  return result;
250 }
16 bit unsigned integer (15 bits used)
8 bit signed integer
16 bit unsigned integer
16 bit signed integer
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
OSSIM_DLL bool isSigned(ossimScalarType scalarType)
std::vector< ossim_uint8 > m_Ssiz
One for each component:
ossimScalarType
16 bit unsigned integer (11 bits used)
8 bit unsigned integer
unsigned char ossim_uint8
16 bit unsigned integer (12 bits used)

◆ parseStream()

void ossimJ2kSizRecord::parseStream ( ossim::istream in)

Parse method.

Performs byte swapping as needed.

Parameters
inStream to parse.
Note
SIZ Marker (0xff51) is not read.

Definition at line 47 of file ossimJ2kSizRecord.cpp.

References ossim::byteOrder(), m_Csiz, m_Lsiz, m_Rsiz, m_Ssiz, m_XOsiz, m_XRsiz, m_Xsiz, m_XTOsiz, m_XTsiz, m_YOsiz, m_YRsiz, m_Ysiz, m_YTOsiz, m_YTsiz, OSSIM_LITTLE_ENDIAN, and ossimEndian::swap().

Referenced by ossimKakaduNitfReader::dumpTiles(), ossimOpjJp2Reader::initSizRecord(), and ossimJ2kInfo::printSizMarker().

48 {
49  // Note: Marker is not read.
50  in.read((char*)&m_Lsiz, 2);
51  in.read((char*)&m_Rsiz, 2);
52  in.read((char*)&m_Xsiz, 4);
53  in.read((char*)&m_Ysiz, 4);
54  in.read((char*)&m_XOsiz, 4);
55  in.read((char*)&m_YOsiz, 4);
56  in.read((char*)&m_XTsiz, 4);
57  in.read((char*)&m_YTsiz, 4);
58  in.read((char*)&m_XTOsiz, 4);
59  in.read((char*)&m_YTOsiz, 4);
60  in.read((char*)&m_Csiz, 2);
61 
63  {
64  // Stored in file big endian, must swap.
65  ossimEndian s;
66  s.swap(m_Lsiz);
67  s.swap(m_Rsiz);
68  s.swap(m_Xsiz);
69  s.swap(m_Ysiz);
70  s.swap(m_XOsiz);
71  s.swap(m_YOsiz);
72  s.swap(m_XTsiz);
73  s.swap(m_YTsiz);
74  s.swap(m_XTOsiz);
75  s.swap(m_YTOsiz);
76  s.swap(m_Csiz);
77  }
78 
79  m_Ssiz.resize( m_Csiz );
80  in.read((char*)&m_Ssiz.front(), m_Csiz);
81 
82  m_XRsiz.resize( m_Csiz );
83  in.read((char*)&m_XRsiz.front(), m_Csiz);
84 
85  m_YRsiz.resize( m_Csiz );
86  in.read((char*)&m_YRsiz.front(), m_Csiz);
87 }
ossim_uint32 m_XTOsiz
Horizontal offset from the orgin of reference grid to the left edge of first tile.
ossim_uint32 m_YTOsiz
Vertical offset from the orgin of reference grid to the top edge of first tile.
ossim_uint32 m_Xsiz
width of reference grid
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
std::vector< ossim_uint8 > m_XRsiz
One for each component:
ossim_uint32 m_YTsiz
height of one reference tile
ossim_uint16 m_Csiz
number of component in the image
ossim_uint16 m_Rsiz
profile
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
std::vector< ossim_uint8 > m_Ssiz
One for each component:
ossim_uint32 m_XTsiz
width of one reference tile
ossim_uint16 m_Lsiz
length of segment minus marker
std::vector< ossim_uint8 > m_YRsiz
One for each component:
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
ossim_uint32 m_Ysiz
height of reference grid

◆ print()

std::ostream & ossimJ2kSizRecord::print ( std::ostream &  out,
const std::string &  prefix = std::string() 
) const

print method that outputs a key/value type format adding prefix to keys.

Parameters
outString to output to.
prefixThis will be prepended to key. e.g. Where prefix = "nitf." and key is "file_name" key becomes: "nitf.file_name:"
Returns
output stream.

Definition at line 252 of file ossimJ2kSizRecord.cpp.

References m_Csiz, m_Lsiz, m_marker, m_Rsiz, m_Ssiz, m_XOsiz, m_XRsiz, m_Xsiz, m_XTOsiz, m_XTsiz, m_YOsiz, m_YRsiz, m_Ysiz, m_YTOsiz, and m_YTsiz.

Referenced by ossimKakaduNitfReader::dumpTiles(), operator<<(), and ossimJ2kInfo::printSizMarker().

254 {
255  // Capture the original flags.
256  std::ios_base::fmtflags f = out.flags();
257 
258  std::string pfx = prefix;
259  pfx += "siz.";
260 
261  out.setf(std::ios_base::hex, std::ios_base::basefield);
262  out << pfx << "marker: 0x" << m_marker << "\n";
263  out.setf(std::ios_base::fmtflags(0), std::ios_base::basefield);
264 
265  out << pfx << "Lsiz: " << m_Lsiz << "\n"
266  << pfx << "Rsiz: " << m_Rsiz << "\n"
267  << pfx << "Xsiz: " << m_Xsiz << "\n"
268  << pfx << "Yziz: " << m_Ysiz << "\n"
269  << pfx << "XOsiz: " << m_XOsiz << "\n"
270  << pfx << "YOsiz: " << m_YOsiz << "\n"
271  << pfx << "XTsiz: " << m_XTsiz << "\n"
272  << pfx << "YTsiz: " << m_YTsiz << "\n"
273  << pfx << "XTOsiz: " << m_XTOsiz << "\n"
274  << pfx << "YTOsiz: " << m_YTOsiz << "\n"
275  << pfx << "Csiz: " << m_Csiz << "\n";
276 
277  for ( ossim_uint16 i = 0; i < m_Csiz; ++i )
278  {
279  out << pfx << "Ssiz[" << i << "]: " << int(m_Ssiz[i]) << "\n"
280  << pfx << "XRsiz[" << i << "]: " << int(m_XRsiz[i]) << "\n"
281  << pfx << "YRsiz[" << i << "]: " << int(m_YRsiz[i]) << "\n";
282  }
283 
284  out.flush();
285 
286  // Reset flags.
287  out.setf(f);
288 
289  return out;
290 }
ossim_uint32 m_XTOsiz
Horizontal offset from the orgin of reference grid to the left edge of first tile.
ossim_uint32 m_YTOsiz
Vertical offset from the orgin of reference grid to the top edge of first tile.
ossim_uint32 m_Xsiz
width of reference grid
unsigned short ossim_uint16
std::vector< ossim_uint8 > m_XRsiz
One for each component:
ossim_uint32 m_YTsiz
height of one reference tile
ossim_uint16 m_Csiz
number of component in the image
ossim_uint16 m_Rsiz
profile
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
std::vector< ossim_uint8 > m_Ssiz
One for each component:
ossim_uint32 m_XTsiz
width of one reference tile
ossim_uint16 m_Lsiz
length of segment minus marker
ossim_uint16 m_marker
segmet marker 0xff51 (big endian)
std::vector< ossim_uint8 > m_YRsiz
One for each component:
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
ossim_uint32 m_Ysiz
height of reference grid

◆ writeStream()

void ossimJ2kSizRecord::writeStream ( std::ostream &  out)

Write method.

Parameters
outStream to write to.

Definition at line 89 of file ossimJ2kSizRecord.cpp.

References ossim::byteOrder(), m_Csiz, m_Lsiz, m_Rsiz, m_Ssiz, m_XOsiz, m_XRsiz, m_Xsiz, m_XTOsiz, m_XTsiz, m_YOsiz, m_YRsiz, m_Ysiz, m_YTOsiz, m_YTsiz, OSSIM_LITTLE_ENDIAN, and ossimEndian::swap().

90 {
91  // Length of this marker segment(marker not included):
92  m_Lsiz = 38 + 3*m_Csiz;
93 
94  // Grab component count before swapping:
95  ossim_uint16 components = m_Csiz;
96 
97  ossimEndian* s = 0;
98 
100  {
101  // Stored in file big endian, must swap.
102  s = new ossimEndian();
103  s->swap(m_Lsiz);
104  s->swap(m_Rsiz);
105  s->swap(m_Xsiz);
106  s->swap(m_Ysiz);
107  s->swap(m_XOsiz);
108  s->swap(m_YOsiz);
109  s->swap(m_XTsiz);
110  s->swap(m_YTsiz);
111  s->swap(m_XTOsiz);
112  s->swap(m_YTOsiz);
113  s->swap(m_Csiz);
114  }
115 
116  out.put( 0xff );
117  out.put( 0x51 );
118  // out.write( (char*)&m_marker, 2 );
119 
120  out.write((char*)&m_Lsiz, 2);
121  out.write((char*)&m_Rsiz, 2);
122  out.write((char*)&m_Xsiz, 4);
123  out.write((char*)&m_Ysiz, 4);
124  out.write((char*)&m_XOsiz, 4);
125  out.write((char*)&m_YOsiz, 4);
126  out.write((char*)&m_XTsiz, 4);
127  out.write((char*)&m_YTsiz, 4);
128  out.write((char*)&m_XTOsiz, 4);
129  out.write((char*)&m_YTOsiz, 4);
130  out.write((char*)&m_Csiz, 2);
131 
132  out.write((char*)&m_Ssiz.front(), components);
133  out.write((char*)&m_XRsiz.front(), components);
134  out.write((char*)&m_YRsiz.front(), components);
135 
136  if ( s )
137  {
138  // Swap it back to native.
139  s->swap(m_Lsiz);
140  s->swap(m_Rsiz);
141  s->swap(m_Xsiz);
142  s->swap(m_Ysiz);
143  s->swap(m_XOsiz);
144  s->swap(m_YOsiz);
145  s->swap(m_XTsiz);
146  s->swap(m_YTsiz);
147  s->swap(m_XTOsiz);
148  s->swap(m_YTOsiz);
149  s->swap(m_Csiz);
150 
151  // Cleanup:
152  delete s;
153  s = 0;
154  }
155 }
ossim_uint32 m_XTOsiz
Horizontal offset from the orgin of reference grid to the left edge of first tile.
ossim_uint32 m_YTOsiz
Vertical offset from the orgin of reference grid to the top edge of first tile.
ossim_uint32 m_Xsiz
width of reference grid
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
unsigned short ossim_uint16
std::vector< ossim_uint8 > m_XRsiz
One for each component:
ossim_uint32 m_YTsiz
height of one reference tile
ossim_uint16 m_Csiz
number of component in the image
ossim_uint16 m_Rsiz
profile
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
std::vector< ossim_uint8 > m_Ssiz
One for each component:
ossim_uint32 m_XTsiz
width of one reference tile
ossim_uint16 m_Lsiz
length of segment minus marker
std::vector< ossim_uint8 > m_YRsiz
One for each component:
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
ossim_uint32 m_Ysiz
height of reference grid

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  out,
const ossimJ2kSizRecord obj 
)
friend

operator<<

Definition at line 292 of file ossimJ2kSizRecord.cpp.

293 {
294  return obj.print(out);
295 }
std::ostream & print(std::ostream &out, const std::string &prefix=std::string()) const
print method that outputs a key/value type format adding prefix to keys.

Member Data Documentation

◆ m_Csiz

ossim_uint16 ossimJ2kSizRecord::m_Csiz

◆ m_Lsiz

ossim_uint16 ossimJ2kSizRecord::m_Lsiz

length of segment minus marker

Definition at line 72 of file ossimJ2kSizRecord.h.

Referenced by parseStream(), print(), and writeStream().

◆ m_marker

ossim_uint16 ossimJ2kSizRecord::m_marker

segmet marker 0xff51 (big endian)

Definition at line 69 of file ossimJ2kSizRecord.h.

Referenced by print().

◆ m_Rsiz

ossim_uint16 ossimJ2kSizRecord::m_Rsiz

profile

Definition at line 75 of file ossimJ2kSizRecord.h.

Referenced by parseStream(), print(), and writeStream().

◆ m_Ssiz

std::vector<ossim_uint8> ossimJ2kSizRecord::m_Ssiz

One for each component:

sign bit and bit depth of data unsigned = 0xxx xxxx (msb == 0) signed = 1xxx xxxx (msb == 1) bit depth = x000 0000 + 1 (first seven bits plus one)

Definition at line 124 of file ossimJ2kSizRecord.h.

Referenced by getScalarType(), parseStream(), print(), and writeStream().

◆ m_XOsiz

ossim_uint32 ossimJ2kSizRecord::m_XOsiz

Horizontal offset from the orgin of reference grid to the left side of image.

Definition at line 87 of file ossimJ2kSizRecord.h.

Referenced by ossimOpjJp2Reader::getNumberOfSamples(), ossimOpjJp2Reader::getOverviewTile(), parseStream(), print(), and writeStream().

◆ m_XRsiz

std::vector<ossim_uint8> ossimJ2kSizRecord::m_XRsiz

One for each component:

Horizontal separation of a sample of the component with respect to the reference grid.

Definition at line 132 of file ossimJ2kSizRecord.h.

Referenced by parseStream(), print(), and writeStream().

◆ m_Xsiz

ossim_uint32 ossimJ2kSizRecord::m_Xsiz

◆ m_XTOsiz

ossim_uint32 ossimJ2kSizRecord::m_XTOsiz

Horizontal offset from the orgin of reference grid to the left edge of first tile.

Definition at line 105 of file ossimJ2kSizRecord.h.

Referenced by ossimOpjJp2Reader::getImageTileWidth(), parseStream(), print(), and writeStream().

◆ m_XTsiz

ossim_uint32 ossimJ2kSizRecord::m_XTsiz

◆ m_YOsiz

ossim_uint32 ossimJ2kSizRecord::m_YOsiz

Vertical offset from the orgin of reference grid to the top of image.

Definition at line 93 of file ossimJ2kSizRecord.h.

Referenced by ossimOpjJp2Reader::getNumberOfLines(), ossimOpjJp2Reader::getOverviewTile(), parseStream(), print(), and writeStream().

◆ m_YRsiz

std::vector<ossim_uint8> ossimJ2kSizRecord::m_YRsiz

One for each component:

Vertical separation of a sample of the component with respect to the reference grid.

Definition at line 140 of file ossimJ2kSizRecord.h.

Referenced by parseStream(), print(), and writeStream().

◆ m_Ysiz

ossim_uint32 ossimJ2kSizRecord::m_Ysiz

◆ m_YTOsiz

ossim_uint32 ossimJ2kSizRecord::m_YTOsiz

Vertical offset from the orgin of reference grid to the top edge of first tile.

Definition at line 111 of file ossimJ2kSizRecord.h.

Referenced by ossimOpjJp2Reader::getImageTileHeight(), parseStream(), print(), and writeStream().

◆ m_YTsiz

ossim_uint32 ossimJ2kSizRecord::m_YTsiz

The documentation for this class was generated from the following files: