Tutorial: Segmentation and Flattening
This page has been archived and is no longer maintained. It describes an earlier generation of the Vesuvius Challenge pipeline — tools, data layouts, and results referenced here may have been superseded. See Open Problems for the current state of the pipeline and Prizes for what is open today.
This tutorial walks through a slice-based approach to segmentation, which is helpful background for learning about the task. This was used to generate the 2023 Grand Prize results. We are now working on more automated, 3D approaches to segmentation.
Please see the accompanying video tutorial for segmentation using Volume Cartographer here: https://www.youtube.com/watch?v=gdQmepxWhuY
As we saw in the "Scanning" tutorial, it’s quite hard to extract useful information out of a “word soup”, even when the ink is quite clear. For this tutorial we’ll show how to use virtual unwrapping to produce a flattened image which shows the content clearly.
Two key steps to virtually unwrapping a scroll or manuscript are segmenting a surface from inside the 3D volume and flattening that surface to 2D. The video below shows the idea quite well; or check out the full version (It was made by Dr. Seales’s son and daughter!). The red line during the reconstruction phase represents the surface that we want to virtually unwrap.
To perform segmentation, you have two choices of software: Khartes, and Volume Cartographer. Both of these choices have different strengths and weaknesses, but either can accomplish the task of accurate segmentation. Khartes relies on Volume Cartographer to perform the flattening portion of this guide. Thanks to @hari_seldon and @djosey of the segmentation team for their feedback and help with making this guide!
- Volume Cartographer
- Khartes
Strengths:
- Faster at creating larger segments
- tool-assisted annotation, requiring less clicking
- Entire pipeline in one application
- No shape limitation (lines can turn in on themselves, can be fully circular)
Weaknesses:
- Can only segment on the Z plane, which is a challenge in some areas
- No preview during segmentation
- Relatively high hardware requirements
Strengths:
- View z, x, and y planes and segment on any of them
- Interactive full scroll movement through ome-zarr
- Minimal hardware requirements
- Live view of segmentation results, enabling very high accuracy
Weaknesses:
- Is limited to creating segments that do not contain lines that turn back towards their origin, in essence limiting you to half circles at most. This can be severely limiting in some regions that have severe warping, and its hard to tell when you begin if a sheet will do this eventually.
- Requires much more manual clicking than VC
- Requires VC in some parts of the rendering / flattening pipeline
Khartes is written by @khartes_chuck and has extensive documentation on github located here.
This guide will focus on Volume Cartographer, a virtual unwrapping toolkit built by EduceLab’s Seth Parker. Volume Cartographer is designed to create meshes along surfaces of a manuscript (e.g. pages or scroll wraps) and then sample the voxels around these meshes to create a 2D image of the manuscript's contents. Volume Cartographer includes many tools and utilities. In this tutorial we’ll be looking at the main VC GUI as well as the vc_render tool. Volume Cartographer screenshots and recordings below are © EduceLab/University of Kentucky.
The segmentation team uses a custom version of Volume Cartographer, initially forked by @RICHI and further enhanced by @spacegaier. These versions include significant improvements, such as Optical Flow Segmentation (OFS), substantial performance increases, ui improvements, and many other changes. The latest fork, maintained by @spacegaier, is available here: https://github.com/spacegaier/volume-cartographer.
This guide uses this same version of VC. If you use a different version this guide will vary significantly from your experience, so it is highly recommended to use this version.
Installing Volume Cartographer
To begin, let's install Volume Cartographer:
- Windows
- macOS (using Homebrew)
- macOS (using Docker)
- Linux
- Build from source
- Install the VcXsrv Windows X Server or a similar X Server (if you use the Chocolatey package manager:
choco install vcxsrv). - Run “XLaunch” from the Start Menu, or from “C:\Program Files\VcXsrv\xlaunch.exe”.
- Use the default settings, except:

- Check that the X Server is running in the tray:

