IMOD model files as pandas DataFrames in Python.
Project description
imodmodel
Read IMOD model files as pandas dataframes in Python.
Usage
As pandas DataFrame
import imodmodel
df = imodmodel.read('my_model_file.mod')
In [3]: df.head()
Out[3]:
object_id contour_id x y z
0 0 0 64.333336 64.666664 80.0
1 0 0 47.000000 77.333336 80.0
2 0 0 51.333332 45.666668 80.0
3 0 0 87.333336 49.666668 80.0
4 0 0 76.000000 82.000000 80.0
As ImodModel object
from imodmodel import ImodModel
model = ImodModel.from_file("my_model_file.mod")
In [3]: model.objects[0].contours[0].points
Out[3]:
array([[ 6.875, 62.875, 124. ], ...])
In [4]: model.objects[0].meshes[0].vertices
Out[4]:
array([[ 6.87500000e+00, 6.28750000e+01, 1.24000000e+02], ...])
In [5]: model.objects[0].meshes[0].indices
Out[5]:
array([[156, 18, 152], ...])
In [6]: model.objects[0].meshes[0].face_values
Out[6]:
array([0., 0., 35.22094345, ...])
That's it!
Installation
imodmodel
can be installed from the Python Package Index (PyPI)
pip install imodmodel
We recommend installing into a clean virtual environment.
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
imodmodel-0.0.13.tar.gz
(234.9 kB
view details)
Built Distribution
File details
Details for the file imodmodel-0.0.13.tar.gz
.
File metadata
- Download URL: imodmodel-0.0.13.tar.gz
- Upload date:
- Size: 234.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d0733c734a4c07f4b668bd7df4c32c32f9ecff29e54c7af8b98d7a0c5900508 |
|
MD5 | dad58aa2c7e773d4bbb99061755b9928 |
|
BLAKE2b-256 | 89bfcf512c682b2b3aa53649f6a6ef09a401cb50e5dac98d414712210a68dd34 |
File details
Details for the file imodmodel-0.0.13-py3-none-any.whl
.
File metadata
- Download URL: imodmodel-0.0.13-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 930c852018d2d1501be815a014240d8e084d12b0cce2478d23400da88b6970b3 |
|
MD5 | c4f29a4cfb50c266305a17cce1881527 |
|
BLAKE2b-256 | 22cf96545c742c895a2ecfa038ef00110d4b201e21d02cb6ee3ba9091285faf5 |