OTB  9.0.0
Orfeo Toolbox
otbWrapperOutputImageParameter.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 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::Wrapper::OutputImageParameter::ToString
std::string ToString() const override
Definition: otbWrapperOutputImageParameter.h:121
otb::Wrapper::Parameter
This class represent a parameter for the wrapper framework This class is a high level class represent...
Definition: otbWrapperParameter.h:49
otb::Wrapper::OutputImageParameter
This class represents a OutputImage parameter.
Definition: otbWrapperOutputImageParameter.h:41
otb::Wrapper::OutputImageParameter::m_RAMValue
unsigned int m_RAMValue
Definition: otbWrapperOutputImageParameter.h:163
otb::Wrapper::OutputImageParameter::Self
OutputImageParameter Self
Definition: otbWrapperOutputImageParameter.h:45
otb::Wrapper::OutputImageParameter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbWrapperOutputImageParameter.h:48
otb::MultiImageFileWriter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMultiImageFileWriter.h:53
otb::Wrapper::ImagePixelType
ImagePixelType
Definition: otbWrapperTypes.h:104
otb::Wrapper::XML::Write
OTBApplicationEngine_EXPORT void Write(const std::string &filename, Application::Pointer application)
otb::Wrapper::OutputImageParameter::m_Writer
itk::ProcessObject::Pointer m_Writer
Definition: otbWrapperOutputImageParameter.h:156
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Image
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
otb::Wrapper::OutputImageParameter::m_OutputCaster
itk::ProcessObject::Pointer m_OutputCaster
Definition: otbWrapperOutputImageParameter.h:154
otb::Wrapper::OutputImageParameter::Reset
void Reset() override
Definition: otbWrapperOutputImageParameter.h:87
otb::Wrapper::OutputImageParameter::m_DefaultPixelType
ImagePixelType m_DefaultPixelType
Definition: otbWrapperOutputImageParameter.h:161
otb::Wrapper::OutputImageParameter::GetType
ParameterType GetType() const override
Definition: otbWrapperOutputImageParameter.h:116
otb::Wrapper::OutputImageParameter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperOutputImageParameter.h:47
otb::Wrapper::ImageBaseType
itk::ImageBase< 2 > ImageBaseType
Definition: otbWrapperTypes.h:180
otb::Wrapper::OutputImageParameter::m_PixelType
ImagePixelType m_PixelType
Definition: otbWrapperOutputImageParameter.h:160
otb::Wrapper::ParameterType_OutputImage
@ ParameterType_OutputImage
Definition: otbWrapperTypes.h:52
otb::Wrapper::OutputImageParameter::m_Image
ImageBaseType::Pointer m_Image
Definition: otbWrapperOutputImageParameter.h:151
otbMultiImageFileWriter.h
otb::Wrapper::OutputImageParameter::m_MultiWriter
otb::MultiImageFileWriter::Pointer m_MultiWriter
Definition: otbWrapperOutputImageParameter.h:166
otbImageFileWriter.h
otb::Wrapper::OutputImageParameter::FromString
void FromString(const std::string &value) override
Definition: otbWrapperOutputImageParameter.h:126
otb::Wrapper::OutputImageParameter::Superclass
Parameter Superclass
Definition: otbWrapperOutputImageParameter.h:46
otbWrapperParameter.h
otb::Wrapper::OutputImageParameter::m_FileName
std::string m_FileName
Definition: otbWrapperOutputImageParameter.h:158
otb::Wrapper::OutputImageParameter::m_InputCaster
itk::ProcessObject::Pointer m_InputCaster
Definition: otbWrapperOutputImageParameter.h:153
otb::Wrapper::ParameterType
ParameterType
Definition: otbWrapperTypes.h:37