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::vector<Node::DiagramAttributeArtifact> diagram_attributes() const override#
See also
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
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.
Convolve intercepts sample() calls and blends/convolves the child’s attributes over a local region using an arbitrary kernel. The signed distance field (geometry) is passed through unmodified.
Under the hood, prepare() precomputes a dense typed voxel grid of the child’s targeted attributes using the shared AttributeVoxelGrid utility. At sample time each kernel tap becomes a cheap flat-memory trilinear grid lookup instead of a full child->sample() traversal, which makes the node orders of magnitude faster than a naive implementation.
Convolve is the generic, flexible sibling of the specialized Blend node; both share the same precomputation utility but have independent sample-time logic. Use Blend as a shorthand for the common box-blend case (where a separable-blur fast path lives entirely in prepare() and sample() becomes a single trilinear lookup). Use Convolve for arbitrary kernel weights or non-blur operations (sharpen, derivative, etc.).
The internal grid defaults to the voxel_size passed to prepare(). Users can supply a sparser override_voxel_size in the constructor to reduce memory cost for large scenes; trilinear interpolation at sample time still produces smooth output.
Public Functions
-
virtual std::shared_ptr<Node> clone() override#
Clones share the immutable precomputed grid via shared_ptr so threaded samplers pay the prepare cost only once per tree.
See also
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 attributes observed on the child at prepare time 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.
override_voxel_size – Optional sparser voxel size used for the internal precomputed grid. When unset, the voxel_size passed to prepare() is used.
-
inline virtual Node::DiagramFamily diagram_family() const override#
See also
-
inline virtual std::string diagram_label() const override#
See also
-
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
Protected Functions
-
virtual void prepare_bounding_box() override#
-
virtual std::shared_ptr<Node> clone() override#
-
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)#