OTB  9.0.0
Orfeo Toolbox
otbScalarBufferToImageFileWriter.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 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:
113  ScalarBufferToImageFileWriter(const Self&) = delete;
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
otb::ScalarBufferToImageFileWriter::~ScalarBufferToImageFileWriter
~ScalarBufferToImageFileWriter() override
Definition: otbScalarBufferToImageFileWriter.h:107
otb::ScalarBufferToImageFileWriter::m_ImageSize
SizeType m_ImageSize
Definition: otbScalarBufferToImageFileWriter.h:127
otb::ScalarBufferToImageFileWriter
Record an image stored in a buffer.
Definition: otbScalarBufferToImageFileWriter.h:43
otb::ScalarBufferToImageFileWriter::PixelType
ImageType::PixelType PixelType
Definition: otbScalarBufferToImageFileWriter.h:63
otb::VectorImage::RegionType
Superclass::RegionType RegionType
Definition: otbVectorImage.h:113
otbVectorImage.h
otb::ScalarBufferToImageFileWriter::WriterPointer
WriterType::Pointer WriterPointer
Definition: otbScalarBufferToImageFileWriter.h:70
otb::VectorImage::SizeType
Superclass::SizeType SizeType
Definition: otbVectorImage.h:107
otb::ScalarBufferToImageFileWriter::SetBuffer
void SetBuffer(BufferType *pBuff)
Definition: otbScalarBufferToImageFileWriter.h:93
otb::ScalarBufferToImageFileWriter::OutputPixelType
TOutputPixelType OutputPixelType
Definition: otbScalarBufferToImageFileWriter.h:59
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ScalarBufferToImageFileWriter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbScalarBufferToImageFileWriter.h:48
otb::ScalarBufferToImageFileWriter::Update
void Update() override
Definition: otbScalarBufferToImageFileWriter.h:100
otb::ScalarBufferToImageFileWriter::m_InverseXSpacing
bool m_InverseXSpacing
Definition: otbScalarBufferToImageFileWriter.h:130
otb::ScalarBufferToImageFileWriter::WriterType
otb::ImageFileWriter< ImageType > WriterType
Definition: otbScalarBufferToImageFileWriter.h:69
otb::ScalarBufferToImageFileWriter::ImageType
otb::VectorImage< OutputPixelType, 2 > ImageType
Definition: otbScalarBufferToImageFileWriter.h:62
otb::ImageFileWriter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImageFileWriter.h:72
otbScalarBufferToImageFileWriter.hxx
otb::ScalarBufferToImageFileWriter::m_Writer
WriterPointer m_Writer
Definition: otbScalarBufferToImageFileWriter.h:118
otb::ScalarBufferToImageFileWriter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbScalarBufferToImageFileWriter.h:49
otb::ScalarBufferToImageFileWriter::m_NumberOfChannels
unsigned int m_NumberOfChannels
Definition: otbScalarBufferToImageFileWriter.h:124
otb::ScalarBufferToImageFileWriter::Self
ScalarBufferToImageFileWriter Self
Definition: otbScalarBufferToImageFileWriter.h:46
otb::ScalarBufferToImageFileWriter::m_Buffer
BufferType * m_Buffer
Definition: otbScalarBufferToImageFileWriter.h:121
otb::ScalarBufferToImageFileWriter::Superclass
itk::ProcessObject Superclass
Definition: otbScalarBufferToImageFileWriter.h:47
otb::ImageFileWriter
Writes image data to a single file with streaming process.
Definition: otbImageFileWriter.h:66
otb::VectorImage::PixelType
Superclass::PixelType PixelType
Definition: otbVectorImage.h:63
otb::VectorImage::IndexType
Superclass::IndexType IndexType
Definition: otbVectorImage.h:101
otbImageFileWriter.h
otb::ScalarBufferToImageFileWriter::BufferType
TBufferType BufferType
Definition: otbScalarBufferToImageFileWriter.h:55
otbGetObjectMemberMacro
#define otbGetObjectMemberMacro(object, name, type)
Definition: otbMacro.h:89
otbSetObjectMemberMacro
#define otbSetObjectMemberMacro(object, name, type)
Definition: otbMacro.h:79
otb::ScalarBufferToImageFileWriter::RegionType
ImageType::RegionType RegionType
Definition: otbScalarBufferToImageFileWriter.h:64
otb::ScalarBufferToImageFileWriter::SizeType
ImageType::SizeType SizeType
Definition: otbScalarBufferToImageFileWriter.h:65
otb::ScalarBufferToImageFileWriter::IndexType
ImageType::IndexType IndexType
Definition: otbScalarBufferToImageFileWriter.h:66
otb::VectorImage
Creation of an "otb" vector image which contains metadata.
Definition: otbVectorImage.h:45