blocks.scene_generation.generation_utils package
Submodules
blocks.scene_generation.generation_utils.clean_mesh module
blocks.scene_generation.generation_utils.generate_fat module
- blocks.scene_generation.generation_utils.generate_fat.fill_with_fat(container, inner, up_vector, amount, obj_name='fat', resolution=30, noise_frequency=10, noise_amplitude=0.02)
Fill the “container” object with fat
Fills the container with fat, but only until “amount” of the “inner” object is covered. While creating the fat object, the lower part of the “inner” object will be covered in fat, increasing in the direction of the “up_vector”, i.e. those parts of the “inner” object which are further along the “up_vector” will be left unconvered.
blocks.scene_generation.generation_utils.generate_force module
- blocks.scene_generation.generation_utils.generate_force.create(source_obj: ~bpy.types.Object, obj_name: str = 'Force', rnd: ~random.Random = <random.Random object>, magnitude: float = 1, base_on_normal: bool = False, ang_from_normal: float | None = None) Object
Create an object representing a nodal force, connected to “source_obj”.
- Parameters:
source_obj – The object to attach the force to.
rnd – Random number generator to use
blocks.scene_generation.generation_utils.generate_hull module
- blocks.scene_generation.generation_utils.generate_hull.create(organs: List[Object], obj_name: str, outset_amplitude: float = 0.05, outset_frequency: float = 5) Object
Create a hull around the given objects
- Parameters:
organs – All organs which should end up inside the hull
obj_name – Name of created object
outset_amplitude – Maximum distance along normal (set to 0 to disable)
outset_frequency – Frequency to use for the outset noise
blocks.scene_generation.generation_utils.generate_laparoscopic_scene module
blocks.scene_generation.generation_utils.generate_ligament module
blocks.scene_generation.generation_utils.generate_random_organ module
- blocks.scene_generation.generation_utils.generate_random_organ.create(rnd: ~random.Random = <random.Random object>, bounds: ~blenderutils.BoundingBox = (min: <mathutils.Vector object>, max: <mathutils.Vector object>), add_concavity: bool = True, name: str = 'RandomMesh', predeform_twist: bool = False, predeform_noise: bool = False, cut_to_fit: bool = False, extrusion_size: float = 0.5, containing_obj: ~bpy.types.Object | None = None, target_minimum_voxel_size: float = 0.02, clean_method: str = 'VOXEL')
Creates a random organic-looking object. Usually used to simulate organ or tumor shape.
- Parameters:
rnd – Random number generator to use (for determinism)
bounds – Maximum extensions on each axis. Important: These are grid-aligned, i.e. supplying a bounding box of size (0.1, 0.3, 0.1) will create a shape that is around 3 times longer along the y-axis than it is on the x- and z- axis. Be careful not to introduce bias into the data (for example by rotating the shapes randomly after creating them).
add_concavity – Whether or not to subtract another random shape from this shape during generation. This tends to add concavities into the final shape, but note that this is a random process: Setting add_concavity does not guarantee that there is any large concavity in the final shape (because the subtrahend shape is randomly placed).
name – The name given to the created object.
predeform_twist – Add a twisting deformation to the mesh to increase shape diversity. Uses the blender “Simple Deform” modifier.
predeform_twist – Add noise to the mesh vertices. Uses blender’s “Displace” modifier.
cut_to_fit – To ensure the final mesh fits into the given bounds, cut pieces which extend beyond the bounding box off. Useful for very thin meshes, for example. If this is False, will scale the mesh to fit the bounds instead.
extrusion_size – Size of the extrusions which are performed to create the initial shape. This is a factor of the largest dimension in “bounds”. So if bounds has a size of (3,1,2), and extrusion_size is 0.5, then the extrusion distance would be 3*0.5 = 1.5.
containing_obj – If given, the newely generated object will be moved _inside_ the containing_obj. For this to work, containing_obj should be watertight. Note: We currently only ensure that the _center_ of the new object lies within the containing_obj (its sides may pertrude outside the containing_obj). This is used for tumors (which may lie on the surface of the organ and may thus be visible. Default: None
clean_method – VOXEL or SMOOTH. Method to use for the final cleaning step. Internally, this will use a remesh filter. VOXEL may give more regular, “meshable” results, but may fail for small regions/meshes. Current recommendation: Use “VOXEL” for large meshes which need to be 3D meshed afterwards using Gmsh or similar and use “SMOOTH” for smaller, tumor-like meshes.