Skip to content

Added methods to apply color to voxel parameterization and slices. - #1092

Open
Sunnthos wants to merge 2 commits into
OpenGATE:masterfrom
Sunnthos:ImageVoxelsColorInheritancePatch
Open

Added methods to apply color to voxel parameterization and slices.#1092
Sunnthos wants to merge 2 commits into
OpenGATE:masterfrom
Sunnthos:ImageVoxelsColorInheritancePatch

Conversation

@Sunnthos

@Sunnthos Sunnthos commented Jul 10, 2026

Copy link
Copy Markdown

Propagation of ImageVolume colors to child voxels

EN :

This modification allows users to define the color of an ImageVolume with zero opacity ([R, G, B, 0]) during simulation setup.

Before this patch, when sim.visu = True, Geant4 exported every voxel of the image to the WRL file, even when the user intended the volume to be invisible. For images containing millions of voxels, this could generate WRL files several gigabytes in size and significantly increase both generation and visualization times.

This patch propagates the parent volume's color and opacity properties to its child voxels during initialization. As a result, when the opacity is set to zero, Geant4 no longer exports those voxels to the WRL file. This is because opacity is one of the criteria used by Geant4 to determine whether a volume should be displayed and written to the WRL file.

This significantly reduces the size of generated WRL files while preserving the expected visualization behavior for visible volumes.

FR :

Cette modification permet de définir la couleur d'un ImageVolume avec une opacité nulle ([R, G, B, 0]) dès la configuration de la simulation.

Avant ce correctif, lorsque sim.visu = True, Geant4 exportait tous les voxels de l'image dans le fichier WRL, même si l'utilisateur souhaitait rendre le volume invisible. Pour une image contenant plusieurs millions de voxels, cela pouvait produire des fichiers WRL de plusieurs gigaoctets et ralentir considérablement leur génération ainsi que leur visualisation.

Ce patch propage les propriétés de couleur et d'opacité du volume parent vers les voxels fils lors de leur initialisation. Ainsi, si l'opacité est nulle, Geant4 n'exporte plus les voxels dans le fichier WRL. En effet, l'opacité fait partie des critères utilisés par Geant4 pour décider si un volume doit être affiché et enregistré dans le fichier WRL.

Cette modification réduit fortement la taille des fichiers WRL tout en conservant le comportement attendu pour les volumes visibles.

Sunnthos and others added 2 commits July 10, 2026 16:43
Patch to fix the issue where parent image colors were not propagated to child voxels during ImageVolume initialization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant