VTK-m  2.0
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 
35 class VTKM_IO_EXPORT ImageWriterBase
36 {
37 public:
39 
40  VTKM_CONT ImageWriterBase(const char* filename);
41  VTKM_CONT ImageWriterBase(const std::string& filename);
42  VTKM_CONT virtual ~ImageWriterBase() noexcept;
43  ImageWriterBase(const ImageWriterBase&) = delete;
44  ImageWriterBase& operator=(const ImageWriterBase&) = delete;
45 
55  VTKM_CONT virtual void WriteDataSet(const vtkm::cont::DataSet& dataSet,
56  const std::string& colorField = {});
58 
59  enum class PixelDepth
60  {
61  PIXEL_8,
62  PIXEL_16
63  };
64 
68  VTKM_CONT PixelDepth GetPixelDepth() const { return this->Depth; }
69  VTKM_CONT void SetPixelDepth(PixelDepth depth) { this->Depth = depth; }
71 
72  VTKM_CONT const std::string& GetFileName() const { return this->FileName; }
73  VTKM_CONT void SetFileName(const std::string& filename) { this->FileName = filename; }
74 
75 protected:
76  std::string FileName;
77  PixelDepth Depth = PixelDepth::PIXEL_8;
78 
79  VTKM_CONT virtual void Write(vtkm::Id width, vtkm::Id height, const ColorArrayType& pixels) = 0;
80 };
81 }
82 }
83 
84 #endif //vtk_m_io_ImageWriterBase_h
vtkm::cont::ArrayHandle< vtkm::Vec4f_32 >
vtkm::io::ImageWriterBase
Manages writing, and loading data from images.
Definition: ImageWriterBase.h:35
vtkm::io::ImageWriterBase::SetFileName
VTKM_CONT void SetFileName(const std::string &filename)
Definition: ImageWriterBase.h:73
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::io::ImageWriterBase::SetPixelDepth
VTKM_CONT void SetPixelDepth(PixelDepth depth)
Definition: ImageWriterBase.h:69
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::io::ImageWriterBase::GetPixelDepth
VTKM_CONT PixelDepth GetPixelDepth() const
Definition: ImageWriterBase.h:68
vtkm::io::ImageWriterBase::PixelDepth
PixelDepth
Definition: ImageWriterBase.h:59
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
Depth
vtkm::Float32 Depth
Definition: Wireframer.h:116
vtkm::io::ImageWriterBase::GetFileName
const VTKM_CONT std::string & GetFileName() const
Definition: ImageWriterBase.h:72
DataSet.h
vtkm::io::ImageWriterBase::FileName
std::string FileName
Definition: ImageWriterBase.h:76