OTB  7.2.0
Orfeo Toolbox
mvdTypes.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 
22 #ifndef mvdTypes_h
23 #define mvdTypes_h
24 
25 //
26 // Configuration include.
28 #include "ConfigureMonteverdi.h"
29 
30 #include "OTBMonteverdiCoreExport.h"
31 
32 /*****************************************************************************/
33 /* INCLUDE SECTION */
34 
35 //
36 // Qt includes (sorted by alphabetic order)
38 #include <QtWidgets>
39 
40 //
41 // System includes (sorted by alphabetic order)
42 #include <exception>
43 #include <string>
44 
45 //
46 // ITK includes (sorted by alphabetic order)
47 #include <itkArray.h>
48 #include <itkImageRegion.h>
49 
50 //
51 // OTB includes (sorted by alphabetic order)
52 #include <otbCast.h>
53 #include <otbImage.h>
54 #include <otbImageFileReader.h>
55 #include <otbImageFileWriter.h>
56 #include <otbVectorImage.h>
57 
58 //
59 // Monteverdi includes (sorted by alphabetic order)
60 
61 //
62 // External classes pre-declaration.
63 namespace
64 {
65 }
66 
67 //
68 // Type definitions.
69 namespace mvd
70 {
71 
72 /*******************************************************************************/
73 /* Enumerations */
74 
75 /*******************************************************************************/
76 /* Type definitions of scalar values. */
77 
80 typedef unsigned int CountType;
81 
84 typedef Monteverdi_FLOATING_TYPE RealType;
85 
88 typedef RealType ComponentType;
89 
92 typedef itk::VariableLengthVector<RealType> VectorPixelType;
93 
94 /*******************************************************************************/
95 /* Type definitions of STL realization. */
96 
99 typedef std::vector<std::string> StringVector;
100 
103 typedef std::vector<int> IntVector;
104 
107 typedef std::vector<unsigned int> UIntVector;
108 
111 typedef std::list<std::string> StringList;
112 
115 typedef std::vector<double> DoubleVector;
116 
117 /*******************************************************************************/
118 /* Type definitions of ITK realization. */
119 
122 typedef itk::Array<double> ParametersType;
123 
124 /*******************************************************************************/
125 /* Type definitions depending on dimension. */
126 
129 typedef itk::ImageRegion<Monteverdi_DIMENSION> ImageRegionType;
130 
133 typedef itk::Index<Monteverdi_DIMENSION> IndexType;
134 
137 typedef itk::Size<Monteverdi_DIMENSION> SizeType;
138 
141 typedef itk::ImageBase<Monteverdi_DIMENSION> ImageBaseType;
142 
143 /*******************************************************************************/
144 /* Type definitions for scalar/mono-band images. */
145 
149 
153 
157 
158 /*******************************************************************************/
159 /* Type definitions for vector/multi-band images (generic internal data). */
160 
164 
168 
172 
176 
180 
184 
185 /*******************************************************************************/
186 /* Type definitions for application defaults. */
187 
191 
195 
198 struct PixelInfo
199 {
200  typedef std::vector<PixelInfo> Vector;
201 
203  {
204  }
205 
206  std::string m_Key;
207 
211  unsigned int m_Resolution;
212 
213  bool m_HasPoint : 1;
214  bool m_HasIndex : 1;
215  bool m_HasPixel : 1;
216  bool m_HasResolution : 1;
217 };
218 
219 /*******************************************************************************/
220 /* Type definitions for wrapped applications */
221 
224 typedef std::map<std::string, StringVector> ApplicationsTagContainer;
225 
226 /*******************************************************************************/
227 /* Type definitions for dataset properties */
228 
231 typedef qlonglong SqlId;
232 
235 // typedef SqlId DatasetId;
236 typedef QString DatasetHash;
237 
240 typedef std::pair<std::string, std::string> PropertyType;
241 
244 typedef std::vector<PropertyType> PropertiesVector;
245 
248 typedef std::pair<std::string, std::vector<PropertyType>> PropertiesVectorByCategory;
249 
252 typedef std::map<std::string, PropertiesVector> PropertiesContainer;
253 
254 /*******************************************************************************/
255 /* Type definitions for Dataset list */
256 
259 typedef QPair<QString, QString> StringPairType;
260 
263 typedef QList<StringPairType> StringPairListType;
264 
265 /*******************************************************************************/
266 template <typename T>
267 inline T QObjectCast(QObject* object, const QString& string = QString())
268 {
269  T model = qobject_cast<T>(object);
270 
271  if (model != object)
272  {
273  if (!string.isNull())
274  qWarning() << string;
275 
276  throw std::bad_cast();
277  }
278 
279  return model;
280 }
281 
282 /*******************************************************************************/
283 } // end namespace 'mvd'
284 
285 #endif // mvdTypes_h
mvd::VectorImageFileReaderType DefaultImageFileReaderType
Definition: mvdTypes.h:194
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
qlonglong SqlId
Definition: mvdTypes.h:231
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
Creation of an "otb" vector image which contains metadata.
T QObjectCast(QObject *object, const QString &string=QString())
Definition: mvdTypes.h:267
DefaultImageType::IndexType m_Index
Definition: mvdTypes.h:209
Superclass::PixelType PixelType
std::list< std::string > StringList
Definition: mvdTypes.h:111
std::pair< std::string, std::vector< PropertyType > > PropertiesVectorByCategory
Definition: mvdTypes.h:248
itk::ImageRegion< Monteverdi_DIMENSION > ImageRegionType
Definition: mvdTypes.h:129
bool m_HasIndex
Definition: mvdTypes.h:214
std::vector< int > IntVector
Definition: mvdTypes.h:103
Superclass::SpacingType SpacingType
Reads image data.
Superclass::IndexType IndexType
std::string m_Key
Definition: mvdTypes.h:206
std::vector< std::string > StringVector
Definition: mvdTypes.h:99
bool m_HasPoint
Definition: mvdTypes.h:213
unsigned int CountType
Definition: mvdTypes.h:80
QList< StringPairType > StringPairListType
Definition: mvdTypes.h:263
std::map< std::string, StringVector > ApplicationsTagContainer
Definition: mvdTypes.h:224
std::vector< PixelInfo > Vector
Definition: mvdTypes.h:200
mvd::VectorImageType DefaultImageType
Definition: mvdTypes.h:190
DefaultImageType::PixelType m_Pixel
Definition: mvdTypes.h:210
otb::ImageFileWriter< VectorImageType > VectorImageFileWriterType
Definition: mvdTypes.h:171
otb::VectorImage< ComponentType, Monteverdi_DIMENSION > VectorImageType
Definition: mvdTypes.h:163
QString DatasetHash
Definition: mvdTypes.h:236
std::vector< double > DoubleVector
Definition: mvdTypes.h:115
itk::Array< double > ParametersType
Definition: mvdTypes.h:122
Superclass::SizeType SizeType
QPair< QString, QString > StringPairType
Definition: mvdTypes.h:259
Superclass::PointType PointType
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
bool m_HasResolution
Definition: mvdTypes.h:216
Monteverdi_FLOATING_TYPE RealType
Definition: mvdTypes.h:84
std::vector< unsigned int > UIntVector
Definition: mvdTypes.h:107
RealType ComponentType
Definition: mvdTypes.h:88
DefaultImageType::PointType m_Point
Definition: mvdTypes.h:208
unsigned int m_Resolution
Definition: mvdTypes.h:211
otb::ImageFileWriter< ScalarImageType > ScalarImageFileWriterType
Definition: mvdTypes.h:156
itk::ImageBase< Monteverdi_DIMENSION > ImageBaseType
Definition: mvdTypes.h:141
std::vector< PropertyType > PropertiesVector
Definition: mvdTypes.h:244
VectorImageType::SpacingType SpacingType
Definition: mvdTypes.h:175
otb::ImageFileReader< VectorImageType > VectorImageFileReaderType
Definition: mvdTypes.h:167
bool m_HasPixel
Definition: mvdTypes.h:215
otb::Image< ComponentType, Monteverdi_DIMENSION > ScalarImageType
Definition: mvdTypes.h:148
otb::ImageFileReader< ScalarImageType > ScalarImageFileReaderType
Definition: mvdTypes.h:152
VectorImageType::PointType PointType
Definition: mvdTypes.h:183
std::pair< std::string, std::string > PropertyType
Definition: mvdTypes.h:240
Writes image data to a single file with streaming process.
std::map< std::string, PropertiesVector > PropertiesContainer
Definition: mvdTypes.h:252
itk::VariableLengthVector< RealType > VectorPixelType
Definition: mvdTypes.h:92