FAST  3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
fast::Tensor Class Reference

#include <Tensor.hpp>

+ Inheritance diagram for fast::Tensor:
+ Collaboration diagram for fast::Tensor:

Public Member Functions

virtual void create (std::unique_ptr< float[]> data, TensorShape shape)
 
virtual void create (const float *const data, TensorShape shape)
 
virtual void create (TensorShape shape)
 
virtual void create (std::initializer_list< float > data)
 
virtual void expandDims (int position=0)
 
virtual TensorShape getShape () const
 
virtual TensorAccess::pointer getAccess (accessType type)
 
virtual std::unique_ptr< OpenCLBufferAccessgetOpenCLBufferAccess (accessType type, OpenCLDevice::pointer)
 
virtual void freeAll () override
 
virtual void free (ExecutionDevice::pointer device) override
 
virtual void setSpacing (VectorXf spacing)
 
virtual VectorXf getSpacing () const
 
virtual void deleteDimension (int dimension)
 
virtual DataBoundingBox getTransformedBoundingBox () const override
 
virtual DataBoundingBox getBoundingBox () const override
 
virtual ~Tensor ()
 
- Public Member Functions inherited from fast::SpatialDataObject
 SpatialDataObject ()
 
SceneGraphNode::pointer getSceneGraphNode () const
 
- Public Member Functions inherited from fast::DataObject
 DataObject ()
 
void setMetadata (std::string name, std::string value)
 
void setMetadata (std::unordered_map< std::string, std::string > metadata)
 
std::string getMetadata (std::string name) const
 
std::unordered_map< std::string, std::string > getMetadata () const
 
void deleteMetadata (std::string name)
 
uint64_t getTimestamp () const
 
void updateModifiedTimestamp ()
 
virtual ~DataObject ()
 
virtual std::string getNameOfClass () const =0
 
uint64_t getCreationTimestamp () const
 
void setCreationTimestamp (uint64_t timestamp)
 
void setLastFrame (std::string streamer)
 
bool isLastFrame ()
 
bool isLastFrame (std::string streamer)
 
std::unordered_set< std::string > getLastFrame ()
 
void setFrameData (std::string name, std::string value)
 
std::string getFrameData (std::string name)
 
std::unordered_map< std::string, std::string > getFrameData ()
 
void accessFinished ()
 
- Public Member Functions inherited from fast::Object
 Object ()
 
virtual ~Object ()
 
ReportergetReporter ()
 

Protected Member Functions

 Tensor ()=default
 
virtual bool isInitialized ()
 
virtual void transferCLBufferFromHost (OpenCLDevice::pointer device)
 
void transferCLBufferToHost (OpenCLDevice::pointer device)
 
void updateOpenCLBufferData (OpenCLDevice::pointer device)
 
void setAllDataToOutOfDate ()
 
virtual bool hasAnyData ()
 
void updateHostData ()
 
virtual float * getHostDataPointer ()
 
- Protected Member Functions inherited from fast::DataObject
void blockIfBeingWrittenTo ()
 
void blockIfBeingAccessed ()
 
- Protected Member Functions inherited from fast::Object
ReporterreportError ()
 
ReporterreportWarning ()
 
ReporterreportInfo ()
 
ReporterEnd reportEnd () const
 

Protected Attributes

std::unique_ptr< float[]> m_data
 
std::unordered_map< std::shared_ptr< OpenCLDevice >, cl::Buffer * > mCLBuffers
 
std::unordered_map< std::shared_ptr< OpenCLDevice >, bool > mCLBuffersIsUpToDate
 
TensorShape m_shape
 
bool mHostDataIsUpToDate
 
VectorXf m_spacing
 
friend TensorAccess
 
friend OpenCLBufferAccess
 
- Protected Attributes inherited from fast::SpatialDataObject
DataBoundingBox mBoundingBox
 
- Protected Attributes inherited from fast::DataObject
std::mutex mDataIsBeingWrittenToMutex
 
std::condition_variable mDataIsBeingWrittenToCondition
 
bool mDataIsBeingWrittenTo
 
std::mutex mDataIsBeingAccessedMutex
 
std::condition_variable mDataIsBeingAccessedCondition
 
bool mDataIsBeingAccessed
 
- Protected Attributes inherited from fast::Object
std::weak_ptr< ObjectmPtr
 

Additional Inherited Members

- Public Types inherited from fast::SpatialDataObject
typedef std::shared_ptr< SpatialDataObjectpointer
 
- Public Types inherited from fast::DataObject
typedef std::shared_ptr< DataObjectpointer
 
- Public Types inherited from fast::Object
typedef std::shared_ptr< Objectpointer
 
- Static Public Member Functions inherited from fast::SpatialDataObject
static std::string getStaticNameOfClass ()
 
- Static Public Member Functions inherited from fast::DataObject
static std::string getStaticNameOfClass ()
 
- Static Public Member Functions inherited from fast::Object
static std::string getStaticNameOfClass ()
 

Constructor & Destructor Documentation

◆ ~Tensor()

virtual fast::Tensor::~Tensor ( )
virtual

◆ Tensor()

fast::Tensor::Tensor ( )
protecteddefault

Member Function Documentation

◆ create() [1/4]

virtual void fast::Tensor::create ( const float *const  data,
TensorShape  shape 
)
virtual

Create a tensor using the provided data and shape. This method will COPY the data.

Parameters
data
shape

◆ create() [2/4]

virtual void fast::Tensor::create ( std::initializer_list< float >  data)
virtual

Create a 1D tensor with the provided data. Its shape will be equal to its length

Parameters
data

◆ create() [3/4]

virtual void fast::Tensor::create ( std::unique_ptr< float[]>  data,
TensorShape  shape 
)
virtual

Create a tensor using the provided data and shape.

Parameters
data
shape

◆ create() [4/4]

virtual void fast::Tensor::create ( TensorShape  shape)
virtual

Create an unitialized tensor with the provided shape

Parameters
shape

◆ deleteDimension()

virtual void fast::Tensor::deleteDimension ( int  dimension)
virtual

◆ expandDims()

virtual void fast::Tensor::expandDims ( int  position = 0)
virtual

Add a dimension of size 1 at provided position. -1 is last position.

Parameters
position

◆ free()

virtual void fast::Tensor::free ( ExecutionDevice::pointer  device)
overridevirtual

Implements fast::DataObject.

◆ freeAll()

virtual void fast::Tensor::freeAll ( )
overridevirtual

Implements fast::DataObject.

◆ getAccess()

virtual TensorAccess::pointer fast::Tensor::getAccess ( accessType  type)
virtual

◆ getBoundingBox()

virtual DataBoundingBox fast::Tensor::getBoundingBox ( ) const
overridevirtual

Reimplemented from fast::SpatialDataObject.

◆ getHostDataPointer()

virtual float* fast::Tensor::getHostDataPointer ( )
protectedvirtual

◆ getOpenCLBufferAccess()

virtual std::unique_ptr<OpenCLBufferAccess> fast::Tensor::getOpenCLBufferAccess ( accessType  type,
OpenCLDevice::pointer   
)
virtual

◆ getShape()

virtual TensorShape fast::Tensor::getShape ( ) const
virtual

◆ getSpacing()

virtual VectorXf fast::Tensor::getSpacing ( ) const
virtual

◆ getTransformedBoundingBox()

virtual DataBoundingBox fast::Tensor::getTransformedBoundingBox ( ) const
overridevirtual

Reimplemented from fast::SpatialDataObject.

◆ hasAnyData()

virtual bool fast::Tensor::hasAnyData ( )
protectedvirtual

◆ isInitialized()

virtual bool fast::Tensor::isInitialized ( )
protectedvirtual

◆ setAllDataToOutOfDate()

void fast::Tensor::setAllDataToOutOfDate ( )
protected

◆ setSpacing()

virtual void fast::Tensor::setSpacing ( VectorXf  spacing)
virtual

◆ transferCLBufferFromHost()

virtual void fast::Tensor::transferCLBufferFromHost ( OpenCLDevice::pointer  device)
protectedvirtual

◆ transferCLBufferToHost()

void fast::Tensor::transferCLBufferToHost ( OpenCLDevice::pointer  device)
protected

◆ updateHostData()

void fast::Tensor::updateHostData ( )
protected

◆ updateOpenCLBufferData()

void fast::Tensor::updateOpenCLBufferData ( OpenCLDevice::pointer  device)
protected

Member Data Documentation

◆ m_data

std::unique_ptr<float[]> fast::Tensor::m_data
protected

◆ m_shape

TensorShape fast::Tensor::m_shape
protected

◆ m_spacing

VectorXf fast::Tensor::m_spacing
protected

◆ mCLBuffers

std::unordered_map<std::shared_ptr<OpenCLDevice>, cl::Buffer*> fast::Tensor::mCLBuffers
protected

◆ mCLBuffersIsUpToDate

std::unordered_map<std::shared_ptr<OpenCLDevice>, bool> fast::Tensor::mCLBuffersIsUpToDate
protected

◆ mHostDataIsUpToDate

bool fast::Tensor::mHostDataIsUpToDate
protected

◆ OpenCLBufferAccess

friend fast::Tensor::OpenCLBufferAccess
protected

◆ TensorAccess

friend fast::Tensor::TensorAccess
protected

The documentation for this class was generated from the following file: