Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defeaturing #257

Open
mrbuche opened this issue Dec 20, 2024 · 1 comment
Open

Defeaturing #257

mrbuche opened this issue Dec 20, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@mrbuche
Copy link
Contributor

mrbuche commented Dec 20, 2024

Is your feature request related to a problem? Please describe.

Segmentations sometimes contain small volumes (small groups of voxels) that should optionally be defeatured.

Describe the solution you'd like

Option to defeature volumes that contain less than <num, default=5 or 10> voxels.

  • Volumes with less than voxels are reassigned to the 'predominant neighboring material'.
  • Similarly for voxels surrounded by 4 or 5 voxels of other material(s).
  • Would multiple defeaturing iterations be needed?
  • Can you exactly match results from Sculpt as a test?

NOTE: Could the octree implementation help with this? No balancing or pairing required!

Describe alternatives you've considered

Something like recon3d might take care of this beforehand, but possibly not.

Additional context

Is generally useful to pre-process the segmentation this way before meshing.

@mrbuche mrbuche self-assigned this Dec 20, 2024
@mrbuche mrbuche added the enhancement New feature or request label Dec 20, 2024
@mrbuche
Copy link
Contributor Author

mrbuche commented Dec 20, 2024

  • Read segmentation file.
  • Construct octree.
    • Do not pair, but do weakly balance.
      • Otherwise looking at neighboring faces gets too complicated?
    • Every leaf is a single material thanks to Octree::from_voxels().
  • Construct volumes.
    • A volume is a set of sequence of face-sharing leaves.
      • Is my neighbor a leaf?
        • Yes: is it same material or not?
        • No: check the 4 children that share the same face.
          • Since the octree is weakly balanced, those should be leaves.
        • Need to make sure it already isn't in the current volume somehow!
    • Make a Vec of the leaves within the octree called Leaves.
    • Pop a leaf from Leaves into a new volume Vec.
    • Use neighboring faces to find neighbor leaves, moving them from Leaves into the volume.
      • Moving rather than copying ensures that volumes aren't repeated by starting from different leaves within the same volume. Also prevents volumes from sharing leaves, but that should happen anyway.
    • Once done with a leaf in the volume, repeat for each leaf in the volume.
      • Pushing them to the back will facilitate this naturally.
    • Once done with volume, start a new one with the next leaf in Leaves, repeat the above.
  • Defeature the volumes.
    • If any volume has less than specified minimum voxels:
      • Every leaf is homogeneous, so the number of voxels is 8^k.
      • .iter().map(|leaf| 8.powi(max_levels - 1 - leaf.level)).sum() on the volume Vec.
      • Change the volume material to "predominant neighboring material".
        • What does that mean exactly?
    • Does this have to be iterated on, similar to balancing?
  • Mesh the volumes. Either:
    • The octree is dualized.
    • The octree is converted back into a segmentation, which is meshed.
      • Need to implement Voxels::from_octree().

Can you ignore the larger leaves from the beginning, unless there is a good reason to always do all the volumes? What else could they be useful for? Option for separate blocks for all non-contiguous volumes? Option to generate nodesets and sidesets? Surface reconstruction algorithms? Thickening? Something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant