Tree — attribute nodes
Unary attribute operators (modifier, convolution) on the attribute tree.
-
class AttributeModifier : public Unary
- #include <attribute_modifier.h>
A unary node that modifies or converts attributes produced by its child tree.
Public Functions
Constructor.
- Parameters:
converter – The converter logic that modifies samples coming from the child node.
child – The child node to modify the attributes of.
-
virtual std::shared_ptr<Attribute> get_attribute(const std::string &name) override
This node modifies existing child attributes; it throws std::runtime_error if you attempt to retrieve attributes from it directly.
See also
-
virtual TreeSample sample(double x, double y, double z) override
Samples the child node and applies the converter to its attribute samples.
See also
This node modifies existing child attributes; it throws std::runtime_error if you attempt to set standard attributes directly on it.
See also
Protected Functions
-
virtual std::vector<std::string> node_attribute_list() override
Returns the list of output attributes generated by the inner converter.
See also
Private Members
-
std::shared_ptr<AttributeConverterBase> m_converter
-
class Convolve : public Unary
- #include <convolve.h>
A unary node that convolves the attributes of its child node using a defined kernel.
This node intercepts sample() calls to blend/convolve attributes over a local area. The signed distance field (geometry) is passed through unmodified.
Public Functions
-
size_t cache_capacity() const
Gets the cache capacity.
Constructs a Convolve node.
- Parameters:
child – The child node containing the attributes to convolve.
attributes – The names of the attributes to target. If empty, all valid continuous attributes are targeted.
kernel – The convolution kernel (weights and extents).
physical_radius – The physical world-space radius (in mm) that the kernel spans along X, Y, and Z.
Constructs a Convolve node with cache control.
- Parameters:
child – The child node containing the attributes to convolve.
attributes – The names of the attributes to target. If empty, all valid continuous attributes are targeted.
kernel – The convolution kernel (weights and extents).
physical_radius – The physical world-space radius (in mm) that the kernel spans along X, Y, and Z.
enable_cache – Whether to use the LRU cache (defaults to true).
-
virtual void prepare(const glm::vec3 &voxel_size, double bandwidth) override
See also
-
virtual TreeSample sample(double x, double y, double z) override
Computes the convolved attributes at the requested coordinate.
See also
-
void set_cache_capacity(size_t capacity)
Sets the cache capacity.
- Parameters:
capacity – Maximum number of node samples to store in the cache.
-
void set_use_cache(bool enabled)
Toggles the internal LRU cache.
- Parameters:
enabled – True to use the cache, false to sample the child directly every time.
-
bool use_cache() const
Gets whether the cache is enabled.
Protected Functions
-
virtual void prepare_bounding_box() override
Private Functions
-
TreeSample get_child_sample(double x, double y, double z, const glm::ivec3 &grid_coord)
Internal helper to get a sample, either from cache or directly from the child.
-
size_t cache_capacity() const
-
class BoxKernel : public ConvolveKernel
- #include <convolve_kernel.h>
A simple box average kernel where all weights are equal to 1.0 (normalization happens later in the node).
Public Functions
-
inline explicit BoxKernel(int r)
Constructor.
- Parameters:
r – Radius of the box kernel
-
inline BoxKernel(int rx, int ry, int rz)
Constructor.
- Parameters:
rx – X radius
ry – Y radius
rz – Z radius
-
inline virtual int get_radius_x() const override
Gets the X radius (number of voxels positive and negative from center).
-
inline virtual int get_radius_y() const override
Gets the Y radius (number of voxels positive and negative from center).
-
inline virtual int get_radius_z() const override
Gets the Z radius (number of voxels positive and negative from center).
-
inline virtual double get_weight(int i, int j, int k) const override
Return the weight at the integer coordinate offset (i, j, k) relative to the center of the kernel (0, 0, 0).
-
inline explicit BoxKernel(int r)
-
class ConvolveKernel
- #include <convolve_kernel.h>
Base interface for a convolution kernel used by the Convolve node.
Subclassed by BoxKernel, CustomKernel
Public Functions
-
virtual int get_radius_x() const = 0
Gets the X radius (number of voxels positive and negative from center).
-
virtual int get_radius_y() const = 0
Gets the Y radius (number of voxels positive and negative from center).
-
virtual int get_radius_z() const = 0
Gets the Z radius (number of voxels positive and negative from center).
-
virtual double get_weight(int i, int j, int k) const = 0
Return the weight at the integer coordinate offset (i, j, k) relative to the center of the kernel (0, 0, 0).
-
virtual ~ConvolveKernel() = default
-
virtual int get_radius_x() const = 0
-
class CustomKernel : public ConvolveKernel
- #include <convolve_kernel.h>
A custom dense volume kernel initialized usually from Python (numpy array).
Public Functions
-
inline CustomKernel(const std::vector<double> &weights, int rx, int ry, int rz)
Constructor.
- Parameters:
weights – 1D vector representing the flattened 3D array.
rx – The half-size (radius) in X (total size = 2*rx + 1)
ry – The half-size (radius) in Y
rz – The half-size (radius) in Z
-
inline virtual int get_radius_x() const override
Gets the X radius (number of voxels positive and negative from center).
-
inline virtual int get_radius_y() const override
Gets the Y radius (number of voxels positive and negative from center).
-
inline virtual int get_radius_z() const override
Gets the Z radius (number of voxels positive and negative from center).
-
inline virtual double get_weight(int i, int j, int k) const override
Return the weight at the integer coordinate offset (i, j, k) relative to the center of the kernel (0, 0, 0).
-
inline CustomKernel(const std::vector<double> &weights, int rx, int ry, int rz)