Skip to content

This script takes a single-labeled NIFTI file (.nii / .nii.gz) and converts it into a 3D mesh (.obj / .stl / .ply / .3ds).

Notifications You must be signed in to change notification settings

54CHA-PJ/ECN-Nifti-Mesh-Conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mesh generation from NIFTI files using Python and C Libraries

Authors: Sacha Cruz, Mario Espinoza

Date: 28/01/2024

________________________________
|                              |
|   NIFTI -> MESH GENERATION   |
|______________________________|

About the project

This script takes a single-labeled NIFTI file (.nii / .nii.gz) and converts it into a 3D mesh (.obj / .stl / .ply / .3ds).

More precisely, the code allows to :

  • Create a 3D mesh from a NIFTI file
    • Choose the library (Pymeshlab, VTK or Nii2Mesh)
    • Set a mesh-smoothing value
    • Set a mesh-simplification value
  • Show the mesh in a 3D object visualizer
  • Store Mesh's details (Mesh volume, File size, etc.) in a TXT file

It uses already-existing libraries :

Project hierarchy and files

  1. The main code is under the folder : nii_mesh_generation README FILE HERE

    • The main function is on the nii_mesh_gen.py file
    • You can learn how it works on the test_nii_mesh_gen.py file
    • It calls functions from internal libraries :
      • mesh_gen_c.py : calls nii2mesh library made on C
      • mesh_gen_python.py : calls pymeshlab and vtk libraries
      • mesh_tools.py : provides useful tools for mesh visualization and details
  2. The additional code is under the folder : additional_mesh_utils README FILE HERE

    • test_libraries_311.py --> Create a bunch of 3D objects (trying different libraries, methods and parameters)
    • objtools.py --> provides a lot of useful tools :
      • Visualize a 3D Mesh in a 3D interactiuve window
      • Save the current 3D view of a Mesh in a flat 2D image
      • Save the current Mesh's details in an excel file
      • Automatizate these functions to a whole folder containing different meshes
    • --> The purpose is to call the function showFolder in the folder where all the 3D meshes where created, to see every mesh one by one
    • test_mesh_simple.py --> tests the showObj function
    • test_mesh_folder.py --> tests the showFolder function

nii_mesh_generation

nii_mesh_gen.py
test_niimeshgen.py
source

mesh_gen_c
mesh_gen_python
mesh_tools

additional_mesh_utils

objtools.py
test_libraries_311.py
test_libraries_308.py

About

This script takes a single-labeled NIFTI file (.nii / .nii.gz) and converts it into a 3D mesh (.obj / .stl / .ply / .3ds).

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published