nx10 / fineslice

Sample 3D-affine transformed images

Home Page:https://nx10.github.io/fineslice/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fineslice

Build codecov Ruff stability-stable BSD 3-Clause License pages

fineslice is a lightweight sampler for 3D-affine transformed images (commonly used in neuroscience) implemented in pure Python + NumPy.

It does not make any assumptions about the data. Pass any image texture and affine matrix directly into it.

Features

  • Precision sampling (no need to 're-sample' and loose precision)
  • Automatically finds optimal dimensions
  • Only depends on NumPy

Usage with nibabel

For the best performance directly pass in the nibabel data object as a texture:

import nibabel as nib
import fineslice as fine

img = nib.load('my_image.nii.gz')

out = fine.sample_0d(
    texture=img.dataobj,
    affine=img.affine,
    out_position=(0, 0, 0)
)

About

Sample 3D-affine transformed images

https://nx10.github.io/fineslice/

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%