Library for converting the CVSX file format into the MVSX file format
Project description
cvsx2mvsx
cvsx2mvsx is a Python library and CLI tool designed to convert CVSX archives into MVSX or MVStory formats.
Installation
pip install cvsx2mvsx
CLI Usage
Convert a CVSX file to an MVSX archive:
uvx cvsx2mvsx --input examples/emd-1832.cvsx --output output.mvsx --format mvsx
Convert a CVSX file to the MVStory format:
uvx cvsx2mvsx --input examples/emd-1832.cvsx --output output.mvstory --format mvstory
Lattice to Mesh Conversion
If your input CVSX contains Lattice segmentations (voxel masks) and you wish to convert them to meshes via Marching Cubes rather than keeping them as volumes:
uvx cvsx2mvsx --input examples/emd-1832.cvsx --output output.mvsx --lattice-to-mesh
Arguments
| Argument | Description | Default |
|---|---|---|
--input |
Path to the input .cvsx file. |
Required |
--output |
Path to the output file (.mvsx or .mvstory). |
Required |
--format |
Output format type (mvsx or mvstory). |
mvsx |
--lattice-to-mesh |
Enable Marching Cubes conversion for lattice data. | False |
Python API Usage
MVSX Pipeline
To create an MVSX file, you define a pipeline that extracts, transforms to the internal model, transforms to MVSX state, and loads to disk.
# 1. Declare the pipeline structure
pipeline = Pipeline([
ExtractCVSX(),
TransformToInternal(),
TransformToMVSX(),
LoadMVSX()
])
# 2. Define run configuration
config = PipelineConfig(
input_path="path/to/input.cvsx",
output_path="path/to/output.mvsx",
lattice_to_mesh=True,
)
# 3. Execute
pipeline.run(config)
MVStory Pipeline
To create a Story, simply swap the transformation and loading steps of the MVSX pipeline:
pipeline = Pipeline([
ExtractCVSX(),
TransformToInternal(),
TransformToMVStory(),
LoadMVStory()
])
config = PipelineConfig(
input_path="path/to/input.cvsx",
output_path="path/to/output.mvstory",
lattice_to_mesh=True,
)
pipeline.run(config)
Architecture
The library follows a ETL (Extract, Transform, Load) Pipeline pattern.
Core Concepts
- Pipeline: A container that executes a list of steps sequentially. It manages the lifecycle of the process.
- Context: A shared state object passed between steps. It manages configuration, holds a temporary working directory for intermediate files, and cleans up resources automatically after execution.
- Steps: Discrete units of logic that implement a generic interface.
The Pipeline Flow
- Extract (
ExtractCVSX):- Unzips the
.cvsxarchive into the pipeline context temp directory. - Parses
index.json, metadata, and BinaryCIF files usingciftools.
- Unzips the
- Transform (
TransformToInternal):- Converts CVSX data into a normalized
InternalEntrymodel. - Handles complex logic like Lattice-to-Mesh conversion (Marching Cubes).
- Converts CVSX data into a normalized
- Transform (
TransformToMVSX/TransformToMVStory):- Converts the
InternalEntryinto format-specific representations (MVSX or MVStory).
- Converts the
- Load (
LoadMVSX/LoadMVStory):- Packages the processed assets and state into the final binary output file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cvsx2mvsx-1.0.0.tar.gz.
File metadata
- Download URL: cvsx2mvsx-1.0.0.tar.gz
- Upload date:
- Size: 211.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f44e0892d8b88879b5521a2d3ebbe6f84b49fba12aff8c4d466627c88c7396b9
|
|
| MD5 |
176d59dbcec09674b4ace485631b399a
|
|
| BLAKE2b-256 |
27266fbcd737b97443d2f0c33cbaf6ec995cc8f95b9b40bf8b6f84b4c5b01629
|
File details
Details for the file cvsx2mvsx-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cvsx2mvsx-1.0.0-py3-none-any.whl
- Upload date:
- Size: 80.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
471cc74954a74066e7dc1da9408a31e23b9026257d061e572aea5dccf98e15c7
|
|
| MD5 |
7f1f2d669f25e84689e0914fcb20e285
|
|
| BLAKE2b-256 |
17249756ee338669c07b9ae21f0b90f73c5cb504e96569b2d8be19859df39507
|