All Projects → AOT-AG → Dicomtomesh

AOT-AG / Dicomtomesh

Licence: other
A command line tool to transform a DICOM volume into a 3d surface mesh (obj, stl or ply). Several mesh processing routines can be enabled, such as mesh reduction, smoothing or cleaning. Works on Linux, OSX and Windows.

Projects that are alternatives of or similar to Dicomtomesh

Cq Editor
CadQuery GUI editor based on PyQT
Stars: ✭ 183 (-4.19%)
Mutual labels:  3d, stl
Unity Plane Mesh Splitter
Unity Plane Mesh Splitter
Stars: ✭ 71 (-62.83%)
Mutual labels:  3d, mesh
Pyvoxelizer
A python converter of 3D model into voxels
Stars: ✭ 35 (-81.68%)
Mutual labels:  mesh, stl
Cadquery
A python parametric CAD scripting framework based on OCCT
Stars: ✭ 764 (+300%)
Mutual labels:  3d, stl
Assetkit
🎨 Modern 2D/3D - Importer • Exporter • Util - Library, also called (AssetIO)
Stars: ✭ 97 (-49.21%)
Mutual labels:  3d, mesh
3d Machine Learning
A resource repository for 3D machine learning
Stars: ✭ 7,405 (+3776.96%)
Mutual labels:  3d, mesh
Meshcnn
Convolutional Neural Network for 3D meshes in PyTorch
Stars: ✭ 1,032 (+440.31%)
Mutual labels:  3d, mesh
Ami
AMI Medical Imaging (AMI) JS ToolKit
Stars: ✭ 569 (+197.91%)
Mutual labels:  stl, dicom
3dhop
3D Heritage Online Presenter
Stars: ✭ 89 (-53.4%)
Mutual labels:  3d, mesh
Starviewer
Starviewer, a cross-platform open source medical imaging software
Stars: ✭ 83 (-56.54%)
Mutual labels:  3d, dicom
Vedo
A python module for scientific analysis of 3D objects based on VTK and numpy
Stars: ✭ 741 (+287.96%)
Mutual labels:  3d, mesh
Hole fixer
Demo implementation of smoothly filling holes in 3D meshes using surface fairing
Stars: ✭ 165 (-13.61%)
Mutual labels:  3d, mesh
Pyvista
3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)
Stars: ✭ 734 (+284.29%)
Mutual labels:  3d, mesh
Pixel2meshplusplus
Pixel2Mesh++: Multi-View 3D Mesh Generation via Deformation. In ICCV2019.
Stars: ✭ 188 (-1.57%)
Mutual labels:  3d, mesh
Sdf
Simple SDF mesh generation in Python
Stars: ✭ 683 (+257.59%)
Mutual labels:  3d, mesh
Pixel2mesh
Pixel2Mesh: Generating 3D Mesh Models from Single RGB Images. In ECCV2018.
Stars: ✭ 997 (+421.99%)
Mutual labels:  3d, mesh
Numpy Stl
Simple library to make working with STL files (and 3D objects in general) fast and easy.
Stars: ✭ 356 (+86.39%)
Mutual labels:  3d, stl
Hmm
Heightmap meshing utility.
Stars: ✭ 403 (+110.99%)
Mutual labels:  3d, mesh
Pymeshfix
Python Wrapper for MeshFix: easily repair holes in PyVista surface meshes
Stars: ✭ 75 (-60.73%)
Mutual labels:  3d, mesh
Building Blocks
A voxel library for real-time applications.
Stars: ✭ 140 (-26.7%)
Mutual labels:  3d, mesh

Build Status

DicomToMesh

DicomToMesh is a handy command line tool, which enables the user to automatically create a 3D mesh from a set of 2D DICOM images, a common image format used in medicine. The supported 3D mesh formats are STL, OBJ and PLY. DicomToMesh works on Linux, OSX and Windows.

dicom2mesh

Mesh Creation

The 3D surface mesh is computed by the marching cubes algorithm. As an input, this algorithm requires a threshold which indicates what range of voxel values should be considered. This threshold is also known as iso-value. In CT scans, the iso-value depends on the tissue (density). In Dicom2Mesh you can specify the iso-value with the parameter -t X, where X is an integer.

Mesh Post-Processing Options

Mesh reduction: The mesh of a medical DICOM image can easily exceed 1 GB of data. Reducing the number of polygons, therefore, is a crucial feature. Reduction can be enabled by the option -r X where X is a floating-point value between 0.0 and 1.0.

reduction

