OTB  9.0.0
Orfeo Toolbox
otbVectorImage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 #ifndef otbVectorImage_h
22 #define otbVectorImage_h
23 
24 #if defined(__GNUC__) || defined(__clang__)
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wunused-parameter"
27 #include "itkVectorImage.h"
28 #pragma GCC diagnostic pop
29 #else
30 #include "itkVectorImage.h"
31 #endif
33 #include "otbImageCommons.h"
34 #include "OTBImageBaseExport.h"
35 
36 namespace otb
37 {
44 template <class TPixel, unsigned int VImageDimension = 2>
45 class OTBImageBase_EXPORT_TEMPLATE VectorImage
46  : public itk::VectorImage<TPixel, VImageDimension>
47  , public ImageCommons
48 {
49 public:
51  using Self = VectorImage;
52  using Superclass = itk::VectorImage<TPixel, VImageDimension>;
53  using Pointer = itk::SmartPointer<Self>;
54  using ConstPointer = itk::SmartPointer<const Self>;
55  using ConstWeakPointer = itk::WeakPointer<const Self>;
56 
58 
60  itkNewMacro(Self);
61 
63  itkTypeMacro(VectorImage, itk::VectorImage);
64 
67  typedef typename Superclass::PixelType PixelType;
68 
70  typedef typename Superclass::ValueType ValueType;
71 
76  typedef typename Superclass::InternalPixelType InternalPixelType;
77 
78  typedef typename Superclass::IOPixelType IOPixelType;
79 
82  // typedef itk::DefaultVectorPixelAccessor< InternalPixelType > AccessorType;
83 
86  typedef itk::DefaultVectorPixelAccessorFunctor<Self> AccessorFunctorType;
87 
89  typedef itk::VectorImageNeighborhoodAccessorFunctor<Self> NeighborhoodAccessorFunctorType;
90 
95  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
96 
98  typedef typename Superclass::PixelContainer PixelContainer;
99 
101  typedef typename Superclass::IndexType IndexType;
102 
104  typedef typename Superclass::OffsetType OffsetType;
105 
107  typedef typename Superclass::SizeType SizeType;
108 
110  typedef typename Superclass::DirectionType DirectionType;
111 
113  typedef typename Superclass::RegionType RegionType;
114 
117  typedef typename Superclass::SpacingType SpacingType;
118 
121  typedef typename Superclass::PointType PointType;
122 
124  virtual VectorType GetGeoTransform(void) const;
125 
127  // TODO: GenericRSTransform should be instantiated to translate from physical
128  // space to EPSG:4328 ?
129  VectorType GetUpperLeftCorner(void) const;
130  VectorType GetUpperRightCorner(void) const;
131  VectorType GetLowerLeftCorner(void) const;
132  VectorType GetLowerRightCorner(void) const;
134 
135 
138 
140  virtual void SetSignedSpacing(SpacingType spacing);
141  virtual void SetSignedSpacing(double spacing[VImageDimension]);
143 
144  virtual void SetNumberOfComponentsPerPixel(unsigned int n) override;
145 
147  void CopyInformation(const itk::DataObject*) override;
148 
149  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
150 
152  // AccessorType GetPixelAccessor( void )
153  // {
154  // return AccessorType( this->GetNumberOfComponentsPerPixel() );
155  // }
156 
158  // const AccessorType GetPixelAccessor( void ) const
159  // {
160  // return AccessorType( this->GetNumberOfComponentsPerPixel() );
161  // }
162 
165  {
166  return NeighborhoodAccessorFunctorType(this->GetNumberOfComponentsPerPixel());
167  }
168 
171  {
172  return NeighborhoodAccessorFunctorType(this->GetNumberOfComponentsPerPixel());
173  }
174 
175 protected:
176  VectorImage();
177  ~VectorImage() override
178  {
179  }
180 
181 private:
182  VectorImage(const Self&) = delete;
183  void operator=(const Self&) = delete;
184 };
185 
186 } // end namespace otb
187 
188 #ifndef OTB_MANUAL_INSTANTIATION
189 #include "otbVectorImage.hxx"
190 #endif
191 
192 #include <complex>
193 
194 namespace otb
195 {
196 
197 // Prevent implicit instantiation of common types to improve build performance
198 // Explicit instantiations are provided in the .cxx
199 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned int, 2>;
200 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<int, 2>;
201 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned char, 2>;
202 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<char, 2>;
203 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned short, 2>;
204 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<short, 2>;
205 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<float, 2>;
206 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<double, 2>;
207 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<int>, 2>;
208 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<short>, 2>;
209 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<float>, 2>;
210 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<double>, 2>;
211 }
212 
213 #endif
otb::VectorImage::RegionType
Superclass::RegionType RegionType
Definition: otbVectorImage.h:113
otb::VectorImage< unsigned short, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< unsigned short, 2 >
otb::VectorImage::OffsetType
Superclass::OffsetType OffsetType
Definition: otbVectorImage.h:104
otb::VectorImage< TOutputPixelType, 2 >::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorImage.h:53
otb::VectorImage::~VectorImage
~VectorImage() override
Definition: otbVectorImage.h:177
otb::VectorImage::SpacingType
Superclass::SpacingType SpacingType
Definition: otbVectorImage.h:117
otb::VectorImage::SizeType
Superclass::SizeType SizeType
Definition: otbVectorImage.h:107
otb::VectorImage< unsigned char, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< unsigned char, 2 >
otb::VectorImage< TOutputPixelType, 2 >::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbVectorImage.h:54
otb::VectorImage::GetNeighborhoodAccessor
const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
Definition: otbVectorImage.h:170
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::VectorImage< int, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< int, 2 >
otb::VectorImage< char, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< char, 2 >
otb::VectorImage< TOutputPixelType, 2 >::VectorType
ImageMetadataInterfaceBase::VectorType VectorType
Definition: otbVectorImage.h:57
otb::VectorImage::InternalPixelType
Superclass::InternalPixelType InternalPixelType
Definition: otbVectorImage.h:76
otb::VectorImage< TOutputPixelType, 2 >::ConstWeakPointer
itk::WeakPointer< const Self > ConstWeakPointer
Definition: otbVectorImage.h:55
otb::VectorImage< double, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< double, 2 >
otb::VectorImage::PointType
Superclass::PointType PointType
Definition: otbVectorImage.h:121
otb::VectorImage< TOutputPixelType, 2 >::Superclass
itk::VectorImage< TOutputPixelType, VImageDimension > Superclass
Definition: otbVectorImage.h:52
otb::ImageCommons
Definition: otbImageCommons.h:31
otb::VectorImage::PixelContainer
Superclass::PixelContainer PixelContainer
Definition: otbVectorImage.h:98
otbVectorImage.hxx
otb::VectorImage< unsigned int, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< unsigned int, 2 >
otb::VectorImage::AccessorFunctorType
itk::DefaultVectorPixelAccessorFunctor< Self > AccessorFunctorType
Definition: otbVectorImage.h:86
otb::VectorImage::NeighborhoodAccessorFunctorType
itk::VectorImageNeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType
Definition: otbVectorImage.h:89
otb::VectorImage< float, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< float, 2 >
otb::VectorImage< short, 2 >
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< short, 2 >
otb::ImageMetadataInterfaceBase::VectorType
MetaDataKey::VectorType VectorType
Definition: otbImageMetadataInterfaceBase.h:57
otb::VectorImage::PixelType
Superclass::PixelType PixelType
Definition: otbVectorImage.h:63
otbImageMetadataInterfaceBase.h
otb::VectorImage::IndexType
Superclass::IndexType IndexType
Definition: otbVectorImage.h:101
otb::VectorImage::GetNeighborhoodAccessor
NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
Definition: otbVectorImage.h:164
otb::internal::GetSignedSpacing
ImageType::SpacingType GetSignedSpacing(const ImageType *input)
Definition: otbImage.h:41
otb::VectorImage::ValueType
Superclass::ValueType ValueType
Definition: otbVectorImage.h:70
otb::VectorImage::DirectionType
Superclass::DirectionType DirectionType
Definition: otbVectorImage.h:110
otb::VectorImage::IOPixelType
Superclass::IOPixelType IOPixelType
Definition: otbVectorImage.h:78
otb::internal::SetSignedSpacing
void SetSignedSpacing(InputImage *input, SpacingType spacing)
Definition: otbImage.h:53
otbImageCommons.h
otb::VectorImage
Creation of an "otb" vector image which contains metadata.
Definition: otbVectorImage.h:45