An example showing how generate a complete conducting airway model given segmentations of CT airways and lobes#
In this tutorial we demonstrate using Chaste’s airway generation algorithm to create a complete model of
the conducting airways (mean generation ~16) from computed tomography segmentations. Note that the execution
time for this tutorial on a standard desktop PC is several minutes.
Note that the airway generation code is dependent of having VTK installed. However, we cannot put a guard around the
whole file since that gives compiler errors if VTK is not installed. Instead we guard the internals of each test, and
any includes that will be missing if VTK is not present.
We include some VTK classes to allow STL files to be read
The usual headers are included
MultiLobeAirwayGenerator is the class that does most of the work in generating a complete airway tree
All test suites should include either PetscSetupAndFinalize or FakePetscSetup. This code does not
currently use any parallel functionality so it might include either.
Define the test
First, we load up a mesh containing the centre lines and radii of the central airways extracted from
a CT image. The mesh needs to be of the type SPACE_DIM=3 and ELEMENT_DIM=1; that is it defines a mesh that exists
in 3D space and is made up of 1D line elements. Each node in the mesh is expected to have two attributes
associated with it. The first attribute specifies the radius of the airways that node. Thus the mesh defines a series
of cylinders that represent the airways. The second attribute specifies whether the node is a terminal node or not.
Note that the central airways mesh used here is defined in VTK unstructured grid format,
for this format we have to manually copy over the node attribute information. This step would
be unnecessary if using a mesh in !Triangles/Tetgen format.
We now define a MultiLobeAirwayGenerator to allow us to generate the distal airways to form a complete
conducting airway tree. MultiLobeAirwayGenerator provides an easy to use interface to AirwayGenerator
and facilitates the generation of airways into a complete lung, rather than the user having to do
each lobe separately.
We need to set a number of parameters to ensure the resulting airway tree is consistent with known
human morphometric data. The values given here can be considered standard for human lungs.
The most important of these is the NumberOfPointsPerLung, which (approximately)
specifies the number of terminals in the tree. The next is the BranchingFraction, which controls how long
the generated airways will be. The diameter ratio is used to control the rate at which airway diameters
decrease between airway orders.
These parameters are less important for producing a consistent airway tree, but are useful for
debugging etc.
We now add lobar surface definitions for the five human lung lobes. Less ’lobes’ can be
added if full lobar segmentation data is not available. Lobes must be tagged as ’left'
or ‘right’ to enable the correct number of acini to be created. Lobes are represented
by triangle surface definitions defined in STL files.
We now perform two preprocessing steps prior to generation. AssignGrowthApices determine
which lobe each of the terminal ends of the central airways segmentation are in.
Distribute points creates the target acinar points within the lung volume. The number
created is as specified previously using SetNumberOfPointsPerLung.
We now generate the distal airways. The output is automatically written as a mesh in
both tetgen format and VTK unstructured grid format to
$CHASTE_TEST_OUTPUT/TestAirwayGenerationTutorial/
The resulting geometry can most easily be viewed in Paraview by loading the unstructured grid
file. Application of a ‘Extract Surface’ filter followed by a ‘Tube’ filter allows the centreline
and radius information to be view as a series of tubes.