VTK-m  2.1
ImageReaderBase.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_ImageReaderBase_h
11 #define vtk_m_io_ImageReaderBase_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 
33 {
34 public:
36 
37  explicit VTKM_CONT ImageReaderBase(const char* filename);
39  explicit VTKM_CONT ImageReaderBase(const std::string& filename);
40  virtual VTKM_CONT ~ImageReaderBase() noexcept;
41  ImageReaderBase(const ImageReaderBase&) = delete;
42  ImageReaderBase& operator=(const ImageReaderBase&) = delete;
43 
45  VTKM_CONT const vtkm::cont::DataSet& ReadDataSet();
46 
47  VTKM_CONT const vtkm::cont::DataSet& GetDataSet() const { return this->DataSet; }
48 
50  VTKM_CONT const std::string& GetPointFieldName() const { return this->PointFieldName; }
52  VTKM_CONT void SetPointFieldName(const std::string& name) { this->PointFieldName = name; }
53 
54  VTKM_CONT const std::string& GetFileName() const { return this->FileName; }
55  VTKM_CONT void SetFileName(const std::string& filename) { this->FileName = filename; }
56 
57 protected:
58  VTKM_CONT virtual void Read() = 0;
59 
61  void InitializeImageDataSet(const vtkm::Id& width,
62  const vtkm::Id& height,
63  const ColorArrayType& pixels);
64 
65  std::string FileName;
66  std::string PointFieldName = "color";
68 };
69 }
70 } // namespace vtkm::io
71 
72 #endif //vtk_m_io_ImageReaderBase_h
vtkm::io::ImageReaderBase::SetPointFieldName
void SetPointFieldName(const std::string &name)
Set the name of the output field that will be created to hold color data.
Definition: ImageReaderBase.h:52
vtkm::io::ImageReaderBase::GetFileName
const std::string & GetFileName() const
Definition: ImageReaderBase.h:54
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
vtkm_io_export.h
VTKM_IO_EXPORT
#define VTKM_IO_EXPORT
Definition: vtkm_io_export.h:44
vtkm::io::ImageReaderBase::GetPointFieldName
const std::string & GetPointFieldName() const
Get the name of the output field that will be created to hold color data.
Definition: ImageReaderBase.h:50
vtkm::io::ImageReaderBase
Manages reading, and loading data from images.
Definition: ImageReaderBase.h:32
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
vtkm::io::ImageReaderBase::SetFileName
void SetFileName(const std::string &filename)
Definition: ImageReaderBase.h:55
DataSet.h
vtkm::io::ImageReaderBase::DataSet
vtkm::cont::DataSet DataSet
Definition: ImageReaderBase.h:67
vtkm::io::ImageReaderBase::FileName
std::string FileName
Definition: ImageReaderBase.h:65