Mesh smoothing: Acquired medical images contain often heavy noise. This is visible in the extracted 3D surface. Smoothing the mesh leads often to a better result. Smoothing can be enabled with the argument -s.

smoothing

Remove small objects: The resulting 3D mesh contains often parts which are not of interest, such as for example the screws of the table on which a CT scan of a patient was acquired. With DicomToMesh, you can remove objects below a certain size by adding the option -e X where X is a floating-point value between 0.0 and 1.0. X is a size threshold relative to the connected object with the most vertices. It is easy understandable with an example: The biggest connected object of the mesh has 1000 vertices. Then -e 0.25 removes all connected objects with less than 250 vertices.

filter

Visualisation

By passing the command line option -v the resulting mesh is visualised in a 3D environment. By double clicking the mesh's surface, the corresponding 3D coordinate is printed to the shell.

filter

The option -vo shows the input DICOM data in a volume renderer (vtkFixedPointVolumeRayCastMapper). The color map can be set with multiple parameters like (Red,Green,Blue,Alpha,Iso-Value). As an example, the parameters -vo (255,0,0,0,0) (255,0,0,60,700) (200,200,200,90,2000) color voxels with values from 0-700 reddish and 700-2000 whitish.

filter

Installation

Ubuntu 18.04

> sudo add-apt-repository ppa:eidelen/d2m
> sudo apt-get update
> sudo apt-get install dicom2mesh

On OSX and Windows it is required to build DicomToMesh yourself.

Building

The software is written in C++11 and uses VTK 7.0. CMake is used as build-system.

Building DicomToMesh on Linux and OSX:

> git clone https://github.com/AOT-AG/DicomToMesh.git
> cd DicomToMesh
> mkdir build
> cd build
> ccmake ..  #opens ccmake window

Within the ccmake window, pass the path to your vtk installation or vtk build directory. In my case, it looks like that

BUILD_GUI                        OFF
CMAKE_BUILD_TYPE                 DEBUG
CMAKE_INSTALL_PREFIX             /usr/local                                   
USE_VTK_DICOM                    OFF                                          
VTK_DIR                          /home/eidelen/Development/libs/vtk/build     

Press c and then g. Now you are back in terminal and ready to build.

> make

In order to extend the supported DICOM formats, the library vtk-dicom USE_VTK_DICOM can be optionally enabled (see https://github.com/dgobbi/vtk-dicom).

Building on Windows:

Building on Windows is essentially the same as building under Linux and OSX. The project settings can be done with the cmake GUI. The versions we are using are VTK 7.0.0 together with Visual Studio 2015. The optional GUI we are building with QT 5.9.4.

Additional build notes:

How to use Dicom2Mesh

Command line arguments can be combined and passed in arbitrary order.

Input and output: The path to the DICOM directory is passed by the argument -i dicomPath. The file name of the resulting 3D mesh is specified by the parameter -o meshPath. This simple example transforms a DICOM data set into a 3D mesh file called mesh.stl, by using an iso-value of 557 -t 557.

> dicom2mesh -i pathToDicomDirectory -t 557 -o mesh.stl

Alternatively, one can use an existing 3d mesh as input. This is useful if you want to apply only mesh post-processing routines and bypass the time consuming mesh creation step. This example imports the former mesh.stl, centers it and exports it in the OBJ mesh format.

> dicom2mesh -i mesh.stl -c -o newMesh.obj

Mesh post-processing: The following example shows different mesh post-processing methods applied to resulting surface mesh out of the marching cubes algorithm. In particular, a mesh is reduced by 90% of its original number faces -r 0.9. In addition, the mesh is smoothed -s and centred at the coordinate system's origin -c. Another helpful function is the removal of small objects - here the removal of every object smaller than 5% of the biggest object -e 0.05.

> dicom2mesh -i pathToDicomDirectory -r 0.9 -s -c -e 0.05 -o mesh.stl

GUI

Dicom2Mesh can be built with a small GUI on top. This showed up to be helpful for users without command line experience. However, the control possibilities are limited compared to the command line version.

dicom2mesh_gui

In order to build the Dicom2Mesh GUI, please set the cmake flag BUILD_GUI=ON when configuring the project. The GUI requires QT.

The icons in the gui were made by Smashicons from www.flaticon.com. The license is CC 3.0 BY

Contributors

DicomToMesh is a small in-house product of AOT AG (http://www.aot.swiss). Since it is based on several open-source examples, we decided to make our code public as well. We hope somebody can use parts of it. Participants are most welcome.

Have fun :)

filter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].