Application-specific segmentation file format guides

CCP4/CCP-EM masks (.map/.mrc/.rec)

Typically, masks capture a single segment per file making this file format bulky. Furthermore, depending on how the data was saved, these masks may be several times larger than they should be. Here are the following options available to simplify working with masks.

  • If the masks use more than one byte per voxel they will need to be binned. See the Binning masks section of Prepping your segmentation file(s) for how to do this. Binning can save several multiples of times as much storage e.g. a 4GB file to a 1GB file.

  • If the masks are non-overlapping they can be merged into a single multi-label mask. See the Merging masks section of the Prepping your segmentation file(s) for more information. If you choose to perform a merge then you are strongly encouraged to save the segmentation as an HDF5 EMDB-SFF file.

  • If the masks are notoriously large they can be meshed into stereolithography (STL) meshes, which can save considerable storage depending on the mesh topologies. Read the Meshing masks section of the Prepping your segmentation file(s) for details on how to do this. However, because of how STL mesh data is calculated, it will be necessary to transform the meshes. Please follow the Transform stereolithography files section in the Prepping your segmentation file(s) for more information.

Stereolithography (STL) files (.stl)

STL files hold meshes but the geometrical parameters are usually incorrect. To correct them requires transforming them to have the right values. Read the Transform stereolithography files section in Prepping your segmentation file(s) for details.

IMOD files (.mod)

IMOD files should have either meshes or shapes describing the segmentation geometry. Meshes are derived from contours but may be absent from the file. Therefore, use the following command to examine your IMOD files:

sff view --chunks file.mod

and make sure you have as many MESH chunks as segments. If these are missing then run the following using IMOD:

imodmesh file.mod

which will mesh any contours (CONT) present.

Amira/Avizo files (.am/.hx/.surf)

These files are usually straightforward to process but please contact us if you have any problems during conversion.

Segger files (.seg)

These files are usually straightforward to process but please contact us if you have any problems during conversion.

SuRVoS (.h5)

As with ilastik files, these files use a .h5 extension therefore you will need to inform sfftk which .h5 file is being processed by setting the –subtype-index as shown below:

sff convert file.h5
Thu Feb 23 13:46:22 2023    Warning: missing --image <file.map> option to accurately determine image-to-physical transform
The file extension h5 has multiple formats associated with it.
(You can avoid this intercept by using the --subtype-index <value> option.)
    [0] - SuRVoS
    [1] - ilastik
    [2] - EMDB-SFF
Please enter a valid choice [0-2]:

ilastik files (.h5)

Same as with SuRVoS files, require specifying a value for the --subtype-index option..

Other formats (.ply, .object etc.)

If possible, please convert other open or proprietary formats into one of the formats above. You can use a tool like Spin 3D to work with some relatively common file types. .object files are created by Dragonfly, which can convert to MRC or STL natively.