nekton


Namenekton JSON
Version 0.2.6 PyPI version JSON
download
home_pagehttps://github.com/deepc-health/nekton
SummaryA python package for DICOM to NifTi and NifTi to DICOM-SEG and GSPS conversion
upload_time2023-09-25 18:58:53
maintainer
docs_urlNone
authora-parida12
requires_python>=3.6.9,<4.0.0
licenseMIT
keywords dicom medical-imaging nifti dicom-seg gsps
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Nekton
[![Python Application Testing](https://github.com/deepc-health/nekton/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/deepc-health/nekton/actions/workflows/tests.yml)[![Test and Release](https://github.com/deepc-health/nekton/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/deepc-health/nekton/actions/workflows/release.yml)
[![Python Versions](https://img.shields.io/pypi/pyversions/nekton.svg)](https://pypi.org/project/nekton/)[![Package version](https://img.shields.io/pypi/v/nekton?color=%2334D058&label=pypi%20package)](https://pypi.org/project/nekton/)

> A python package for DICOM to NifTi and NifTi to DICOM-SEG and GSPS conversion

## SETUP

The python package is available for use on PyPI. It can be setup simply via pip

```bash
pip install nekton
```

To the check the setup, simply check the version number of the `nekton` package by

```bash
python -c 'import nekton; print(nekton.__version__)'
```

## DICOM to NifTi

The DICOM to NifTi conversion in the package is based on a wrapper around the [dcm2niix](https://github.com/rordenlab/dcm2niix) software.

### Usage

```python
from nekton.dcm2nii import Dcm2Nii
converter = Dcm2Nii()
converted_files = converter.run(dicom_directory='/test_files/CT5N',  out_directory='/test_files/CT5N', name='Test')
# Converted 5 DCM to Nifti; Output stored @ /test_files/CT5N
print(converted_files)
# ['/test_files/CT5N/Test_SmartScore_-_Gated_0.5_sec_20010101000000_5.nii.gz']
```

Parameters `converter.run`:

- `dicom_directory (Path)`: path to directory with Dicoms
- `dicom_directory (Path, optional)`: directory to store the output nifti
- `name (str, optional)`: Name to be given to the output file. Defaults to "".

Returns:

- `List[Path]`: output list of Nifti files


### Notes

- The renaming functionality retains the [suffixes](https://github.com/rordenlab/dcm2niix/blob/master/FILENAMING.md) from the original program.
- The BIDS sidecar json is retained as well.

## NifTi to DICOM-SEG

The NifTi to DICOM-SEG within nekton converts incoming segmentation NifTi to DICOM-SEG. The matching of the segmentation index to a text label is 
done via json file using the schema suggested by `dcmqi`. The json can be generated using the [gui](http://qiicr.org/dcmqi/#/seg) also an example can be seen [here](https://github.com/deepc-health/nekton/blob/master/tests/test_data/sample_segmentation/mapping.json). 

Currently, `nekton` supports creation of multiclass DICOM-SEG of two types-

- single layer DICOM-SEG, where each non-empty slice has an individual file
- multi layer DICOM-SEG, where all the n slices are rolled into a single file

### Usage

1. NifTi to single layer DICOM-SEG

```python
from nekton.nii2dcm import Nii2DcmSeg
import glob
converter = Nii2DcmSeg()
path_dcms = [path for path in glob.glob(dir_dcms)]
path_mapping = "mapping.json"
path_seg_nifti = "CT5N_segmentation.nii.gz"
dcmsegs = converter_dcmseg.multiclass_converter(
        segfile = path_seg_nifti, segMapping= path_mapping, dcmfiles =path_dcms, multiLayer=False
    )
print (len(dcmsegs))
# 3
```

2. NifTi to multi layer DICOM-SEG

```python
from nekton.nii2dcm import Nii2DcmSeg
import glob
converter = Nii2DcmSeg()
path_dcms = [path for path in glob.glob(dir_dcms)]
path_mapping = "mapping.json"
path_seg_nifti = "CT5N_segmentation.nii.gz"
dcmsegs = converter.multiclass_converter(
        segfile = path_seg_nifti, segMapping= path_mapping, dcmfiles =path_dcms, multiLayer=True
    )
print (len(dcmsegs))
# 1
```

Parameters `converter.multiclass_converter`:

- `segfile (Path)`: path to the nifti segmentation file
- `segMapping (Path)`: path to the dcmqii format segmentation mapping json
- `dcmfiles (List[Path])`: list of paths of all the source dicom files
- `multiLayer (bool, optional)`: create a single multilayer dicomseg. Defaults to False.

Returns:

- `List[Path]`: list of paths of all generated dicomseg files

### Notes

- Multilabel NifTi(in the form of a NifTi file for a single label) to DICOM-SEG is under development.

## NifTi to GSPS

```
This feature will be available in a future release of the nekton
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/deepc-health/nekton",
    "name": "nekton",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.9,<4.0.0",
    "maintainer_email": "",
    "keywords": "dicom,medical-imaging,nifti,dicom-seg,gsps",
    "author": "a-parida12",
    "author_email": "abhijeet@deepc.ai",
    "download_url": "https://files.pythonhosted.org/packages/8f/35/24074d89e6f789084c5c2040d1279874307f81f2abb710f1ace3d2c1ace0/nekton-0.2.6.tar.gz",
    "platform": null,
    "description": "# Nekton\n[![Python Application Testing](https://github.com/deepc-health/nekton/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/deepc-health/nekton/actions/workflows/tests.yml)[![Test and Release](https://github.com/deepc-health/nekton/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/deepc-health/nekton/actions/workflows/release.yml)\n[![Python Versions](https://img.shields.io/pypi/pyversions/nekton.svg)](https://pypi.org/project/nekton/)[![Package version](https://img.shields.io/pypi/v/nekton?color=%2334D058&label=pypi%20package)](https://pypi.org/project/nekton/)\n\n> A python package for DICOM to NifTi and NifTi to DICOM-SEG and GSPS conversion\n\n## SETUP\n\nThe python package is available for use on PyPI. It can be setup simply via pip\n\n```bash\npip install nekton\n```\n\nTo the check the setup, simply check the version number of the `nekton` package by\n\n```bash\npython -c 'import nekton; print(nekton.__version__)'\n```\n\n## DICOM to NifTi\n\nThe DICOM to NifTi conversion in the package is based on a wrapper around the [dcm2niix](https://github.com/rordenlab/dcm2niix) software.\n\n### Usage\n\n```python\nfrom nekton.dcm2nii import Dcm2Nii\nconverter = Dcm2Nii()\nconverted_files = converter.run(dicom_directory='/test_files/CT5N',  out_directory='/test_files/CT5N', name='Test')\n# Converted 5 DCM to Nifti; Output stored @ /test_files/CT5N\nprint(converted_files)\n# ['/test_files/CT5N/Test_SmartScore_-_Gated_0.5_sec_20010101000000_5.nii.gz']\n```\n\nParameters `converter.run`:\n\n- `dicom_directory (Path)`: path to directory with Dicoms\n- `dicom_directory (Path, optional)`: directory to store the output nifti\n- `name (str, optional)`: Name to be given to the output file. Defaults to \"\".\n\nReturns:\n\n- `List[Path]`: output list of Nifti files\n\n\n### Notes\n\n- The renaming functionality retains the [suffixes](https://github.com/rordenlab/dcm2niix/blob/master/FILENAMING.md) from the original program.\n- The BIDS sidecar json is retained as well.\n\n## NifTi to DICOM-SEG\n\nThe NifTi to DICOM-SEG within nekton converts incoming segmentation NifTi to DICOM-SEG. The matching of the segmentation index to a text label is \ndone via json file using the schema suggested by `dcmqi`. The json can be generated using the [gui](http://qiicr.org/dcmqi/#/seg) also an example can be seen [here](https://github.com/deepc-health/nekton/blob/master/tests/test_data/sample_segmentation/mapping.json). \n\nCurrently, `nekton` supports creation of multiclass DICOM-SEG of two types-\n\n- single layer DICOM-SEG, where each non-empty slice has an individual file\n- multi layer DICOM-SEG, where all the n slices are rolled into a single file\n\n### Usage\n\n1. NifTi to single layer DICOM-SEG\n\n```python\nfrom nekton.nii2dcm import Nii2DcmSeg\nimport glob\nconverter = Nii2DcmSeg()\npath_dcms = [path for path in glob.glob(dir_dcms)]\npath_mapping = \"mapping.json\"\npath_seg_nifti = \"CT5N_segmentation.nii.gz\"\ndcmsegs = converter_dcmseg.multiclass_converter(\n        segfile = path_seg_nifti, segMapping= path_mapping, dcmfiles =path_dcms, multiLayer=False\n    )\nprint (len(dcmsegs))\n# 3\n```\n\n2. NifTi to multi layer DICOM-SEG\n\n```python\nfrom nekton.nii2dcm import Nii2DcmSeg\nimport glob\nconverter = Nii2DcmSeg()\npath_dcms = [path for path in glob.glob(dir_dcms)]\npath_mapping = \"mapping.json\"\npath_seg_nifti = \"CT5N_segmentation.nii.gz\"\ndcmsegs = converter.multiclass_converter(\n        segfile = path_seg_nifti, segMapping= path_mapping, dcmfiles =path_dcms, multiLayer=True\n    )\nprint (len(dcmsegs))\n# 1\n```\n\nParameters `converter.multiclass_converter`:\n\n- `segfile (Path)`: path to the nifti segmentation file\n- `segMapping (Path)`: path to the dcmqii format segmentation mapping json\n- `dcmfiles (List[Path])`: list of paths of all the source dicom files\n- `multiLayer (bool, optional)`: create a single multilayer dicomseg. Defaults to False.\n\nReturns:\n\n- `List[Path]`: list of paths of all generated dicomseg files\n\n### Notes\n\n- Multilabel NifTi(in the form of a NifTi file for a single label) to DICOM-SEG is under development.\n\n## NifTi to GSPS\n\n```\nThis feature will be available in a future release of the nekton\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A python package for DICOM to NifTi and NifTi to DICOM-SEG and GSPS conversion",
    "version": "0.2.6",
    "project_urls": {
        "Homepage": "https://github.com/deepc-health/nekton",
        "Repository": "https://github.com/deepc-health/nekton"
    },
    "split_keywords": [
        "dicom",
        "medical-imaging",
        "nifti",
        "dicom-seg",
        "gsps"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "40ad91c4105902e1249eebb937b41f5fed40e2f9e21099c127da0e5154992b84",
                "md5": "2d2db2eed110fb324ba881126c93cfc8",
                "sha256": "5eca702f1c0dc6ed8a410939ae9cc7e13e7bdc9adde98f6cbd87b945875c5da9"
            },
            "downloads": -1,
            "filename": "nekton-0.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2d2db2eed110fb324ba881126c93cfc8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.9,<4.0.0",
            "size": 24217257,
            "upload_time": "2023-09-25T18:58:35",
            "upload_time_iso_8601": "2023-09-25T18:58:35.924644Z",
            "url": "https://files.pythonhosted.org/packages/40/ad/91c4105902e1249eebb937b41f5fed40e2f9e21099c127da0e5154992b84/nekton-0.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f3524074d89e6f789084c5c2040d1279874307f81f2abb710f1ace3d2c1ace0",
                "md5": "a70f108938f2eca91198a688ee72ed2c",
                "sha256": "e0b1228edcd2ae7460d695214ef1b879ed49e149471868fa4e47186258b531a3"
            },
            "downloads": -1,
            "filename": "nekton-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "a70f108938f2eca91198a688ee72ed2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.9,<4.0.0",
            "size": 24135628,
            "upload_time": "2023-09-25T18:58:53",
            "upload_time_iso_8601": "2023-09-25T18:58:53.961560Z",
            "url": "https://files.pythonhosted.org/packages/8f/35/24074d89e6f789084c5c2040d1279874307f81f2abb710f1ace3d2c1ace0/nekton-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-25 18:58:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "deepc-health",
    "github_project": "nekton",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nekton"
}
        
Elapsed time: 0.13927s