OTB  9.0.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-2022 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;
51  typedef typename OutputImageType::SpacingType SpacingType;
52  typedef typename OutputImageType::PointType OriginType;
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 
179  double m_Spacing[OutputImageType::ImageDimension];
180  double m_Origin[OutputImageType::ImageDimension];
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
otb::ImportVectorImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: otbImportVectorImageFilter.h:50
otb::ImportVectorImageFilter::GetRegion
const RegionType & GetRegion() const
Definition: otbImportVectorImageFilter.h:110
otb::ImportVectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImportVectorImageFilter.h:57
otb::ImportVectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbImportVectorImageFilter.h:58
otb::ImportVectorImageFilter::Self
ImportVectorImageFilter Self
Definition: otbImportVectorImageFilter.h:55
otb::ImportVectorImageFilter
Import data from a standard C array into an Image Type.
Definition: otbImportVectorImageFilter.h:45
otb::ImportVectorImageFilter::SetRegion
void SetRegion(const RegionType &region)
Definition: otbImportVectorImageFilter.h:96
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ImportVectorImageFilter::m_Region
RegionType m_Region
Definition: otbImportVectorImageFilter.h:178
otb::ImportVectorImageFilter::IndexType
itk::Index< OutputImageType::ImageDimension > IndexType
Definition: otbImportVectorImageFilter.h:64
otb::ImportVectorImageFilter::Superclass
itk::ImageSource< OutputImageType > Superclass
Definition: otbImportVectorImageFilter.h:56
otb::ImportVectorImageFilter::DirectionType
itk::Matrix< double, OutputImageType::ImageDimension, OutputImageType::ImageDimension > DirectionType
Definition: otbImportVectorImageFilter.h:139
otb::ImportVectorImageFilter::SpacingType
OutputImageType::SpacingType SpacingType
Definition: otbImportVectorImageFilter.h:51
otb::ImportVectorImageFilter::OriginType
OutputImageType::PointType OriginType
Definition: otbImportVectorImageFilter.h:52
otb::ImportVectorImageFilter::TOutputPixel
OutputImageType::PixelType TOutputPixel
Definition: otbImportVectorImageFilter.h:77
otb::ImportVectorImageFilter::OutputImageType
TOutputImageType OutputImageType
Definition: otbImportVectorImageFilter.h:49
otb::ImportVectorImageFilter::m_Size
unsigned long m_Size
Definition: otbImportVectorImageFilter.h:186
otb::ImportVectorImageFilter::m_NumberOfComponents
unsigned int m_NumberOfComponents
Definition: otbImportVectorImageFilter.h:185
otb::ImportVectorImageFilter::RegionType
itk::ImageRegion< OutputImageType::ImageDimension > RegionType
Definition: otbImportVectorImageFilter.h:74
otb::ImportVectorImageFilter::m_Direction
DirectionType m_Direction
Definition: otbImportVectorImageFilter.h:181
otb::ImportVectorImageFilter::m_ImportPointer
TPixel * m_ImportPointer
Definition: otbImportVectorImageFilter.h:183
otb::ImportVectorImageFilter::m_FilterManageMemory
bool m_FilterManageMemory
Definition: otbImportVectorImageFilter.h:184
otb::ImportVectorImageFilter::SizeType
itk::Size< OutputImageType::ImageDimension > SizeType
Definition: otbImportVectorImageFilter.h:70
otbImportVectorImageFilter.hxx
otb::ImportVectorImageFilter::TPixel
TOutputPixel::ValueType TPixel
Definition: otbImportVectorImageFilter.h:78