Viskores  1.0
ImageReaderBase.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_io_ImageReaderBase_h
19 #define viskores_io_ImageReaderBase_h
20 
21 #include <viskores/cont/DataSet.h>
22 
24 
25 namespace viskores
26 {
27 namespace io
28 {
29 
40 class VISKORES_IO_EXPORT ImageReaderBase
41 {
42 public:
44 
45  explicit VISKORES_CONT ImageReaderBase(const char* filename);
47  explicit VISKORES_CONT ImageReaderBase(const std::string& filename);
48  virtual VISKORES_CONT ~ImageReaderBase() noexcept;
49  ImageReaderBase(const ImageReaderBase&) = delete;
50  ImageReaderBase& operator=(const ImageReaderBase&) = delete;
51 
53  VISKORES_CONT const viskores::cont::DataSet& ReadDataSet();
54 
55  VISKORES_CONT const viskores::cont::DataSet& GetDataSet() const { return this->DataSet; }
56 
58  VISKORES_CONT const std::string& GetPointFieldName() const { return this->PointFieldName; }
60  VISKORES_CONT void SetPointFieldName(const std::string& name) { this->PointFieldName = name; }
61 
62  VISKORES_CONT const std::string& GetFileName() const { return this->FileName; }
63  VISKORES_CONT void SetFileName(const std::string& filename) { this->FileName = filename; }
64 
65 protected:
66  VISKORES_CONT virtual void Read() = 0;
67 
69  void InitializeImageDataSet(const viskores::Id& width,
70  const viskores::Id& height,
71  const ColorArrayType& pixels);
72 
73  std::string FileName;
74  std::string PointFieldName = "color";
76 };
77 }
78 } // namespace viskores::io
79 
80 #endif //viskores_io_ImageReaderBase_h
viskores::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:58
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::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:60
viskores_io_export.h
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::io::ImageReaderBase::SetFileName
void SetFileName(const std::string &filename)
Definition: ImageReaderBase.h:63
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::io::ImageReaderBase::FileName
std::string FileName
Definition: ImageReaderBase.h:73
viskores::io::ImageReaderBase::GetFileName
const std::string & GetFileName() const
Definition: ImageReaderBase.h:62
viskores::io::ImageReaderBase::DataSet
viskores::cont::DataSet DataSet
Definition: ImageReaderBase.h:75
viskores::io::ImageReaderBase
Manages reading, and loading data from images.
Definition: ImageReaderBase.h:40
DataSet.h