Skip to main content

Efficient, backend-agnostic batching of NIfTI-MRS spectra (NumPy / PyTorch / JAX / TensorFlow / Keras)

Project description

NIfTI-MRS+ Logo

Efficient, backend-agnostic batching of NIfTI-MRS spectra

PyPI version Python License


nifti-mrs-plus wraps a list of NIfTI-MRS objects into a single batch-aware tensor, keeping the header, dimension tags, and provenance intact. It materializes in whatever backend your pipeline needs (NumPy, PyTorch, JAX, TensorFlow, or Keras) with no code changes.


Install

pip install nifti-mrs-plus                   # core (numpy + nifti-mrs)
pip install "nifti-mrs-plus[torch]"          # + PyTorch
pip install "nifti-mrs-plus[viz]"            # + plotting (matplotlib + fsl-mrs)
pip install "nifti-mrs-plus[all]"            # everything

Extras: torch · jax · tensorflow · keras · viz · hdf5 · all · dev


Quick start

from nifti_mrs_plus import NIfTI_MRS_Plus, Backend

batch = NIfTI_MRS_Plus(nifti_list)

batch.shape                          # (8, 1, 1, 1, 2048)
batch.numpy()                        # np.ndarray, cached
batch.get_data(Backend.PYTORCH)      # torch.Tensor  (if torch installed)
batch[0]                             # NIFTI_MRS  (single subject)
batch[0:4]                           # NIfTI_MRS_Plus  (sub-batch)

Backends

Extra Backend Returns
(none) NIFTI_LIST list[NIFTI_MRS]
(none) NUMPY numpy.ndarray
torch PYTORCH torch.Tensor
jax JAX jax.Array
tensorflow TENSORFLOW tf.Tensor
keras KERAS Keras tensor

Built with ❤️ for the MRS community

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

nifti_mrs_plus-0.1.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

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

nifti_mrs_plus-0.1.0-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file nifti_mrs_plus-0.1.0.tar.gz.

File metadata

  • Download URL: nifti_mrs_plus-0.1.0.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for nifti_mrs_plus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f2285426272a3612b592a444631333187b6b9c839eb4a8f65484a66f9ef6c790
MD5 bfdd3ed1b839919ef31e517832d91fd6
BLAKE2b-256 6d4c224fcf75612594748f02e241c4f49a01175eeaf056a6aef0fb937e98784e

See more details on using hashes here.

File details

Details for the file nifti_mrs_plus-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nifti_mrs_plus-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for nifti_mrs_plus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17748818a443b0445f3eaa3099baa32c79beee845f84952bcb0cd6eece140466
MD5 0e0038de725de4dcf720950ef87bcf01
BLAKE2b-256 5881d52b9bad8dbf76354b102eb16f37052c99dbde1514ca6c5cf3991e70c119

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