- Install Docker Desktop.
- Pull the latest Docker image by running:
docker pull ghcr.io/spacegaier/volume-cartographer:edge
Note: this does not install the fork of Volume Cartographer mentioned above.
Install Homebrew. Run brew install --no-quarantine educelab/casks/volume-cartographer.
- The GUI app will be installed to
/Applications/VC.app. - The command line tools are installed to
\$(brew --prefix)/binand should be available in the terminal immediately (e.g.vc_packager) — if not, make sure you haveeval \$(/opt/homebrew/bin/brew shellenv)in your shell profile and restart your terminal.
- Install XQuartz: https://www.xquartz.org/
- Log out and back into macOS.
- Launch XQuartz. Under the XQuartz menu, select “Preferences”.
- Go to the “Security” tab and ensure “Allow connections from network clients” is checked.
- Quit XQuartz and restart it.
- Install Docker Desktop.
- Pull the latest Docker image by running:
docker pull ghcr.io/spacegaier/volume-cartographer:edge
- Then run:
xhost +localhost
- We assume that you’re running the X Window System (if you’re unsure, you probably do).
- First, install Docker. Do not use Snap to install it.
- Pull the latest Docker image by running:
docker pull ghcr.io/spacegaier/volume-cartographer:edge
- Then run:
xhost +local:docker
- First, install basic build dependencies like
build-essential,cmake, and Qt6. - Then:
# Recursive clone, so we get the vc-deps repo, which contains dependencies.
git clone --recursive https://github.com/spacegaier/volume-cartographer.git
# Build vc-deps.
cd volume-cartographer/vc-deps
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
# Build main app.
cd ../..
mkdir build && cd build
cmake -DVC_PREBUILT_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
make -j
# Install, or skip this and refer directly to the executables in build/bin.
make install
Gathering data
Now let's gather our scroll data and setup our folders...
We're going to start with Scroll 1 (PHerc. Paris. 4) as this is the scroll that the 2023 Grand Prize segments were from, and is also the easiest of the current scrolls to segment. VC requires all of the folders listed under the PHercParis4.volpkg, in addition to the config.json and meta.json files.
This is the recommended structure for the full_scrolls folder (with a full example given for Scroll1):
full_scrolls/
├── Scroll1/
│ └── PHercParis4.volpkg/
│ ├── volumes/
│ │ └── 20230205180739/
│ │ ├── 00000.tif
│ │ ├── .
│ │ ├── .
│ │ ├── 14375.tif
│ │ └── meta.json
│ ├── paths
│ ├── renders
│ ├── working
│ └── config.json
├── Scroll2
│ └── PHercParis3.volpkg/
├── Scroll3
│ └── PHerc332.volpkg/
└── Scroll4
└── PHerc1667.volpkg/
And this is the recommended structure for your new_segments folder:
new_segments/
├── Scroll1
├── Scroll2
├── Scroll3
├── Scroll4
└── run_vc.sh
To download the data, first navigate to the /volumes/20230205180739 directory. You can also place the files in /volumes/20230205180739 after they are downloaded.
Use this rclone command to download all of the Scroll 1 volumes quickly:
rclone copy :http:/full-scrolls/Scroll1/PHercParis4.volpkg/volumes/20230205180739/ . --http-url https://dl.ash2txt.org/ --progress --size-only
If you wish to begin with a smaller portion of Scroll 1, rather than the entire scroll, you can download 1cm of scan data from the center using:
for i in `seq 6000 7250`; do wget http://dl.ash2txt.org/full-scrolls/Scroll1/PHercParis4.volpkg/volumes/20230205180739/0\$i.tif; done
Be sure to have the config.json file at the root of the .volpkg directory, and the meta.json file in the volumes directory so that VC can work with it.
More information can be found at the Vesuvius Data Download Repo.
Running the Volume Cartographer GUI
We will use the main VC GUI app to perform segmentation: finding a surface of papyrus and exporting it as a 3D mesh.
This guide was written using Linux. Most of the commands are similar, but you may need to remove 'sudo' from the front of the commands depending on your operating system.
The -v switch used below is mapping a local path (or volume) to the Docker container. To check if your paths have been created properly you can run the Docker container and initiate a list command by typing:
docker run -v \path\to\full_scrolls\:/full_scrolls ghcr.io/spacegaier/volume-cartographer:edge ls
If you see your scroll folders, you’ve probably mapped this correctly.
Open a terminal and run (replacing the paths with your folder paths to the same folders):
sudo docker run -v /path/to/new_segments/:/new_segments -v /path/to/full_scrolls/:/full_scrolls -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix ghcr.io/spacegaier/volume-cartographer:edge VC
Let's take a moment to get oriented before continuing:
- In the top left are the current segmentations, or paths, in the current volume package (from here on referred to as a volpkg) along with the file, edit, help and view buttons.
- In the bottom left are the current segmentation runs and anchor information for the currently selected segment id.
- On the right are your OFS Segmentation settings.
- Located at the bottom is some navigation information. The primary number useful to you here will be the current slice number.

Navigating a .volpkg
Now that we’ve oriented ourselves with the UI, let's open our .volpkg...
- Open a .volpkg by clicking file, then open .volpkg, and select the .volpkg for the volume you wish to segment on, ensuring you select the .volpkg folder, and not one of the subfolders. Click choose, and the volume will open at slice 0.
- Practice scrolling through the volume, using shift+scroll wheel to move up and down through slice layers, and ctrl+scroll wheel to zoom in and out. You can right click and drag to pan around the slice. Move through the layers until you find an area of the sheet that looks “easy” to segment. An ideal area has spacing on the inside face towards the center of the scroll, and maintains this spacing as you scroll through the layers for a time. You can increase the amount of slices you move through with the scroll wheel by pressing Q and E. The small number that shows up next to your cursor is the number of slices skipped each “click” of the scroll wheel.
- Look now to the top left in the segments window; our VC shows some segmentations in the segmentation window, but yours at this point will be blank.
