Skip to content

jianning-li/SciData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skull-Data-Processing

Python/Matlab scripts to segment human skull bone from CT scan , clean the segmented skull, convert the skull volume to mesh and inject holes to the healthy skull.

  • Python 3.6
  • MATLAB R2018b
  • MeshLab v2016.12
  • ITK-SNAP 3.6.0
  • 3D Slicer 4.8.1 r26813

segment skull from CT scan

  • dependency : pynrrd, pydicom.
  • installation : pip install pynrrd , pip install -U pydicom
  • usage :
    1. change directory
    2. run in the command window: python segmentation.py
  • note : the script can read dicom files exported directly from CT machine for segmentation and can also read nrrd files converted from dicom files using 3D Slicer.

skull data cleaning

  • dependency : 3D connected component analysis.
  • installation : pip install connected-components-3d
  • usage :
    1. change data_dir and save_dir to where you stored the original nrrd files and where you want to save the cleaned nrrd files to.
    2. run in the command window: python denoising.py

artificial defect injection

  • dependency : PyMRT.
  • installation : pip install pymrt
  • usage :
    1. change pair_list : where you storied the cleaned nrrd files (it's recommended that skull data cleaning performed before defect injection). defected_dir : where to store the skull with defect to. implant_dir : where to store the removed part (i.e., the implant) to.
    2. specify the size of defect to be injected into the skull, 128 recommended.
    3. run in the command window: python defectinject.py
  • note: the current code provide functionalities to generate cubic defect generate_cude(defect_size) and spherical dfects generate_sphere(defect_size).

create skull mesh model from .nrrd files

  • dependency : Open3D, scikit-image, PyMCubes.
  • installation : pip install open3d pip install scikit-image pip install --upgrade PyMCubes
  • usage :
    python nrrd2mesh.py

voxelization : create voxel grid from mesh (matlab/python)

  • dependency : Polygon2Voxel, stlread.
  • usage :
    [F,V] = stlread('skullmesh.stl');
    FV.faces=F;
    FV.vertices=V;
    Volume=polygon2voxel(FV,512,'none',true);
    save Volume.mat to nrrd
    import scipy.io as sio, import nrrd
    volume=sio.loadmat('Volumen.mat')['Volume']
    nrrd.write('volume.nrrd',volume.astype(float64))

About

PYTHON/MATLAB SCRIPTS FOR SKULL DATA PROCESSING

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages