Skip to content

Creating Label Data

Bill Katz edited this page Apr 27, 2015 · 5 revisions

Label data, unlike grayscale image data, has a variety of forms tailored to particular use cases. Label data is usually ingested from a series of 64-bit label images, which can be stored in RGBA form or as compressed raw data.

But before we load the images, we need to create the data instances that will hold labels.

Creating label data instances

To create a data instance to hold a volume of data where each voxel could be a different label, use the labelblk data type. You can do it like this:

% dvid repo c7 new labelblk labels sync=bodies

The command above creates a new labelblk instance named "labels" at UUID c7. The API/commands for a labelblk type is similar to uint8blk since they both operate on 2d and 3d images. In the case of labelblk, though, each voxel has a 64-bit label instead of the 8-bit intensity in uint8blk types. The "sync=bodies" portion tells DVID that these labels will need to be synced with a future data instance named "bodies". Let's make that data instance now:

% dvid repo c7 new labelvol bodies sync=labels

The command above creates a new labelvol instance named "bodies" at UUID c7 and it is synced with the "bodies" instance we previously made. The labelvol type allows us to get all voxels associated with particular labels as well as do merge and split operations on chosen labels.

Note that our "labels" and "bodies" instances have reciprocal syncs so that changes in "labels" cause changes in "bodies" and vice versa. Basically, the labels (labelblk type) and bodies (labelvol type) data instances are different views of the same label data. If you want to read and write 2d/3d label images, you use the "labels" labelblk instance. If you want to operate on a particular label, no matter where it sits in the entire data volume, you use the "bodies" labelvol instance.

Loading Label Data

Label data is commonly ingested from a series of RGBA-encoded images. An example:

% dvid node c7 labels load 0,0,0 /path/to/labels/*.png

The above command loads a sequence of PNG images into the "labels" labelblk instance created above, where the first PNG loaded has top left corner at (0,0,0), the second PNG has top left corner at (0,0,1), etc.

Clone this wiki locally