/SciData

Primary LanguagePythonMIT LicenseMIT

Synthetic skull bone defects for automatic patient-specific craniofacial implant design [paper, data]

Bibtex

@article{li2020synthetic,
  title={Synthetic Skull Bone Defects for automatic Patient-specific Craniofacial Implant Design},
  author={Li, Jianning and Schwarz-Gsaxner, Christina and Pepe, Antonio and Morais, Ana and Alves, Victor and von Campe,
  Gord and Wallner, J{\"u}rgen and Egger, Jan},
  journal={Scientific Data},
  year={2020},
  publisher={Nature Publishing Group}
}

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
  • Meshmixer 3.5.474

segment skull from CT scan

  • dependency : pynrrd, pydicom.
  • installation : pip install pynrrd , pip install -U pydicom
  • usage :
    1. change the 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. You need to specify the threshold for the skull segmentation, usually 100--max is recommended.

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
    To generate multiple (e.g., 10) random defective samples from one complete skull: python batch_creation.py

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))

STL files dimension calculation

  • dependency : Open3D, numpy-stl
  • installation : pip install open3d pip install numpy-stl
  • usage :
    python stl_dimension.py
  • note: calculate the actual size of the STL files in millimeter (mm), which is the size of the 3D printed model.