![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <TensorMap.h>
Public Member Functions | |
| TensorMap (const std::string &primary_key) | |
| Create empty TensorMap and set primary key. More... | |
| TensorMap () | |
| template<class InputIt > | |
| TensorMap (const std::string &primary_key, InputIt first, InputIt last) | |
| TensorMap (const std::string &primary_key, const std::unordered_map< std::string, core::Tensor > &tensor_map) | |
| TensorMap (const std::string &primary_key, std::initializer_list< value_type > init) | |
| TensorMap (const TensorMap &other) | |
| Copy constructor performs a "shallow" copy of the Tensors. More... | |
| TensorMap (TensorMap &&other) | |
| Move constructor performs a "shallow" copy of the Tensors. More... | |
| std::size_t | Erase (const std::string key) |
Erase elements for the TensorMap by key value, if the key exists. If the key does not exists, a warning is thrown. Also primary_key cannot be deleted. It is based on size_type unordered_map::erase(const key_type& k);. More... | |
| std::pair< iterator, bool > | insert (const value_type &value) |
| template<class P > | |
| std::pair< iterator, bool > | insert (P &&value) |
| iterator | insert (const_iterator hint, const value_type &value) |
| template<class P > | |
| iterator | insert (const_iterator hint, P &&value) |
| template<class InputIt > | |
| void | insert (InputIt first, InputIt last) |
| void | insert (std::initializer_list< value_type > ilist) |
| TensorMap & | operator= (const TensorMap &)=default |
| TensorMap & | operator= (TensorMap &&)=default |
| std::string | GetPrimaryKey () const |
| Returns the primary key of the TensorMap. More... | |
| std::unordered_set< std::string > | GetKeySet () const |
| Returns a set with all keys. More... | |
| bool | IsSizeSynchronized () const |
| Returns true if all tensors in the map have the same size. More... | |
| void | AssertSizeSynchronized () const |
| Assert IsSizeSynchronized(). More... | |
| bool | IsContiguous () const |
| TensorMap | Contiguous () const |
| bool | Contains (const std::string &key) const |
| std::string | ToString () const |
| Print the TensorMap to string. More... | |
Static Public Member Functions | |
| static std::unordered_set< std::string > | GetReservedKeys () |
| Get reserved keys for the map. A map cannot contain any of these keys. More... | |
TensorMap is a unordered_map<string, Tensor> with a primary key. It is typically used as a container for geometry attributes.
e.g. tensor_map.primary_key: "positions" tensor_map["positions"] : Tensor of shape {100, 3}. tensor_map["colors"] : Tensor of shape {100, 3}. tensor_map["normals"] : Tensor of shape {100, 3}.
Typically, tensors in the TensorMap should have the same length (the first dimension of shape) and device as the primary tensor.
|
inlineexplicit |
Create empty TensorMap and set primary key.
|
inlineexplicit |
A primary key is always required. This constructor can be marked as delete in C++, but it is needed for pybind to bind as a generic python map interface.
References LogError.
|
inline |
|
inline |
|
inline |
|
inline |
Copy constructor performs a "shallow" copy of the Tensors.
|
inline |
Move constructor performs a "shallow" copy of the Tensors.
| void cloudViewer::t::geometry::TensorMap::AssertSizeSynchronized | ( | ) | const |
Assert IsSizeSynchronized().
References format, IsSizeSynchronized(), and LogError.
Referenced by cloudViewer::t::geometry::TriangleMesh::RemoveNonManifoldEdges(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), and cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask().
|
inline |
Returns true if the key exists in the map. Same as C++20's std::unordered_map::contains().
References count.
Referenced by cloudViewer::t::geometry::TriangleMesh::BakeTriangleAttrTextures(), cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), Erase(), cloudViewer::t::geometry::kernel::voxel_grid::ExtractPointCloud(), cloudViewer::t::geometry::kernel::voxel_grid::ExtractTriangleMesh(), cloudViewer::t::geometry::LineSet::HasLineAttr(), cloudViewer::t::geometry::PointCloud::HasPointAttr(), cloudViewer::t::geometry::LineSet::HasPointAttr(), cloudViewer::t::geometry::TriangleMesh::HasTriangleAttr(), cloudViewer::t::geometry::TriangleMesh::HasVertexAttr(), cloudViewer::t::geometry::kernel::voxel_grid::Integrate(), and cloudViewer::t::geometry::kernel::voxel_grid::RayCast().
| TensorMap cloudViewer::t::geometry::TensorMap::Contiguous | ( | ) | const |
Returns a new contiguous TensorMap containing the same data in the same device. For the contiguous tensors in the TensorMap, the same underlying memory will be used.
References Contiguous(), and GetPrimaryKey().
Referenced by cloudViewer::t::geometry::TriangleMesh::BakeTriangleAttrTextures(), cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), cloudViewer::visualization::rendering::TPointCloudBuffersBuilder::ConstructBuffers(), Contiguous(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::t::geometry::TriangleMesh::RemoveNonManifoldEdges(), cloudViewer::t::geometry::TriangleMesh::SamplePointsUniformly(), cloudViewer::t::io::WritePCDData(), cloudViewer::t::io::WritePointCloudToPLY(), and cloudViewer::t::io::WritePointCloudToSPLAT().
|
inline |
Erase elements for the TensorMap by key value, if the key exists. If the key does not exists, a warning is thrown. Also primary_key cannot be deleted. It is based on size_type unordered_map::erase(const key_type& k);.
References Contains(), LogError, and LogWarning.
Referenced by cloudViewer::t::geometry::LineSet::RemoveLineAttr(), cloudViewer::t::geometry::LineSet::RemovePointAttr(), cloudViewer::t::geometry::PointCloud::RemovePointAttr(), cloudViewer::t::geometry::TriangleMesh::RemoveTriangleAttr(), and cloudViewer::t::geometry::TriangleMesh::RemoveVertexAttr().
|
inline |
Returns a set with all keys.
Referenced by cloudViewer::t::geometry::vtkutils::ComputeNormals().
|
inline |
Returns the primary key of the TensorMap.
Referenced by Contiguous(), cloudViewer::t::geometry::PointCloud::ToString(), cloudViewer::t::geometry::TriangleMesh::ToString(), and ToString().
|
static |
Get reserved keys for the map. A map cannot contain any of these keys.
Referenced by insert().
|
inline |
References count, GetReservedKeys(), and LogError.
|
inline |
References count, GetReservedKeys(), and LogError.
|
inline |
References count, GetReservedKeys(), and LogError.
|
inline |
References count, GetReservedKeys(), and LogError.
|
inline |
References count, GetReservedKeys(), and LogError.
|
inline |
References count, GetReservedKeys(), and LogError.
| bool cloudViewer::t::geometry::TensorMap::IsContiguous | ( | ) | const |
Returns True if the underlying memory buffers of all the Tensors in the TensorMap is contiguous.
| bool cloudViewer::t::geometry::TensorMap::IsSizeSynchronized | ( | ) | const |
Returns true if all tensors in the map have the same size.
Referenced by AssertSizeSynchronized().
| std::string cloudViewer::t::geometry::TensorMap::ToString | ( | ) | const |
Print the TensorMap to string.
References ecvColor::LookUpTable::at(), QtCompat::endl(), format, cloudViewer::core::Tensor::GetDevice(), cloudViewer::core::Tensor::GetDtype(), GetPrimaryKey(), cloudViewer::core::Tensor::GetShape(), size, cloudViewer::core::Device::ToString(), cloudViewer::core::Dtype::ToString(), and cloudViewer::core::SizeVector::ToString().