VTK-m  2.2
ImageWriterBase.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_io_ImageWriterBase_h
11 #define vtk_m_io_ImageWriterBase_h
12 
13 #include <vtkm/cont/DataSet.h>
14 
15 #include <vtkm/io/vtkm_io_export.h>
16 
17 namespace vtkm
18 {
19 namespace io
20 {
21 
36 {
37 public:
39 
40  VTKM_CONT ImageWriterBase(const char* filename);
42  VTKM_CONT ImageWriterBase(const std::string& filename);
43  VTKM_CONT virtual ~ImageWriterBase() noexcept;
44  ImageWriterBase(const ImageWriterBase&) = delete;
45  ImageWriterBase& operator=(const ImageWriterBase&) = delete;
46 
55  VTKM_CONT virtual void WriteDataSet(const vtkm::cont::DataSet& dataSet,
56  const std::string& colorField = {});
57 
58  enum class PixelDepth
59  {
60  PIXEL_8,
61  PIXEL_16
62  };
63 
65  VTKM_CONT PixelDepth GetPixelDepth() const { return this->Depth; }
67  VTKM_CONT void SetPixelDepth(PixelDepth depth) { this->Depth = depth; }
68 
69  VTKM_CONT const std::string& GetFileName() const { return this->FileName; }
70  VTKM_CONT void SetFileName(const std::string& filename) { this->FileName = filename; }
71 
72 protected:
73  std::string FileName;
74  PixelDepth Depth = PixelDepth::PIXEL_8;
75 
76  VTKM_CONT virtual void Write(vtkm::Id width, vtkm::Id height, const ColorArrayType& pixels) = 0;
77 };
78 }
79 }
80 
81 #endif //vtk_m_io_ImageWriterBase_h
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
vtkm::io::ImageWriterBase
Manages writing, and loading data from images.
Definition: ImageWriterBase.h:35
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::io::ImageWriterBase::SetPixelDepth
void SetPixelDepth(PixelDepth depth)
Specify the number of bits used by each color channel.
Definition: ImageWriterBase.h:67
vtkm_io_export.h
VTKM_IO_EXPORT
#define VTKM_IO_EXPORT
Definition: vtkm_io_export.h:44
vtkm::io::ImageWriterBase::SetFileName
void SetFileName(const std::string &filename)
Definition: ImageWriterBase.h:70
vtkm::io::ImageWriterBase::GetPixelDepth
PixelDepth GetPixelDepth() const
Specify the number of bits used by each color channel.
Definition: ImageWriterBase.h:65
vtkm::io::ImageWriterBase::PixelDepth
PixelDepth
Definition: ImageWriterBase.h:58
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
Depth
vtkm::Float32 Depth
Definition: Wireframer.h:116
vtkm::io::ImageWriterBase::GetFileName
const std::string & GetFileName() const
Definition: ImageWriterBase.h:69
DataSet.h
vtkm::io::ImageWriterBase::FileName
std::string FileName
Definition: ImageWriterBase.h:73