Skip to main content

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.

Overview

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
  • Greyordinate-wise data (CIFTI-2):
    • CIFTI-2 → .h5: concifti
    • .h5 → CIFTI-2: ciftistats_write

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 gzip by default; TileDB defaults to zstd+shuffle for better speed/ratio. You can switch to gzip for parity.
  • Metadata: HDF5 stores column_names as 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modelarrayio-26.0.0rc1.tar.gz (421.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modelarrayio-26.0.0rc1-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

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

Hashes for modelarrayio-26.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 f0f3e153a98f56e7ca0056edbf6035ea540404898f52d3380474626dea7db8a7
MD5 9dd6195a97b46da34b5da4fc9fcefb5c
BLAKE2b-256 977684e126dfe96a32066d5e56155291cb552e05bf26257d2954f86e6bf6d8ed

See more details on using hashes here.

File details

Details for the file modelarrayio-26.0.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for modelarrayio-26.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 c62f4a37162693814da27ef87cca81ad594bb65a1a31a531d139dfdc7ce1b66a
MD5 6cc855ea9df8167a254134fd984d68fa
BLAKE2b-256 14bce88be3ad2a04b74ded4892e6c9a1311d7b1b85eccb8260d4e8c7ac63966d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page