OTB  7.1.0
Orfeo Toolbox
otbImportVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 
23 #ifndef otbImportVectorImageFilter_h
24 #define otbImportVectorImageFilter_h
25 
26 #include "itkImageSource.h"
27 
28 namespace otb
29 {
30 
44 template <typename TOutputImageType>
45 class ITK_EXPORT ImportVectorImageFilter : public itk::ImageSource<TOutputImageType>
46 {
47 public:
49  typedef TOutputImageType OutputImageType;
50  typedef typename OutputImageType::Pointer OutputImagePointer;
53 
56  typedef itk::ImageSource<OutputImageType> Superclass;
57  typedef itk::SmartPointer<Self> Pointer;
58  typedef itk::SmartPointer<const Self> ConstPointer;
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(ImportVectorImageFilter, itk::ImageSource);
65 
67  typedef itk::Index<OutputImageType::ImageDimension> IndexType;
68 
70  typedef itk::Size<OutputImageType::ImageDimension> SizeType;
71 
74  typedef itk::ImageRegion<OutputImageType::ImageDimension> RegionType;
75 
77  typedef typename OutputImageType::PixelType TOutputPixel;
78  typedef typename TOutputPixel::ValueType TPixel;
79 
81  TPixel* GetImportPointer();
82 
90  virtual void SetImportPointer(TPixel* ptr, unsigned long num, bool LetFilterManageMemory);
91 
96  void SetRegion(const RegionType& region)
97  {
98  if (m_Region != region)
99  {
100  m_Region = region;
101  this->Modified();
102  }
103  }
105 
110  const RegionType& GetRegion() const
111  {
112  return m_Region;
113  }
114 
117  itkSetVectorMacro(Spacing, const double, OutputImageType::ImageDimension);
118  itkSetVectorMacro(Spacing, const float, OutputImageType::ImageDimension);
120 
123  itkGetVectorMacro(Spacing, const double, OutputImageType::ImageDimension);
124  void SetSpacing(const SpacingType& spacing);
126 
129  itkSetVectorMacro(Origin, const double, OutputImageType::ImageDimension);
130  itkSetVectorMacro(Origin, const float, OutputImageType::ImageDimension);
131  void SetOrigin(const OriginType& origin);
133 
134  itkGetMacro(NumberOfComponents, unsigned int);
135  itkSetMacro(NumberOfComponents, unsigned int);
136 
139  itkGetVectorMacro(Origin, const double, OutputImageType::ImageDimension);
140 
141  typedef itk::Matrix<double, OutputImageType::ImageDimension, OutputImageType::ImageDimension> DirectionType;
142 
145  virtual void SetDirection(const DirectionType direction);
146 
149  itkGetConstReferenceMacro(Direction, DirectionType);
150 
151 protected:
153  virtual ~ImportVectorImageFilter();
154  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
155 
158  void GenerateData() override;
159 
163  void GenerateOutputInformation() override;
164 
172  void EnlargeOutputRequestedRegion(itk::DataObject* output) override;
173 
174 private:
176  void operator=(const ImportVectorImageFilter&) = delete;
177 
178  RegionType m_Region;
179  double m_Spacing[OutputImageType::ImageDimension];
180  double m_Origin[OutputImageType::ImageDimension];
181  DirectionType m_Direction;
182 
185  unsigned int m_NumberOfComponents;
186  unsigned long m_Size;
187 };
188 
189 } // end namespace otb
190 
191 #ifndef OTB_MANUAL_INSTANTIATION
193 #endif
194 
195 #endif
itk::Index< OutputImageType::ImageDimension > IndexType
OutputImageType::Pointer OutputImagePointer
itk::Size< OutputImageType::ImageDimension > SizeType
itk::Matrix< double, OutputImageType::ImageDimension, OutputImageType::ImageDimension > DirectionType
OutputImageType::PointType OriginType
OutputImageType::PixelType TOutputPixel
itk::ImageRegion< OutputImageType::ImageDimension > RegionType
const RegionType & GetRegion() const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
OutputImageType::SpacingType SpacingType
Import data from a standard C array into an Image Type.
VectorImageType::SpacingType SpacingType
Definition: mvdTypes.h:175
VectorImageType::PointType PointType
Definition: mvdTypes.h:183
void SetRegion(const RegionType &region)
itk::ImageSource< OutputImageType > Superclass
itk::SmartPointer< const Self > ConstPointer