2020-05-28 22:49:28 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
//
|
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include <vtkm/io/ImageReaderBase.h>
|
|
|
|
|
|
|
|
#include <vtkm/cont/DataSetBuilderUniform.h>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace io
|
|
|
|
{
|
|
|
|
|
|
|
|
ImageReaderBase::ImageReaderBase(const char* filename)
|
|
|
|
: FileName(filename)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageReaderBase::ImageReaderBase(const std::string& filename)
|
|
|
|
: FileName(filename)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-08-17 14:18:24 +00:00
|
|
|
ImageReaderBase::~ImageReaderBase() noexcept {}
|
2020-05-28 22:49:28 +00:00
|
|
|
|
|
|
|
const vtkm::cont::DataSet& ImageReaderBase::ReadDataSet()
|
|
|
|
{
|
|
|
|
this->Read();
|
|
|
|
return this->DataSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImageReaderBase::InitializeImageDataSet(const vtkm::Id& width,
|
|
|
|
const vtkm::Id& height,
|
|
|
|
const ColorArrayType& pixels)
|
|
|
|
{
|
|
|
|
vtkm::cont::DataSetBuilderUniform dsb;
|
|
|
|
vtkm::Id2 dimensions(width, height);
|
|
|
|
this->DataSet = dsb.Create(dimensions);
|
|
|
|
this->DataSet.AddPointField(this->PointFieldName, pixels);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace vtkm::io
|