MedVol


NameMedVol JSON
Version 0.0.16 PyPI version JSON
download
home_pageNone
SummaryA wrapper for loading medical 3D image volumes such as NIFTI or NRRD images.
upload_time2024-12-29 10:29:09
maintainerNone
docs_urlNone
authorKarol Gotkowski
requires_python>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MedVol

[![License Apache Software License 2.0](https://img.shields.io/pypi/l/medvol.svg?color=green)](https://github.com/Karol-G/medvol/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/medvol.svg?color=green)](https://pypi.org/project/medvol)
[![Python Version](https://img.shields.io/pypi/pyversions/medvol.svg?color=green)](https://python.org)

A wrapper for loading medical 2D, 3D and 4D NIFTI or NRRD images.

Features:
- Supports loading and saving of 2D, 3D and 4D Nifti and NRRD images
    - (Saving 4D images is currently not supported due to a SimpleITK bug)
- Simple access to image array
- Simple access to image metadata
    - Affine
    - Spacing
    - Origin
    - Direction
    - Translation
    - Rotation
    - Scale (Same as spacing)
    - Shear
    - Header (The raw header)
- Copying/Modification of all or selected metadata across MedVol images


## Installation

You can install `medvol` via [pip](https://pypi.org/project/medvol/):

    pip install medvol

## Example

```python
from medvol import MedVol

# Load NIFTI image
image = MedVol("path/to/image.nifti")

# Print some metadata
print("Spacing: ", image.spacing)
print("Affine: ", image.affine)
print("Rotation: ", image.rotation)
print("Header: ", image.header)

# Access and modify the image array
arr = image.array
arr[0, 0, 0] = 1

# Create a new image with the new array, a new spacing, but copy all remaining metadata
new_image = MedVol(arr, spacing=[2, 2, 2], copy=image)

# Save the new image as NRRD
new_image.save("path/to/new_image.nrrd")
```


## Contributing

Contributions are very welcome. Tests can be run with [tox], please ensure
the coverage at least stays the same before you submit a pull request.

## License

Distributed under the terms of the [Apache Software License 2.0] license,
"medvol" is free and open source software

## Issues

If you encounter any problems, please file an issue along with a detailed description.

[Cookiecutter]: https://github.com/audreyr/cookiecutter
[MIT]: http://opensource.org/licenses/MIT
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt

[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "MedVol",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Karol Gotkowski",
    "author_email": "karol.gotkowski@dkfz.de",
    "download_url": "https://files.pythonhosted.org/packages/be/92/e3f9eee886cbfed54f2fb308b2759b58b03285bc0fa8a7b29ae5e6bd072d/medvol-0.0.16.tar.gz",
    "platform": null,
    "description": "# MedVol\n\n[![License Apache Software License 2.0](https://img.shields.io/pypi/l/medvol.svg?color=green)](https://github.com/Karol-G/medvol/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/medvol.svg?color=green)](https://pypi.org/project/medvol)\n[![Python Version](https://img.shields.io/pypi/pyversions/medvol.svg?color=green)](https://python.org)\n\nA wrapper for loading medical 2D, 3D and 4D NIFTI or NRRD images.\n\nFeatures:\n- Supports loading and saving of 2D, 3D and 4D Nifti and NRRD images\n    - (Saving 4D images is currently not supported due to a SimpleITK bug)\n- Simple access to image array\n- Simple access to image metadata\n    - Affine\n    - Spacing\n    - Origin\n    - Direction\n    - Translation\n    - Rotation\n    - Scale (Same as spacing)\n    - Shear\n    - Header (The raw header)\n- Copying/Modification of all or selected metadata across MedVol images\n\n\n## Installation\n\nYou can install `medvol` via [pip](https://pypi.org/project/medvol/):\n\n    pip install medvol\n\n## Example\n\n```python\nfrom medvol import MedVol\n\n# Load NIFTI image\nimage = MedVol(\"path/to/image.nifti\")\n\n# Print some metadata\nprint(\"Spacing: \", image.spacing)\nprint(\"Affine: \", image.affine)\nprint(\"Rotation: \", image.rotation)\nprint(\"Header: \", image.header)\n\n# Access and modify the image array\narr = image.array\narr[0, 0, 0] = 1\n\n# Create a new image with the new array, a new spacing, but copy all remaining metadata\nnew_image = MedVol(arr, spacing=[2, 2, 2], copy=image)\n\n# Save the new image as NRRD\nnew_image.save(\"path/to/new_image.nrrd\")\n```\n\n\n## Contributing\n\nContributions are very welcome. Tests can be run with [tox], please ensure\nthe coverage at least stays the same before you submit a pull request.\n\n## License\n\nDistributed under the terms of the [Apache Software License 2.0] license,\n\"medvol\" is free and open source software\n\n## Issues\n\nIf you encounter any problems, please file an issue along with a detailed description.\n\n[Cookiecutter]: https://github.com/audreyr/cookiecutter\n[MIT]: http://opensource.org/licenses/MIT\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt\n[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt\n[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0\n[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt\n\n[tox]: https://tox.readthedocs.io/en/latest/\n[pip]: https://pypi.org/project/pip/\n[PyPI]: https://pypi.org/\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A wrapper for loading medical 3D image volumes such as NIFTI or NRRD images.",
    "version": "0.0.16",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "adb47cfb52f63a25f821046f9f2a43f6a8c80c59aad6959c3f5fab64444f4d2b",
                "md5": "55ff9adfa53a02ef4e4ed42bdd0af2ca",
                "sha256": "8a483eb06e46c06fa45daf4e9678b2f2504f90227ee472b6c67d5c99c0d716fe"
            },
            "downloads": -1,
            "filename": "MedVol-0.0.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "55ff9adfa53a02ef4e4ed42bdd0af2ca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9496,
            "upload_time": "2024-12-29T10:29:06",
            "upload_time_iso_8601": "2024-12-29T10:29:06.874682Z",
            "url": "https://files.pythonhosted.org/packages/ad/b4/7cfb52f63a25f821046f9f2a43f6a8c80c59aad6959c3f5fab64444f4d2b/MedVol-0.0.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be92e3f9eee886cbfed54f2fb308b2759b58b03285bc0fa8a7b29ae5e6bd072d",
                "md5": "1db41fbb91930d1f3ebd76944b155672",
                "sha256": "34319b0a31c4f1516b1dd45991971b60d9db0e75d1cfc47150afdbc79339f51c"
            },
            "downloads": -1,
            "filename": "medvol-0.0.16.tar.gz",
            "has_sig": false,
            "md5_digest": "1db41fbb91930d1f3ebd76944b155672",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9865,
            "upload_time": "2024-12-29T10:29:09",
            "upload_time_iso_8601": "2024-12-29T10:29:09.024456Z",
            "url": "https://files.pythonhosted.org/packages/be/92/e3f9eee886cbfed54f2fb308b2759b58b03285bc0fa8a7b29ae5e6bd072d/medvol-0.0.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-29 10:29:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "medvol"
}
        
Elapsed time: 0.60451s