OTB  7.2.0
Orfeo Toolbox
otbWrapperOutputImageParameter.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 #ifndef otbWrapperOutputImageParameter_h
22 #define otbWrapperOutputImageParameter_h
23 
24 //#include "otbVectorImage.h"
25 #include "itkImageBase.h"
26 #include "otbWrapperParameter.h"
27 #include "otbImageFileWriter.h"
28 #include <string>
30 
31 namespace otb
32 {
33 namespace Wrapper
34 {
41 class OTBApplicationEngine_EXPORT OutputImageParameter : public Parameter
42 {
43 public:
47  typedef itk::SmartPointer<Self> Pointer;
48  typedef itk::SmartPointer<const Self> ConstPointer;
49 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(OutputImageParameter, Parameter);
55 
57  itkSetObjectMacro(Image, ImageBaseType);
58 
60  itkGetObjectMacro(Image, ImageBaseType);
61 
63  void SetValue(ImageBaseType* image);
64 
66  ImageBaseType* GetValue(void);
67 
69  itkSetMacro(PixelType, ImagePixelType);
70  itkGetMacro(PixelType, ImagePixelType);
72 
74  itkSetMacro(DefaultPixelType, ImagePixelType);
75  itkGetMacro(DefaultPixelType, ImagePixelType);
77 
79  itkSetMacro(RAMValue, unsigned int);
80  itkGetMacro(RAMValue, unsigned int);
82 
84  bool IsMultiWritingEnabled();
85 
87  void Reset() override
88  {
89  m_PixelType = m_DefaultPixelType;
90  }
91 
93  static std::string ConvertPixelTypeToString(ImagePixelType type);
94 
97  static bool ConvertStringToPixelType(const std::string& value, ImagePixelType& type);
98 
100  bool HasValue() const override;
101 
102  void SetFileName(const char* filename);
103  void SetFileName(const std::string& filename);
104 
105  itkGetStringMacro(FileName);
106 
107  void Write();
108 
109  itk::ProcessObject* GetWriter();
110 
113 
114  std::string CheckFileName(bool fixMissingExtension = false);
115 
116  ParameterType GetType() const override
117  {
119  }
120 
121  std::string ToString() const override
122  {
123  return GetFileName();
124  }
125 
126  void FromString(const std::string& value) override
127  {
128  SetFileName(value);
129  }
130 
131 protected:
134 
136  ~OutputImageParameter() override;
137 
138 private:
139  OutputImageParameter(const Parameter&) = delete;
140  void operator=(const Parameter&) = delete;
141 
143  template <typename TInputImage>
144  void SwitchInput(TInputImage*);
145 
147  template <typename TOutputImage, typename TInputImage>
148  void ClampAndWriteVectorImage(TInputImage*);
149 
150  // FloatVectorImageType::Pointer m_Image;
151  ImageBaseType::Pointer m_Image;
152 
153  itk::ProcessObject::Pointer m_InputCaster;
154  itk::ProcessObject::Pointer m_OutputCaster;
155 
156  itk::ProcessObject::Pointer m_Writer;
157 
158  std::string m_FileName;
159 
162 
163  unsigned int m_RAMValue;
164 
167 }; // End class OutputImage Parameter
168 
169 } // End namespace Wrapper
170 } // End namespace otb
171 
172 #endif
otb::MultiImageFileWriter::Pointer m_MultiWriter
This class represent a parameter for the wrapper framework This class is a high level class represent...
void FromString(const std::string &value) override
itk::SmartPointer< Self > Pointer
This class represents a OutputImage parameter.
itk::SmartPointer< const Self > ConstPointer
itk::ImageBase< 2 > ImageBaseType
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
static constexpr GLenum value() noexcept
OTBApplicationEngine_EXPORT void Write(const std::string &filename, Application::Pointer application)