Added methods to apply color to voxel parameterization and slices. - #1092
Open
Sunnthos wants to merge 2 commits into
Open
Added methods to apply color to voxel parameterization and slices.#1092Sunnthos wants to merge 2 commits into
Sunnthos wants to merge 2 commits into
Conversation
Patch to fix the issue where parent image colors were not propagated to child voxels during ImageVolume initialization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.