Skip to main content

PeRmutation Inference for Statistical Mapping

Project description

prism Logo

Prism

Fast, modular, and extensible permutation-based statistical inference for neuroimaging.

Prism is a Python library for running fast, scalable, and fully nonparametric statistical analyses on brain imaging data. It replicates much of the core functionality of Anderson Winkler's PALM, but without MATLAB dependencies.


📚 Documentation

Full documentation, including API reference and usage guides, is available at:
https://josephiturner.com/prism/

For background and motivation, see the project manuscript.


🚀 Features

  • Mass univariate GLM analysis with flexible contrast modeling
  • Permutation-based testing including sign flips and blockwise shuffling
  • Support for TFCE, FDR, FWE (Westfall–Young), and GPD-based p-value tail estimation
  • Voxelwise map comparison tools for assessing spatial similarity
  • CLI interface modeled after PALM
  • Works directly with NIfTI files or NumPy arrays

🛠️ Installation

Prism is available on PyPI as prism-neuro:

pip install prism-neuro

Note: While the package is named prism-neuro on PyPI, you still use import prism in your code.

Development Installation

git clone https://github.com/josephisaacturner/prism.git
cd prism
pip install -e .

If you're on MacOS with Apple silicon, you may need to manually install a jax dependency:

pip install jax-metal

Minimal Example

import numpy as np
from prism.datasets.dataset import Dataset

Y = np.random.randn(100, 50)        # Brain data (samples x voxels)
X = np.random.randn(100, 2)         # Design matrix
C = np.array([1, -1])               # Contrast

dataset = Dataset(
    data=Y,
    design=X,
    contrast=C,
    output_prefix="prism_example",
    n_permutations=1000
)

results = dataset.permutation_analysis()

Contributing

We welcome contributions! To get started:

  1. Fork this repository
  2. Create a new branch: git checkout -b feature-name
  3. Make your changes
  4. Commit: git commit -m "Description"
  5. Push and open a pull request!

📂 Project Structure

prism/
├── prism/                            # Core Python package
│   ├── data/                         # Brain templates or masks
│   ├── datasets/                     # Dataset class logic
│   ├── stats/                        # GLM and stat functions
│   ├── permutation_inference.py      # Main permutation logic
│   ├── preprocessing.py              # Data loading, masking, preprocessing
│   ├── tfce.py                       # TFCE implementation
│   ├── spatial_similarity.py         # Spatial map correlation engine
│   ├── prism_cli.py                  # Command-line interface
├── docs/                             # Markdown documentation (MkDocs)
├── notebooks/                        # Example Jupyter notebooks
├── tests/                            # Unit tests
├── assets/                           # Static images and logos
├── manuscript/                       # Project manuscript
├── README.md                         # You are here
├── requirements.txt                  # Dependencies
├── pyproject.toml                    # Build system metadata
└── LICENSE

License

Prism is released under the MIT License.

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

prism_neuro-0.1.1.tar.gz (64.7 kB view details)

Uploaded Source

Built Distribution

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

prism_neuro-0.1.1-py3-none-any.whl (67.9 kB view details)

Uploaded Python 3

File details

Details for the file prism_neuro-0.1.1.tar.gz.

File metadata

  • Download URL: prism_neuro-0.1.1.tar.gz
  • Upload date:
  • Size: 64.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for prism_neuro-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e58a98cad2fbfc9ee0173866c4bc4e16c012d34d68e7555f06a19a9de2578233
MD5 f2d8d07f1ec767c34427c63d85c74011
BLAKE2b-256 375a3d74ef8eb28c9a1a18465b3fec12ce7a87e60c3607add611e60211e5b493

See more details on using hashes here.

File details

Details for the file prism_neuro-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: prism_neuro-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 67.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for prism_neuro-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f2b9b972e4d9f8d13a389808e2aba28374859c881838939ca229795e6aed663
MD5 604861101113438f8639c5073c23b999
BLAKE2b-256 0a0606199d81806692aa2a8153441d8e22a4fd76c079596eb1276617a979327c

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