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.0.tar.gz (63.4 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.0-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prism_neuro-0.1.0.tar.gz
  • Upload date:
  • Size: 63.4 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.0.tar.gz
Algorithm Hash digest
SHA256 bf69b90ae63bd3f5fb6cb8a697045721ac33d06b6f34a062c6f471d2f711fd55
MD5 d27e7f2f056bbe8880a7830bbcd31f01
BLAKE2b-256 7a5a2d348f0a5c4356fa2b498bbb42c1355482c0d353754084dca70798856a7e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prism_neuro-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 66.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d955227e0854b1cbe81b7cb4f017c8154e4c96d11fd5544b939db4d0679e4d3
MD5 27fb3ea2ad5d8596337768f80b8da1b5
BLAKE2b-256 d403489b7745293811bd1b3f4fd79abde8e63deecd2508580f40007f98b21f2a

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