VTK-m  2.0
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 
32 class VTKM_IO_EXPORT ImageReaderBase
33 {
34 public:
36 
37  explicit VTKM_CONT ImageReaderBase(const char* filename);
38  explicit VTKM_CONT ImageReaderBase(const std::string& filename);
39  virtual VTKM_CONT ~ImageReaderBase() noexcept;
40  ImageReaderBase(const ImageReaderBase&) = delete;
41  ImageReaderBase& operator=(const ImageReaderBase&) = delete;
42 
43  VTKM_CONT const vtkm::cont::DataSet& ReadDataSet();
44 
45  VTKM_CONT const vtkm::cont::DataSet& GetDataSet() const { return this->DataSet; }
46 
47  VTKM_CONT const std::string& GetPointFieldName() const { return this->PointFieldName; }
48  VTKM_CONT void SetPointFieldName(const std::string& name) { this->PointFieldName = name; }
49 
50  VTKM_CONT const std::string& GetFileName() const { return this->FileName; }
51  VTKM_CONT void SetFileName(const std::string& filename) { this->FileName = filename; }
52 
53 protected:
54  VTKM_CONT virtual void Read() = 0;
55 
57  void InitializeImageDataSet(const vtkm::Id& width,
58  const vtkm::Id& height,
59  const ColorArrayType& pixels);
60 
61  std::string FileName;
62  std::string PointFieldName = "color";
64 };
65 }
66 } // namespace vtkm::io
67 
68 #endif //vtk_m_io_ImageReaderBase_h
vtkm::cont::ArrayHandle< vtkm::Vec4f_32 >
vtkm::io::ImageReaderBase::GetFileName
const VTKM_CONT std::string & GetFileName() const
Definition: ImageReaderBase.h:50
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::io::ImageReaderBase::SetPointFieldName
VTKM_CONT void SetPointFieldName(const std::string &name)
Definition: ImageReaderBase.h:48
vtkm::cont::DataSet
Definition: DataSet.h:34
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::io::ImageReaderBase
Manages reading, and loading data from images.
Definition: ImageReaderBase.h:32
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::io::ImageReaderBase::SetFileName
VTKM_CONT void SetFileName(const std::string &filename)
Definition: ImageReaderBase.h:51
vtkm::io::ImageReaderBase::GetPointFieldName
const VTKM_CONT std::string & GetPointFieldName() const
Definition: ImageReaderBase.h:47
DataSet.h
vtkm::io::ImageReaderBase::DataSet
vtkm::cont::DataSet DataSet
Definition: ImageReaderBase.h:63
vtkm::io::ImageReaderBase::FileName
std::string FileName
Definition: ImageReaderBase.h:61