Repository navigation
Releases: mrx-org/bifti-phantoms
Release list
bifti (Rust) 0.3.0
Published to crates.io: https://crates.io/crates/bifti/0.3.0
bifti (Rust) 0.2.0
Changed
- Breaking:
Phantom::load(path, max_substeps)and
Phantom::load_from_config(config, base_dir, max_substeps)take the cap on quadrature
samples per axis used when an obliquereslice_tois resampled, previously fixed at 8.
Passbifti::DEFAULT_MAX_SUBSTEPSfor the old behaviour. - Resampling onto an oblique
reslice_tonow warns (throughtracingwith thetracing
feature, on stderr otherwise): the result is averaged by approximate midpoint quadrature
instead of the exact box average used for axis-aligned grids. The warning says when
max_substepsleaves the quadrature under-sampled, so the result may alias
(#23).
Added
DEFAULT_MAX_SUBSTEPS(8).
bifti (Python) 0.3.0
Published to PyPI: https://pypi.org/project/bifti/0.3.0/
bifti (Python) 0.2.1
Published to PyPI: https://pypi.org/project/bifti/0.2.1/
bifti (Python) 0.2.0
Added
max_substepskeyword onNumpyPhantom.load,NumpyPhantom.load_from_configand
load_tissue(default 8): the cap on quadrature samples per axis used when an oblique
reslice_tois resampled, previously only settable throughResampler.build.Resampler.weight_sum/resample_weightedaccept a(C, X, Y, Z)weight, one per
channel, so a 4-D phantom NIfTI (one density per tissue) goes through a single call
(#23).ObliqueResampleWarningandResampler.capped.
Changed
- Resampling onto an oblique grid now emits an
ObliqueResampleWarning: the result is
averaged by approximate midpoint quadrature instead of the exact box average used for
axis-aligned grids. The warning says whenmax_substepsleaves the quadrature
under-sampled, so the result may alias
(#23). - A weight whose shape matches neither the source grid nor
(C, *source grid)now raises
ValueErrorinstead of failing inside the contraction.
BiftiPhantoms-v0.3.0
BiftiPhantoms BiftiPhantoms-v0.3.0
Diff since BiftiPhantoms-v0.2.1
Added
save_bifti(...; constant_threshold=...): store a map as a constant when its RMS
deviation from the real part of its mean (its standard deviation, for a real map) is at
most the threshold.nothing(the default) or a negative value disables it;density
always stays a map.
Changed
- Breaking:
save_biftiprefixes every NIfTI with the name of the JSON file
(phantom_density.nii.gz,phantom_B1plus_0.nii.gz, ... forphantom.json), so several
phantoms can be saved into one directory without overwriting each other's maps.
Merged pull requests:
BiftiPhantoms-v0.2.1
BiftiPhantoms BiftiPhantoms-v0.2.1
Diff since BiftiPhantoms-v0.2.0
Added
load_bifti(...; max_substeps=8): the cap on quadrature samples per axis used when an
obliquereslice_tois resampled, previously fixed at 8.
Changed
- Reslicing onto an oblique
reslice_tonow logs a warning: the result is averaged by
approximate midpoint quadrature instead of the exact box average used for axis-aligned
grids. The warning says whenmax_substepsleaves the quadrature under-sampled, so the
result may alias (#23).
Merged pull requests:
- setup publishing workflow (#31) (@J-Endres)
- Warn on oblique resampling, per-channel weights; bump all packages to 0.2 (fixes #23) (#32) (@J-Endres)
- python: parse func expressions instead of eval (0.2.1) (#33) (@J-Endres)
Closed issues:
- resample: the oblique path is silently approximate, and a per-tissue weight can't be batched (#23)
bifti (Python) 0.1.0
First release of bifti on PyPI: a Python package for loading, saving and resampling
BIfTI MRI simulation phantoms (one JSON file
plus NIfTI files).
pip install bifti # or: uv add bifti
pip install "bifti[torch]" # optional: torch-accelerated resampling (CPU or CUDA)
Requires Python 3.12 or newer.
Features
- Load phantoms into NumPy:
NumpyPhantom.load(path)reads the phantom JSON and every
NIfTI it references into oneNumpyTissueper tissue (density,T1,T2,T2',ADC,
dB0, multi-channelB1+/B1-), with property defaults andfuncvalue mappings applied. - Reslicing (
reslice_to): density-weighted footprint averaging, so downsampling really
averages instead of dropping data and edges are not pulled towards zero. Uses torch when it is
installed, NumPy otherwise (override withBIFTI_RESAMPLE_BACKEND=numpy|torch). - Saving:
NumpyPhantom.save(dir)writes a self-contained, deterministic folder (float64
NIfTIs + JSON,funcbaked in, noreslice_to), so you can reslice a phantom on disk or
export one you built in memory. - JSON data model:
BiftiPhantom.load/.saveparse and write just the JSON, for
generating or editing phantoms without touching voxel data. - Patient position:
patient_to_scanner/to_scanner_affinemap phantom coordinates to
scanner coordinates. - Public registry:
load_catalog(),load_registry()and
load_registry_phantom(collection, name)download phantoms from Zenodo into a local cache.
Browse them at https://mrx-org.github.io/bifti-phantoms/.
Known limitations
funcmappings are evaluated with Python'seval: only load phantoms you trust.- Complex-valued NIfTI data is not supported yet: the imaginary part of a complex
B1+/B1-
map is dropped. - Only the default
unitsare accepted.
This package was built with LLM assistance and has not been reviewed thoroughly yet. Expect
rough edges while the version is 0.x. Please report problems at
https://github.com/mrx-org/bifti-phantoms/issues.
Full documentation: https://github.com/mrx-org/bifti-phantoms/blob/main/python/bifti/README.md
BiftiPhantoms-v0.2.0
BiftiPhantoms BiftiPhantoms-v0.2.0
Diff since BiftiPhantoms-v0.1.0
Breaking changes
None. 0.2.0 only adds functionality; existing code keeps working.
The minor version was bumped because the package is still pre-1.0.
Added
save_bifti/save_nifti: save a loadedVoxelPhantomas a deterministic, self-contained
folder (stacked NIfTI-1 files plus JSON;funcmappings baked in, noreslice_to).
Merged pull requests:
BiftiPhantoms-v0.1.0
BiftiPhantoms BiftiPhantoms-v0.1.0
Initial release. Reads, writes and loads BIfTI phantoms, with density-weighted resampling, patient positions and registry downloads.
Closed issues: