Looking for suggestion on surface texture integration for triangular meshes #1255
Replies: 10 comments 10 replies
|
Hi @paulojamorim, could you please share your thoughts on this so I can proceed in the right direction? |
|
Thank you @paulojamorim! That makes sense standardizing on Rust is the right approach. I will study the existing Rust modules in invesalius_rs and port the Cython modules from medical_triangle_texture to Rust. I will share my progress soon." |
|
Following your guidance to move toward a Rust-based implementation, I replicated the full surface texture generation pipeline by converting this repo https://github.com/tfmoraes/medical_triangle_texture.git cython code to rust. Below is the exact workflow I am currently implemented:
Below is the exact step-by-step breakdown of what happens inside the Rust module when "_native.generate_surface_texture(...)" is called: 3.1. Python-to-Rust Interface (src/texture_py.rs)
3.2. Texture Atlas Initialization (src/texture.rs)
3.3. Triangle Processing Loop
3.4. Pixel Rasterization Loop
3.5. Sampling, Raycasting, and Shading
3.6. Return to Python (src/texture_py.rs)
Outputs returned to Python:
This pipeline has been tested on real DICOM data, and the generated textures successfully capture anatomical structures such as the rib cage and spine. I would appreciate your feedback on whether this implementation aligns with the intended direction for the surface texture feature, and whether any adjustments are recommended for integration into InVesalius. Note: The current results demonstrate a working pipeline, but further refinement is needed to get production grade results Best regards, |
|
Hi @paulojamorim, @rmatsuda could you please share your thoughts on this so I can proceed to next process ? |
|
Thank you @paulojamorim! This is very clear. I will implement it in the Export data tab with VRML/OBJ format selection and a progress bar. Will update progress here soon. I have one question regarding my approach. If I continue implementing this feature as a pre-GSoC contribution, is it still fine to submit a GSoC proposal based on this work? Best regards, |
|
Hi @paulojamorim, @tfmoraes, Thank you! |
|
Hi @paulojamorim, Thank you for your patience and continued guidance! |
|
Hi @paulojamorim, |
|
Hi @paulojamorim, The current export uses the VR preset transfer function to derive an isovalue and generate a surface, then applies the texture. For Airways, the lungs/airways are being generated, but the same low-HU threshold also captures the outer air/body boundary, so the exported result includes a skin/body shell that covers the internal lung structures. I tried a connected-component cleanup, but it is unreliable because in some cases the lung/airway region can be the largest connected component, so it may remove the wrong structure. Do you have a preferred direction for this case?
you can see the lungs/airways are being generated. |
|
Hi @paulojamorim, |








Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi @paulojamorim , @rmatsuda
Based on your suggestion regarding surface textures, I explored how texture mapping could be integrated into triangular meshes in InVesalius.
Current understanding
1. Already Existing Features in InVesalius3
These are used for volume rendering (looking THROUGH the volume).
2. What Missing for Surface Texture
The current VRML/OBJ export:
The
medical_triangle_textureproject provides:Proposed Strategy: Two-Phase Approach
Phase 1: Complete Export Flow with Existing MIDA/Raycasting
Goal: Get a working texture export as quickly as possible
What i need to build:
medical_triangle_textureWhy this first?
medical_triangle_texturePhase 2: Add Features One-by-One that are there in the
medical_triangle_textureAfter phase 1 is working, enhance incrementally:
4.Add CLUT widget for texture color editing
5.Add separate LMIP function with customizable thresholds (currently hardcoded)
Regarding :Keep Cython
I noticed the existing MIDA/Raycasting is implemented in Rust (
invesalius_rs), whilemedical_triangle_textureuses Cython.i think NOT to converting Cython to Rust at this stage because:
medical_triangle_texturealready worksModules to integrate to complete the export flow :
gen_texture.pyx- texture coordinate generationinterpolation.pyx- volume interpolationraycasting.pyx- surface raycastingFiles to Modify in InVesalius3
invesalius/data/surface.pyinvesalius/gui/task_exporter.pyinvesalius/gui/task_surface.pyQuestions for Your Feedback
Looking forward to your guidance!
Best regards,
k.purandeswarReddy
All reactions