ModelArrayIO: convert fixel, voxel, and greyordinate neuroimaging data to/from HDF5 for the ModelArray R package
Project description
ModelArrayIO
ModelArrayIO is a Python package that converts between neuroimaging formats (fixel .mif, voxel NIfTI, CIFTI-2 dscalar) and the HDF5 (.h5) layout used by the R package ModelArray. It can also write ModelArray statistical results back to imaging formats.
Relationship to ConFixel: The earlier project ConFixel is superseded by ModelArrayIO. The ConFixel repository is retained for history (including links from publications) and will be archived; new work should use this repository.
Documentation for installation and usage: ModelArrayIO on GitHub (this README). For conda, HDF5 libraries, and installing the ModelArray R package, see the ModelArray vignette Installation.
ModelArrayIO provides three converter areas, each with import and export commands:
After installation, these commands are available in your terminal:
- Fixel-wise data (MRtrix
.mif):.mif→.h5:confixel(CLI name kept for compatibility with earlier ConFixel workflows).h5→.mif:fixelstats_write
- Voxel-wise data (NIfTI):
- NIfTI →
.h5:convoxel .h5→ NIfTI:volumestats_write
- NIfTI →
- Greyordinate-wise data (CIFTI-2):
- CIFTI-2 →
.h5:concifti .h5→ CIFTI-2:ciftistats_write
- CIFTI-2 →
Installation
Install dependent software MRtrix (only required for fixel-wise data .mif)
For fixel-wise .mif conversion, the confixel / fixelstats_write tools use MRtrix mrconvert. Install MRtrix from MRtrix’s webpage if needed. Run mrview in the terminal to verify the installation.
If your data are voxel-wise or CIFTI only, you can skip this step.
Install ModelArrayIO
You may want a conda environment first—see ModelArray: Installation. If MRtrix is installed in that environment, install ModelArrayIO in the same environment.
Install from GitHub:
git clone https://github.com/PennLINC/ModelArrayIO.git
cd ModelArrayIO
pip install . # build via pyproject.toml
Editable install for development:
# From the repository root
pip install -e .
With hatch installed, you can build wheels/sdist locally:
hatch build
pip install dist/*.whl
How to use
We provide a walkthrough for fixel-wise data (confixel / fixelstats_write) and a walkthrough for voxel-wise data (convoxel / volumestats_write).
Together with ModelArray, see the combined walkthrough with example fixel-wise data (ModelArray + ModelArrayIO).
CLI help:
confixel --help
Use the same pattern for convoxel, concifti, fixelstats_write, volumestats_write, and ciftistats_write.
Storage backends: HDF5 and TileDB
ModelArrayIO supports two on-disk backends for the subject-by-element matrix:
- HDF5 (default), implemented in
modelarrayio/h5_storage.py - TileDB, implemented in
modelarrayio/tiledb_storage.py
Both backends expose a similar API:
- create a dense 2D array
(subjects, items)and write all values at once - create an empty array with the same shape and write by column stripes
- write/read column names alongside the data
Notes and minor differences:
- Chunking vs tiling: HDF5 uses chunks; TileDB uses tiles. We compute tile sizes analogous to chunk sizes to keep write/read patterns similar.
- Compression: HDF5 uses
gzipby default; TileDB defaults tozstd+shuffle for better speed/ratio. You can switch togzipfor parity. - Metadata: HDF5 stores
column_namesas a dataset attribute; TileDB stores names as JSON metadata on the array/group. - Layout: Both backends keep dimensions in the same order and use zero-based indices.
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 modelarrayio-26.0.0rc1.tar.gz.
File metadata
- Download URL: modelarrayio-26.0.0rc1.tar.gz
- Upload date:
- Size: 421.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f3e153a98f56e7ca0056edbf6035ea540404898f52d3380474626dea7db8a7
|
|
| MD5 |
9dd6195a97b46da34b5da4fc9fcefb5c
|
|
| BLAKE2b-256 |
977684e126dfe96a32066d5e56155291cb552e05bf26257d2954f86e6bf6d8ed
|
File details
Details for the file modelarrayio-26.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: modelarrayio-26.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 35.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c62f4a37162693814da27ef87cca81ad594bb65a1a31a531d139dfdc7ce1b66a
|
|
| MD5 |
6cc855ea9df8167a254134fd984d68fa
|
|
| BLAKE2b-256 |
14bce88be3ad2a04b74ded4892e6c9a1311d7b1b85eccb8260d4e8c7ac63966d
|