nifti2bids 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nifti2bids might be problematic. Click here for more details.

nifti2bids/simulate.py ADDED
@@ -0,0 +1,59 @@
1
+ """Module for creating simulated data."""
2
+
3
+ import nibabel as nib, numpy as np
4
+
5
+ from numpy.typing import NDArray
6
+
7
+
8
+ def simulate_nifti_image(
9
+ img_shape: tuple[int, int, int] | tuple[int, int, int, int], affine: NDArray = None
10
+ ) -> nib.Nifti1Image:
11
+ """
12
+ Simulates a NIfTI image.
13
+
14
+ Parameters
15
+ ----------
16
+ img_shape: :obj:`tuple[int, int, int]` or :obj:`tuple[int, int, int, int]`
17
+ Shape of the NIfTI image.
18
+
19
+ affine: :obj:`NDArray`, default=None
20
+ The affine matrix.
21
+
22
+ .. important::
23
+ If None, creates an identity matrix.
24
+
25
+ Returns
26
+ -------
27
+ Nifti1Image
28
+ The NIfTI image with no header.
29
+ """
30
+ if affine is None:
31
+ affine = create_affine(
32
+ xyz_diagonal_value=1, translation_vector=np.array([0, 0, 0, 1])
33
+ )
34
+
35
+ return nib.Nifti1Image(np.random.rand(*img_shape), affine)
36
+
37
+
38
+ def create_affine(xyz_diagonal_value: int, translation_vector: NDArray) -> NDArray:
39
+ """
40
+ Generate an 4x4 affine matrix.
41
+
42
+ Parameters
43
+ ----------
44
+ xyz_diagonal_value: :obj:`int`
45
+ The value assigned to the diagonal of the affine for x, y, and z.
46
+
47
+ translation_vector: :obj:`NDArray`
48
+ The translation vector/shift from the origin.
49
+
50
+ Returns
51
+ -------
52
+ NDArray
53
+ The affine matrix.
54
+ """
55
+ affine = np.zeros((4, 4))
56
+ np.fill_diagonal(affine[:3, :3], xyz_diagonal_value)
57
+ affine[:, 3:] = translation_vector[:, np.newaxis]
58
+
59
+ return affine
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: nifti2bids
3
+ Version: 0.1.2
4
+ Summary: Post-hoc BIDS conversion toolkit for NIfTI datasets without original DICOMs.
5
+ Author-email: Donisha Smith <dsmit420@jhu.edu>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://nifti2bids.readthedocs.io
8
+ Project-URL: Github, https://github.com/donishadsmith/nifti2bids
9
+ Project-URL: Issues, https://github.com/donishadsmith/nifti2bids/issues
10
+ Project-URL: Changelog, https://nifti2bids.readthedocs.io/en/stable/changelog.html
11
+ Keywords: python,neuroimaging,fMRI,MRI,BIDS,NIfTI
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Scientific/Engineering
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Operating System :: MacOS :: MacOS X
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 11
23
+ Classifier: Development Status :: 3 - Alpha
24
+ Requires-Python: >=3.10.0
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.26.3
28
+ Requires-Dist: nibabel>=5.0.0
29
+ Requires-Dist: rich>=14.2.0
30
+ Requires-Dist: nilearn>=0.10.4
31
+ Requires-Dist: pandas>=2.1.0
32
+ Provides-Extra: all
33
+ Requires-Dist: nifti2bids[test]; extra == "all"
34
+ Provides-Extra: test
35
+ Requires-Dist: pytest; extra == "test"
36
+ Requires-Dist: pytest-cov; extra == "test"
37
+ Dynamic: license-file
38
+
39
+ # Nifti2Bids
40
+
41
+ [![Latest Version](https://img.shields.io/pypi/v/nifti2bids.svg)](https://pypi.python.org/pypi/nifti2bids/)
42
+ [![Python Versions](https://img.shields.io/pypi/pyversions/nifti2bids.svg)](https://pypi.python.org/pypi/nifti2bids/)
43
+ [![Source Code](https://img.shields.io/badge/Source%20Code-nifti2bids-purple)](https://github.com/donishadsmith/nifti2bids)
44
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
45
+ [![Test Status](https://github.com/donishadsmith/nifti2bids/actions/workflows/testing.yaml/badge.svg)](https://github.com/donishadsmith/nifti2bids/actions/workflows/testing.yaml)
46
+ [![codecov](https://codecov.io/gh/donishadsmith/nifti2bids/graph/badge.svg?token=PCJ17NA627)](https://codecov.io/gh/donishadsmith/nifti2bids)
47
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
48
+ [![Documentation Status](https://readthedocs.org/projects/nifti2bids/badge/?version=stable)](http://nifti2bids.readthedocs.io/en/stable/?badge=stable)
49
+
50
+
51
+ A toolkit for post hoc BIDS-ification NIfTI datasets. Includes utilities for metadata extraction, file renaming, and JSON sidecar generation, designed primarily for datasets where the original DICOMs are unavailable.
52
+
53
+ ## Installation
54
+ To install ``nifti2bids`` use one of the following methods:
55
+
56
+ ### Standard Installation
57
+ ```bash
58
+ pip install nifti2bids
59
+ ```
60
+
61
+ ### Development Version
62
+
63
+ ```bash
64
+ git clone --depth 1 https://github.com/donishadsmith/nifti2bids/
65
+ cd nifti2bids
66
+ pip install -e .
67
+ ```
@@ -0,0 +1,14 @@
1
+ nifti2bids/__init__.py,sha256=LQlB2KxI-DGzpPTFTseAr4ZUb3FbuWsd7VVrxrOHt5Q,681
2
+ nifti2bids/_decorators.py,sha256=Ny05P-kn49-fenfHBOCPHkFbYkcMMJrF50Db4KRXOrY,1586
3
+ nifti2bids/_exceptions.py,sha256=Lup5wtAHbUA799MFBAOm4vI1PIl67YRJb2yhtSzMKO0,1245
4
+ nifti2bids/_helpers.py,sha256=GevqfWws98xpJjnyGdCFUFlqFNBMcriH5Kz58XY8Pvw,192
5
+ nifti2bids/bids.py,sha256=qZYbXuHG1EL-wCFNKDscarQUwC1DAKq7Ils3PFl7AS4,5341
6
+ nifti2bids/io.py,sha256=YbjsrLC07Eon17J14RZiKsqhE29eLtqSP86hKk0lZ6o,2907
7
+ nifti2bids/logging.py,sha256=HZ1kEV780e7lVtIUg11RrqY1f6ST8BrdZAXytRInWgQ,1923
8
+ nifti2bids/metadata.py,sha256=9v-Rhzv-xjvgyG3xoA8Gd0-vHnhsSv4tVMpH7a0H6SA,23354
9
+ nifti2bids/simulate.py,sha256=y9tT8FZQ3AwKiBbguaLKLT-_7QC6vDrbsN3SaeYStRg,1461
10
+ nifti2bids-0.1.2.dist-info/licenses/LICENSE,sha256=yCnTvShS6GH1UbLmn2bplwrIaAvbC956sxP5tRJP5OM,1070
11
+ nifti2bids-0.1.2.dist-info/METADATA,sha256=5xDr24mK6t4_noP5nal4Cns7hGwjB1VrzhchXI681VI,3108
12
+ nifti2bids-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ nifti2bids-0.1.2.dist-info/top_level.txt,sha256=D_dJLgalvEjgKIdUQrhKjKTEd796j1RpDcYAziScNOA,11
14
+ nifti2bids-0.1.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Donisha Smith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ nifti2bids