vesuvius-segment2voxel
is a tool designed for the Vesuvius Challenge. It converts segment meshes into volumetric voxel labels in Blosc2 NDarray format for compression and fast accessibility. The integer labels correspond to some arclength around the axis of rotation. The full process involves loading mesh segments, orienting UVs, voxelating the mesh, and assigning labels.
- Load mesh segments and their associated UV maps.
- Voxelate the mesh with specified
resolution
andchunk sizes
, during this process a bigply
file is created. - Read data from the
ply
in batches and assign voxel labels based on UV coordinates and arclength around aspecified axis
. - Utilize efficient compression and multithreading with Blosc2.
- Python 3.6+
- NumPy
- trimesh
- tqdm
- Pillow
- SciPy
- plyfile
- pandas
- blosc2
- subprocess
To install the required dependencies, run:
pip install -r requirements.txt
This script uses obj2voxel
from the Eisenwave/obj2voxel repository to convert OBJ files to voxel representations. Please follow these steps:
- Download and compile the
obj2voxel
tool from the given repository. - Provide the path to the executable using the
--obj2voxel
argument.
The main script for voxelating and labeling can be executed with the following command:
python segment2voxel.py --work_dir <WORKING_DIRECTORY> --segment_id <SEGMENT_ID> --chunk <CHUNK_SIZE> --axis <UV_AXIS> --workers <NUM_WORKERS> --batch_size <BATCH_SIZE> --obj2voxel <OBJ2VOXEL_EXECUTABLE>
--work_dir
: The working directory containing segment folders.--segment_id
: The segment ID to process.--chunk
: Chunk size for compressing (default: 256).--axis
: UV axis to use for labeling (default: 0).--workers
: Number of workers for Blosc2 (default: 16).--batch_size
: Batch size for processing vertices (default: 8000000).--obj2voxel
: Path to theobj2voxel
executable.
python segment2voxel.py --work_dir ./data --segment_id segment_01 --chunk 256 --axis 0 --workers 16 --batch_size 8000000 --obj2voxel /path/to/obj2voxel
This project is licensed under the MIT License. See the LICENSE file for details.
This script is based on the work from the Vesuvius Challenge and uses obj2voxel
from the Eisenwave/obj2voxel and a function taken from ThaumatoAnakalyptor.