OTB  10.0.0
Orfeo Toolbox
otbScalarBufferToImageFileWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbScalarBufferToImageFileWriter_h
22 #define otbScalarBufferToImageFileWriter_h
23 
24 
25 #include "otbVectorImage.h"
26 #include "otbImageFileWriter.h"
27 #include "OTBImageIOExport.h"
28 
29 namespace otb
30 {
42 template <class TBufferType, class TOutputPixelType = TBufferType>
43 class OTBImageIO_EXPORT_TEMPLATE ScalarBufferToImageFileWriter : public itk::ProcessObject
44 {
45 public:
47  typedef itk::ProcessObject Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkNewMacro(Self);
53 
55  itkTypeMacro(ScalarBufferToImageFileWriter, itk::ProcessObject);
56 
58  typedef TBufferType BufferType;
59  typedef TOutputPixelType OutputPixelType;
60 
63  typedef typename ImageType::PixelType PixelType;
65  typedef typename ImageType::SizeType SizeType;
66  typedef typename ImageType::IndexType IndexType;
67 
71 
73  otbGetObjectMemberMacro(Writer, FileName, std::string);
74  otbSetObjectMemberMacro(Writer, FileName, std::string);
76 
78  itkGetMacro(ImageSize, SizeType);
79  itkSetMacro(ImageSize, SizeType);
81 
83  itkGetMacro(NumberOfChannels, unsigned int);
84  itkSetMacro(NumberOfChannels, unsigned int);
86 
88  itkGetMacro(InverseXSpacing, bool);
89  itkSetMacro(InverseXSpacing, bool);
91 
93  void SetBuffer(BufferType* pBuff)
94  {
95  m_Buffer = pBuff;
96  }
97 
98  void GenerateData() override;
99 
100  void Update() override
101  {
102  this->GenerateData();
103  }
104 
105 protected:
108  { /* don't call ClearBuffer, user's care */
109  }
110  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
111 
112 private:
114  void operator=(const Self&) = delete;
115 
116 
119 
122 
124  unsigned int m_NumberOfChannels;
125 
128 
131 };
132 
133 } // end namespace otb
134 
135 #ifndef OTB_MANUAL_INSTANTIATION
137 #endif
138 
139 #endif
Writes image data to a single file with streaming process.
itk::SmartPointer< Self > Pointer
void operator=(const Self &)=delete
otb::VectorImage< OutputPixelType, 2 > ImageType
otbGetObjectMemberMacro(Writer, FileName, std::string)
ScalarBufferToImageFileWriter(const Self &)=delete
otbSetObjectMemberMacro(Writer, FileName, std::string)
otb::ImageFileWriter< ImageType > WriterType
Creation of an "otb" vector image which contains metadata.
Superclass::PixelType PixelType
Superclass::IndexType IndexType
Superclass::SizeType SizeType
Superclass::RegionType RegionType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.