Skip to content

VoxelGridLoader

Voxel loader based on RAW files.

Target: Sofa.Component.IO.Mesh

namespace: sofa::component::io::mesh

parents:

  • VoxelLoader

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the objet belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
filename Filename of the object
position Coordinates of the nodes loaded
hexahedra Hexahedra loaded
voxelSize Dimension of one voxel 1 1 1
resolution Resolution of the voxel file 0 0 0
ROI Region of interest (xmin, ymin, zmin, xmax, ymax, zmax) 0 0 0 65535 65535 65535
header Header size in bytes 0
segmentationHeader Header size in bytes 0
idxInRegularGrid indices of the hexa in the grid.
bgValue Background values (to be ignored)
dataValue Active data values
generateHexa Interpret voxel as either hexa or points 1
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseObject
master nullptr for regular objects, or master object for which this object is one sub-objects BaseObject

Examples

VoxelGridLoader.scn

<Node>
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [VoxelGridLoader] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [HexahedronSetGeometryAlgorithms HexahedronSetTopologyContainer] -->

    <DefaultAnimationLoop/>
    <EulerImplicitSolver  rayleighStiffness="0.1" rayleighMass="0.1" />
    <CGLinearSolver  iterations="25" tolerance="1e-5" threshold="1e-5"/>
    <Node>
        <VoxelGridLoader name="gridloader" filename="textures/Test_64_64_4.raw" voxelSize="0.1 0.1 0.1" resolution="64 64 4" bgValue="0" />
        <HexahedronSetTopologyContainer src="@gridloader" />
        <HexahedronSetGeometryAlgorithms drawHexa="1"/>
        <MechanicalObject showObject="1"/>
    </Node>
</Node>
def createScene(root_node):

   node = root_node.addChild('node')

   node.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
   node.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   node.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
   node.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   node.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
   node.addObject('DefaultAnimationLoop', )
   node.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1")
   node.addObject('CGLinearSolver', iterations="25", tolerance="1e-5", threshold="1e-5")

   node = node.addChild('node')

   node.addObject('VoxelGridLoader', name="gridloader", filename="textures/Test_64_64_4.raw", voxelSize="0.1 0.1 0.1", resolution="64 64 4", bgValue="0")
   node.addObject('HexahedronSetTopologyContainer', src="@gridloader")
   node.addObject('HexahedronSetGeometryAlgorithms', drawHexa="1")
   node.addObject('MechanicalObject', showObject="1")