OTB  6.7.0
Orfeo Toolbox
otbWrapperOutputImageParameter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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>
29 
30 
31 namespace otb
32 {
33 namespace Wrapper
34 {
41 class OTBApplicationEngine_EXPORT OutputImageParameter : public Parameter
42 {
43 public:
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  void Reset() override
85  {
86  m_PixelType = m_DefaultPixelType;
87  }
88 
90  static std::string ConvertPixelTypeToString(ImagePixelType type);
91 
94  static bool ConvertStringToPixelType(const std::string &value, ImagePixelType &type);
95 
97  bool HasValue() const override;
98 
99  void SetFileName (const char* filename);
100  void SetFileName (const std::string& filename);
101 
102  itkGetStringMacro(FileName);
103 
104  void Write();
105 
106  itk::ProcessObject* GetWriter();
107 
108  void InitializeWriters();
109 
110  std::string CheckFileName(bool fixMissingExtension = false);
111 
112  ParameterType GetType() const override
113  {
115  }
116 
117  std::string ToString() const override
118  {
119  return GetFileName();
120  }
121 
122  void FromString(const std::string& value) override
123  {
124  SetFileName(value);
125  }
126 
127 protected:
130 
132  ~OutputImageParameter() override;
133 
134 private:
135  OutputImageParameter(const Parameter &) = delete;
136  void operator =(const Parameter&) = delete;
137 
139  template <typename TInputImage>
140  void SwitchInput(TInputImage*);
141 
143  template <typename TOutputImage, typename TInputImage>
144  void ClampAndWriteVectorImage(TInputImage*);
145 
146  // FloatVectorImageType::Pointer m_Image;
148 
151 
153 
154  std::string m_FileName;
155 
158 
159  unsigned int m_RAMValue;
160 
161 }; // End class OutputImage Parameter
162 
163 } // End namespace Wrapper
164 } // End namespace otb
165 
166 #endif
This class represent a parameter for the wrapper framework This class is a high level class represent...
void FromString(const std::string &value) override
This class represents a OutputImage parameter.
itk::SmartPointer< const Self > ConstPointer
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
OTBApplicationEngine_EXPORT void Write(const std::string &filename, Application::Pointer application)