nifti2dicom


Namenifti2dicom JSON
Version 1.2.6 PyPI version JSON
download
home_pageNone
SummaryA package to convert NIfTI images to DICOM format using a reference DICOM series.
upload_time2024-10-03 13:40:08
maintainerNone
docs_urlNone
authorLalith Kumar Shiyam Sundar
requires_pythonNone
licenseMIT
keywords nifti dicom converter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![nifti2dicom-logo](/Nifti2dicom-logo.png)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->


## Nifti2Dicom 🧠💽

[![PyPI version](https://badge.fury.io/py/nifti2dicom.svg)](https://pypi.org/project/nifti2dicom/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://www.gnu.org/licenses/MIT)


Hello there, brave soul! 🌟 Welcome to **Nifti2Dicom** - a project born out of sheer determination, despair, pain and probably a smidge too much caffeine. ☕️ Ever felt like converting NIfTI to DICOM was akin to summoning a minor demon from the pandora's box? 😈 So did we. Which is why we created this snazzy tool to prevent any more unplanned infernal conferences.


## Magic Powers (Features) 🌟

🌌 Dimensional Doorways - Step into our magical portal! Whether you're jumping into a 3D realm or a more mysterious 4D time-warp, we've got you covered. Convert both 3D and 4D nifti images to DICOM. So, if you're clutching a 4D motion-corrected series in nifti, don't fret. We're your dimensional travel agency!
🎨 The Colorful Canvas of Segmentations - Ever dreamt of painting the universe with multilabel nifti segmentations? Well, maybe not. But hey, we can convert those vibrant dreams into 3D DICOM for you. Just hand over your brush, or in this case, your label to region mapping (tutorial brewing in our cauldron), and watch the masterpiece unfold!

## Prerequisites 📋

- **OS**: Universal - because we don't discriminate. 🌍
- **Python**: Version 3.10 is required because even we have our limits. 🐍

## Installation 🔧

We highly recommend using a different realm (virtual environment) for installing nifti2dicom (or any other Python package, really).

### Linux
```bash
python3.10 -m venv nifti2dicom
source nifti2dicom/bin/activate
```

### Windows
```bash
python -m venv nifti2dicom
nifti2dicom\Scripts\activate.bat  
```

And now, wave a magic wand... just kidding. Do this:

```bash
pip install nifti2dicom
```

## Usage 🚀

Using the mighty **Nifti2Dicom** is (thankfully) less complicated than its origin story:


1. Open your command line or terminal. 💻
2. Enter the following command, replacing the placeholders with your actual paths and desired series description:

### Converting 3d/4d images 
#### For 3d
```bash
   nifti2dicom \
       -d <dicom_dir>               # Directory containing reference DICOM series
       -n <nifti_path>              # Path to the NIFTI file to be converted
       -o <output_dir>              # Directory where the converted DICOM files will be saved
       -desc "<series_description>" # Description for the DICOM series
       -t img                       # Specifies the type of conversion (image in this case)
```
#### For 4d
```bash
   nifti2dicom \
       -d <dicom_dir>               # Directory containing reference DICOM series
       -n <nifti_path>              # Path to the NIFTI file to be converted
       -o <output_dir>              # Directory where the converted DICOM files will be saved
       -desc "<series_description>" # Description for the DICOM series
       -t img                       # Specifies the type of conversion (image in this case)
       -v <sms | ux>                # Specifies the vendor, either "sms" or "ux"
```
Ignore the vendor tag, if you are working on 3d images. It is just relevant for 4D. The logic is the same for 3D.

 ### Converting segmentations single/multilabel segmentations
```bash
    nifti2dicom \
       -d <dicom_dir>               # Directory containing reference DICOM series
       -n <nifti_path>              # Path to the NIFTI file to be converted
       -o <output_dir>              # Directory where the converted DICOM files will be saved
       -desc "<series_description>" # Description for the DICOM series
       -t seg                       # Specifies the type of conversion (segmentation in this case)
       -j <path_to_json>            # Path to the JSON file containing the organ index
```
For converting nifti segmentations to DICOM, you always need to a pass a json file, which contains the mapping of the labels to the region names. The sample .json file can be found [here](/labels_region.json).

### Example:

#### Segmentation conversion
  
```bash
nifti2dicom \
    -d ./refDICOM               # Reference directory with DICOM series
    -n ./brainSegmentation.nii  # Path to the NIFTI segmentation file
    -o ./convertedSegDICOM      # Output directory for the converted segmentation DICOM
    -desc "Brain Segmentation"  # Description for the DICOM series
    -t seg                      # Type of conversion: segmentation
    -j ./organ_index.json       # Path to the JSON file with organ index
```   

#### Image conversion
##### 3d conversion
```bash
nifti2dicom \
    -d ./refDICOM               # Reference directory with DICOM series
    -n ./brainMRI.nii           # Path to the NIFTI image file
    -o ./convertedImgDICOM      # Output directory for the converted image DICOM
    -desc "Fancy Brain Scan"    # Description for the DICOM series
    -t img                      # Type of conversion: image
```
                               
##### 4d conversion
```bash
nifti2dicom \
    -d ./refDICOM               # Reference directory with DICOM series
    -n ./brainMRI.nii           # Path to the NIFTI image file
    -o ./convertedImgDICOM      # Output directory for the converted image DICOM
    -desc "Fancy Brain Scan"    # Description for the DICOM series
    -t img                      # Type of conversion: image
    -v sms                      # Vendor: Siemens (you can replace this with the \
                                # appropriate vendor name, as of now support for united imaging \
                                # and siemens is provided. You can choose one of the two (sms or ux), the default value is ux)
```

 Still confused? You can always type ```nifti2dicom -h``` for help!

## Issues & Feedback 🐛🗣

If you stumble upon any pesky bugs, or have suggestions to prevent other unforeseen exorcisms, [Open an issue](https://github.com/LalithShiyam/nifti2dicom/issues). Also, if you ever come up with a way to bring peace between NIfTI and DICOM, we're all ears (and eyes 👀)!

## License 📜

This project is licensed under the MIT License. Check out the `LICENSE` file to see the fine print.

## Acknowledgments 👏

- To coffee, our eternal ally. ☕️
- The patience of everyone who ever sat near a developer (me) while they mumbled about DICOM headers.
- The spirit animal of this project: A platypus, because just like this software, it's unique, unexpected, and gets the job done (to a reasonable extent - we are managing expectations here)!


## 🎩🔮 A Gentle Wizardly Reminder 🔮🎩

Dear adventurous user, while Nifti2Dicom is sprinkled with a generous dose of magic and wizardry, it's essential to remember that no spell is perfect. Just like the age-old "turn a frog into a prince" trick, sometimes things don't pan out (ask any fairy tale princess). For example our segmentation conversion was tested on slicer 3D with QuantitativeReporting plugin, and we are not sure if it will work on everything.

If you ever find yourself uttering "It doesn't work!" take a deep breath, consider the vastness of the cosmos, and remember — our tool isn't the answer to every cosmic conundrum. It's not a magic bullet (or wand) that'll work wonders in every scenario. But fret not, intrepid one! Reach out, and together, let's see if we can make a tad more magic happen.

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/franzmaliszt"><img src="https://avatars.githubusercontent.com/u/32265629?v=4?s=100" width="100px;" alt="franzmaliszt"/><br /><sub><b>franzmaliszt</b></sub></a><br /><a href="https://github.com/ENHANCE-PET/nifti2dicom/commits?author=franzmaliszt" title="Code">💻</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nifti2dicom",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "nifti dicom converter",
    "author": "Lalith Kumar Shiyam Sundar",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4e/2c/dd85f0e2ae94825a9c80e08e0996e2ee66d1688042daec142ef50a64f826/nifti2dicom-1.2.6.tar.gz",
    "platform": null,
    "description": "![nifti2dicom-logo](/Nifti2dicom-logo.png)\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n\n## Nifti2Dicom \ud83e\udde0\ud83d\udcbd\n\n[![PyPI version](https://badge.fury.io/py/nifti2dicom.svg)](https://pypi.org/project/nifti2dicom/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://www.gnu.org/licenses/MIT)\n\n\nHello there, brave soul! \ud83c\udf1f Welcome to **Nifti2Dicom** - a project born out of sheer determination, despair, pain and probably a smidge too much caffeine. \u2615\ufe0f Ever felt like converting NIfTI to DICOM was akin to summoning a minor demon from the pandora's box? \ud83d\ude08 So did we. Which is why we created this snazzy tool to prevent any more unplanned infernal conferences.\n\n\n## Magic Powers (Features) \ud83c\udf1f\n\n\ud83c\udf0c Dimensional Doorways - Step into our magical portal! Whether you're jumping into a 3D realm or a more mysterious 4D time-warp, we've got you covered. Convert both 3D and 4D nifti images to DICOM. So, if you're clutching a 4D motion-corrected series in nifti, don't fret. We're your dimensional travel agency!\n\ud83c\udfa8 The Colorful Canvas of Segmentations - Ever dreamt of painting the universe with multilabel nifti segmentations? Well, maybe not. But hey, we can convert those vibrant dreams into 3D DICOM for you. Just hand over your brush, or in this case, your label to region mapping (tutorial brewing in our cauldron), and watch the masterpiece unfold!\n\n## Prerequisites \ud83d\udccb\n\n- **OS**: Universal - because we don't discriminate. \ud83c\udf0d\n- **Python**: Version 3.10 is required because even we have our limits. \ud83d\udc0d\n\n## Installation \ud83d\udd27\n\nWe highly recommend using a different realm (virtual environment) for installing nifti2dicom (or any other Python package, really).\n\n### Linux\n```bash\npython3.10 -m venv nifti2dicom\nsource nifti2dicom/bin/activate\n```\n\n### Windows\n```bash\npython -m venv nifti2dicom\nnifti2dicom\\Scripts\\activate.bat  \n```\n\nAnd now, wave a magic wand... just kidding. Do this:\n\n```bash\npip install nifti2dicom\n```\n\n## Usage \ud83d\ude80\n\nUsing the mighty **Nifti2Dicom** is (thankfully) less complicated than its origin story:\n\n\n1. Open your command line or terminal. \ud83d\udcbb\n2. Enter the following command, replacing the placeholders with your actual paths and desired series description:\n\n### Converting 3d/4d images \n#### For 3d\n```bash\n   nifti2dicom \\\n       -d <dicom_dir>               # Directory containing reference DICOM series\n       -n <nifti_path>              # Path to the NIFTI file to be converted\n       -o <output_dir>              # Directory where the converted DICOM files will be saved\n       -desc \"<series_description>\" # Description for the DICOM series\n       -t img                       # Specifies the type of conversion (image in this case)\n```\n#### For 4d\n```bash\n   nifti2dicom \\\n       -d <dicom_dir>               # Directory containing reference DICOM series\n       -n <nifti_path>              # Path to the NIFTI file to be converted\n       -o <output_dir>              # Directory where the converted DICOM files will be saved\n       -desc \"<series_description>\" # Description for the DICOM series\n       -t img                       # Specifies the type of conversion (image in this case)\n       -v <sms | ux>                # Specifies the vendor, either \"sms\" or \"ux\"\n```\nIgnore the vendor tag, if you are working on 3d images. It is just relevant for 4D. The logic is the same for 3D.\n\n ### Converting segmentations single/multilabel segmentations\n```bash\n    nifti2dicom \\\n       -d <dicom_dir>               # Directory containing reference DICOM series\n       -n <nifti_path>              # Path to the NIFTI file to be converted\n       -o <output_dir>              # Directory where the converted DICOM files will be saved\n       -desc \"<series_description>\" # Description for the DICOM series\n       -t seg                       # Specifies the type of conversion (segmentation in this case)\n       -j <path_to_json>            # Path to the JSON file containing the organ index\n```\nFor converting nifti segmentations to DICOM, you always need to a pass a json file, which contains the mapping of the labels to the region names. The sample .json file can be found [here](/labels_region.json).\n\n### Example:\n\n#### Segmentation conversion\n  \n```bash\nnifti2dicom \\\n    -d ./refDICOM               # Reference directory with DICOM series\n    -n ./brainSegmentation.nii  # Path to the NIFTI segmentation file\n    -o ./convertedSegDICOM      # Output directory for the converted segmentation DICOM\n    -desc \"Brain Segmentation\"  # Description for the DICOM series\n    -t seg                      # Type of conversion: segmentation\n    -j ./organ_index.json       # Path to the JSON file with organ index\n```   \n\n#### Image conversion\n##### 3d conversion\n```bash\nnifti2dicom \\\n    -d ./refDICOM               # Reference directory with DICOM series\n    -n ./brainMRI.nii           # Path to the NIFTI image file\n    -o ./convertedImgDICOM      # Output directory for the converted image DICOM\n    -desc \"Fancy Brain Scan\"    # Description for the DICOM series\n    -t img                      # Type of conversion: image\n```\n                               \n##### 4d conversion\n```bash\nnifti2dicom \\\n    -d ./refDICOM               # Reference directory with DICOM series\n    -n ./brainMRI.nii           # Path to the NIFTI image file\n    -o ./convertedImgDICOM      # Output directory for the converted image DICOM\n    -desc \"Fancy Brain Scan\"    # Description for the DICOM series\n    -t img                      # Type of conversion: image\n    -v sms                      # Vendor: Siemens (you can replace this with the \\\n                                # appropriate vendor name, as of now support for united imaging \\\n                                # and siemens is provided. You can choose one of the two (sms or ux), the default value is ux)\n```\n\n Still confused? You can always type ```nifti2dicom -h``` for help!\n\n## Issues & Feedback \ud83d\udc1b\ud83d\udde3\n\nIf you stumble upon any pesky bugs, or have suggestions to prevent other unforeseen exorcisms, [Open an issue](https://github.com/LalithShiyam/nifti2dicom/issues). Also, if you ever come up with a way to bring peace between NIfTI and DICOM, we're all ears (and eyes \ud83d\udc40)!\n\n## License \ud83d\udcdc\n\nThis project is licensed under the MIT License. Check out the `LICENSE` file to see the fine print.\n\n## Acknowledgments \ud83d\udc4f\n\n- To coffee, our eternal ally. \u2615\ufe0f\n- The patience of everyone who ever sat near a developer (me) while they mumbled about DICOM headers.\n- The spirit animal of this project: A platypus, because just like this software, it's unique, unexpected, and gets the job done (to a reasonable extent - we are managing expectations here)!\n\n\n## \ud83c\udfa9\ud83d\udd2e A Gentle Wizardly Reminder \ud83d\udd2e\ud83c\udfa9\n\nDear adventurous user, while Nifti2Dicom is sprinkled with a generous dose of magic and wizardry, it's essential to remember that no spell is perfect. Just like the age-old \"turn a frog into a prince\" trick, sometimes things don't pan out (ask any fairy tale princess). For example our segmentation conversion was tested on slicer 3D with QuantitativeReporting plugin, and we are not sure if it will work on everything.\n\nIf you ever find yourself uttering \"It doesn't work!\" take a deep breath, consider the vastness of the cosmos, and remember \u2014 our tool isn't the answer to every cosmic conundrum. It's not a magic bullet (or wand) that'll work wonders in every scenario. But fret not, intrepid one! Reach out, and together, let's see if we can make a tad more magic happen.\n\n## Contributors \u2728\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/franzmaliszt\"><img src=\"https://avatars.githubusercontent.com/u/32265629?v=4?s=100\" width=\"100px;\" alt=\"franzmaliszt\"/><br /><sub><b>franzmaliszt</b></sub></a><br /><a href=\"https://github.com/ENHANCE-PET/nifti2dicom/commits?author=franzmaliszt\" title=\"Code\">\ud83d\udcbb</a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package to convert NIfTI images to DICOM format using a reference DICOM series.",
    "version": "1.2.6",
    "project_urls": null,
    "split_keywords": [
        "nifti",
        "dicom",
        "converter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2cb57c9719e31db5f9696dd7cf1b83a3553bedb9657b713851bf853e864cdcc",
                "md5": "2bf13c307a04414c4e2e054412fddac2",
                "sha256": "f46b0637009b45f9b5d715997e08fc68d69ab6f47ba16a1804cfe087f2f6a496"
            },
            "downloads": -1,
            "filename": "nifti2dicom-1.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bf13c307a04414c4e2e054412fddac2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 20235,
            "upload_time": "2024-10-03T13:40:07",
            "upload_time_iso_8601": "2024-10-03T13:40:07.663276Z",
            "url": "https://files.pythonhosted.org/packages/c2/cb/57c9719e31db5f9696dd7cf1b83a3553bedb9657b713851bf853e864cdcc/nifti2dicom-1.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e2cdd85f0e2ae94825a9c80e08e0996e2ee66d1688042daec142ef50a64f826",
                "md5": "94dcd638886493d17ebb15250837ac30",
                "sha256": "5dbe5faceeea457ca64a6faa05e113d5cf78a37f92bed6e0f55316995fdfdd9b"
            },
            "downloads": -1,
            "filename": "nifti2dicom-1.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "94dcd638886493d17ebb15250837ac30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21676,
            "upload_time": "2024-10-03T13:40:08",
            "upload_time_iso_8601": "2024-10-03T13:40:08.599167Z",
            "url": "https://files.pythonhosted.org/packages/4e/2c/dd85f0e2ae94825a9c80e08e0996e2ee66d1688042daec142ef50a64f826/nifti2dicom-1.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-03 13:40:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nifti2dicom"
}
        
Elapsed time: 0.31711s