16 #ifndef SURGSIM_DATASTRUCTURES_IMAGE_INL_H 17 #define SURGSIM_DATASTRUCTURES_IMAGE_INL_H 22 namespace DataStructures
33 m_data(new T[width * height * channels])
39 Image<T>::Image(
size_t width,
size_t height,
size_t channels,
const T*
const data) :
40 m_data(new T[width * height * channels])
43 std::copy(data, data + width * height * channels, m_data.get());
48 Image<T>::Image(
size_t width,
size_t height,
size_t channels,
const D*
const data) :
49 m_data(new T[width * height * channels])
52 Eigen::Map<const Eigen::Matrix<D, Eigen::Dynamic, 1>> theirData(data, width * height * channels);
53 Eigen::Map<typename ImageBase<T>::VectorType, Eigen::Unaligned> myData(m_data.get(), width * height * channels);
54 myData = theirData.template cast<T>();
62 m_data = std::unique_ptr<T[]>(
new T[size]);
63 std::copy(other.m_data.get(), other.m_data.get() + size, m_data.get());
70 *
this = std::move(other);
80 if (newDataSize != oldDataSize)
82 m_data.reset(
new T[newDataSize]);
85 std::copy(other.m_data.get(), other.m_data.get() + newDataSize, m_data.get());
95 m_data = std::move(other.m_data);
98 other.setSize(0, 0, 0);
123 #endif //SURGSIM_DATASTRUCTURES_IMAGE_INL_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A templated Image class.
Definition: Image.h:33
size_t getHeight() const
Get the Image height.
Definition: ImageBase-inl.h:109
Image< T > & operator=(const Image< T > &other)
Assignment Operator.
Definition: Image-inl.h:74
Image()
Default Constructor.
Definition: Image-inl.h:26
T *const getData() override
Get the pointer to the data.
Definition: Image-inl.h:109
void setSize(size_t width, size_t height, size_t channels)
Set the Image size.
Definition: ImageBase-inl.h:128
size_t getWidth() const
Get the Image width.
Definition: ImageBase-inl.h:103
virtual ~Image()
Destructor.
Definition: Image-inl.h:104
size_t getNumChannels() const
Get the number of channels in this Image.
Definition: ImageBase-inl.h:122