Fetal CP Surface Extraction
5.5K
Fetal brain cortical plate surface extraction using CIVET marching-cubes (sphere_mesh).

pl-fetal-surface-extract consumes binary volumetric .mnc brain masks to produce
surfaces as .obj files with standard connectivity (81,920 triangles). This program is
suitable for targeting the inner cortical plate surface (gray-white matter boundary)
of high-quality human fetal brain MRI segmentation for subjects between 23-35 gestational
weeks of age.
Polygonal surface mesh representations of brain hemispheres are useful for measuring cortical thickness, image registration, and quantitative regional analysis.
mincmorph to fill in disconnected voxels (improve mask quality)adapt_object_mesh to achieve desired smoothness. Number of iterations is predicted by a regressionWe have evaluated two implementations of marching-cubes:
We found that CIVET's implementation of the marching-cubes algorithm, sphere_mesh, is
more accurate
than scikit-image's implementation, which requires FWHM blurring of the volume.
Moreover, sphere_mesh guarantees a spherical topology.
We developed a model which predicts the number of adapt_object_mesh smoothing iterations necessary, given a desired smoothness error threshold.
The model was created from the experiment described here:
It is recommended to use the Fetal Brain MRI Surface Extraction ChRIS pipeline.
pl-fetal-surface-extract is a ChRIS plugin, meaning it can
run from either within ChRIS or the command-line.
extract_cp reads mask files from an input directory and creates
the resulting surface files in an output directory.
Input files should be MINC .mnc files representing a mask of the white matter (WM)
for a single brain hemisphere (either left or right). WM should be indicated by a
value of 1, background value should be 0.
If the input directory contains multiple masks, they will all be processed individually and in parallel.
--inflate_to_sphere_implicitArguments to pass to inflate_to_sphere_implicit. The default value (200, 200)
should work for fetal brains. While it shouldn't be necessary, increasing the
values shouldn't do any harm, and would help compensate for larger brain sizes.
--keep-maskCopy input mask file to output directory.
--keep-mask is a workaround for using pl-fetal-surface-extract as part of a
ChRIS pipeline. It eliminates the need for an extra ts plugin step.
--distance-thresholdSet acceptable maximum distance error.
Without subsampling, "sulci bridge" errors can happen.

This error can be detected by large distance error. If distance error exceeds the distance threshold, then we rerun marching cubes with subsampling enabled.
--target-smoothnessSet target mean smoothness error.

The result of marching cubes, especially with subsampling enabled, can be poor quality. Taubin smoothing is applied to improve surface quality. The number of smoothing iterations is decided by the value for target smoothness.
To get started with local command-line usage, use Apptainer
to run pl-fetal-surface-extract as a container:
apptainer exec docker://fnndsc/pl-fetal-surface-extract extract_cp input/ output/
To print its available options, run:
apptainer exec docker://fnndsc/pl-fetal-surface-extract extract_cp --help
pl-fetal-surface-extractpl-nums2mask: create input masksInstructions for developers.
Build a local container image:
docker build -t localhost/fnndsc/pl-fetal-surface-extract .
Run chris_plugin_info
to produce a JSON description of this plugin, which can be uploaded to a ChRIS Store.
docker run --rm localhost/fnndsc/pl-fetal-surface-extract chris_plugin_info > chris_plugin_info.json
Mount the source code extract_cp.py into a container to test changes without rebuild.
docker run --rm -it --userns=host -u $(id -u):$(id -g) \
-v $PWD/extract_cp:/opt/conda/lib/python3.10/site-packages/extract_cp:ro \
-v $PWD/in:/incoming:ro -v $PWD/out:/outgoing:rw -w /outgoing \
localhost/fnndsc/pl-fetal-surface-extract extract_cp /incoming /outgoing
Content type
Image
Digest
sha256:2c48a90d8…
Size
148.8 MB
Last updated
almost 3 years ago
docker pull fnndsc/pl-fetal-surface-extract