CBCTCardiacSegmentation


NameCBCTCardiacSegmentation JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummarySegment Cardiac structures in CBCT images
upload_time2024-08-19 00:29:57
maintainerNone
docs_urlNone
authorMark Gardner
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CBCTCardiacSegmentation

[![test](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/actions/workflows/python-app.yml)
[![codecov](https://codecov.io/github/Image-X-Institute/CBCTCardiacSegmentation/graph/badge.svg?token=YKpvfVsa5X)](https://codecov.io/github/Image-X-Institute/CBCTCardiacSegmentation)

**Author:** *Mark Gardner*

![CBCTExampleImage](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/blob/main/docs/_images/GTHeartSegs.png?raw=true)

This code will generate cardiac segmentations in CBCT images. The input is dicom or volume files of a CBCT image and an optional planning CT and will output dicom and nifti segmentations of cardiac segmentations that are compatible with the input CBCT image. **Currently this works in Linux only**


## Setup/Build/Install

The module can installed using pip:

```
pip install CBCTCardiacSegmentation
```

This code uses the platipy repo (https://github.com/pyplati/platipy). If the platipy module is not automatically installed when installing the CTHeadDeformation code, the platipy library can be installed separately using the installation instructions (https://pyplati.github.io/platipy/getting_started.html). 

Install elastix (https://elastix.lumc.nl/index.php)

## Usage

Sample Data can be downloaded from the cancer imaging archive. For this example we will be using data from the 4d-lung dataset.  (https://www.cancerimagingarchive.net/collection/4d-lung/)

### Download example data

Download the dicom data for one phase of the 4D-CBCT scan, and one phase of the 4D-CT. For example for patientID 100_HM10395, download the <P4^P100^S100^I0, Gated, 0.0%> CBCT dicom data from the Sep 14, 1997, and the <P4^P100^S300^I00003, Gated, 0.0%A> CT dicom data from the Jul 01, 2003.

The CBCT and CT directories can then be set to:

```
CBCTDicomDir = "<Directory where data was downloaded to>/4D-Lung/100_HM10395/09-15-1997-NA-p4-69351/500.000000-P4P100S100I0 Gated 0.0-90726"
CTDicomDir = "<Directory where data was downloaded to>/4D-Lung/100_HM10395/07-02-2003-NA-p4-14571/1.000000-P4P100S300I00003 Gated 0.0A-29193"
```
The directory where the created segmentations can also be set
```
OutputDir = "<Directory where data was downloaded to>/4D-Lung/100_HM10395/CardiacSegmentations
```

### Run in python script
See [DemonstrateCBCTSegmentation.py](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/blob/master/CBCTCardiacSegmentation/DemonstrateCBCTSegmentation.py) for an example python script. 
```
from  CBCTCardiacSegmentation import CreateCBCTSegmentations
CreateCBCTSegmentations(CBCTDicomDir,OutputDir=OutputDir,PlanningCTDir=CTDicomDir)
```

### Run in a command line

In a command line (such as anaconda command prompt) navigate to the directory that the CTHeadDeformation repo was cloned to and run 
```python CreateCBCTSegmentations.py <CBCTDicomDir> --OutputDir <OutputDir> --PlanningCTDir <CTDicomDir>``` 

### Function Options
 A summary of the input options are shown below
 ```
  --CBCTDir CBCTDIR     Location of the Cone-beam CT that is to be segmented. Can be a Dicom Series or Volume file.
  --OutputDir OUTPUTDIR
                        Directory where the created segmentations will be created. Default is ./CBCTSegmentations. (Optional)
  --SegmentationMethod SEGMENTATIONMETHOD
                        The method used to segment the CBCT image {Synthetic|Transform|Direct}. Default is Synthetic. (Optional)
  --PlanningCTDir PLANNINGCTDIR
                        Location of the Planning CT that is to be segmented. Can be a Dicom Series or Volume file.
                        Default is None. (Optional)
  --ElastixParamDir ELASTIXPARAMDIR
                        Location of the elastix parameter files used for the registrations. Default is the parameters
                        is the provided ElastixParameterFiles. (Optional)
  --StructFile STRUCTFILE
                        Location of the structures contoured from the planning CT File. Default is None
  --KeepTempFiles       If true the temporary files and directories created will not be deleted. If False these files
                        will be deleted. (Optional)
 ```
 
 The different segmentation methods are:
 - Synthetic: A synthetic CT is created by deforming a planning CT to match the CBCT. CT cardiac segmentation is then applied to this image.
 - Transform: The Planning CT is first segmented. The planning CT and CBCT are deformably registered and the output transformation is used to map the planning CT segmentations to the CBCT.
 - Direct: The CT segmentation method is directly applied to the CBCT image. May perform unreliably, particularly for noisy CBCT images. 
 
 
## Directory Structure
CBCTCardiacSegmentation - Main code directory.
ElastixParameterFiles - Contains parameter files required for elastix.
docs - Files and info for the wiki. 
examples - Files and data for examples of how to run the code.
tests - Files for testing the code. 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "CBCTCardiacSegmentation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Mark Gardner",
    "author_email": "mark.gardner@sydney.edu.au",
    "download_url": "https://files.pythonhosted.org/packages/5d/63/977d6ebd652fd0074d954aaf7f6d49b4590b07a1a12986757b65095eb8d4/cbctcardiacsegmentation-0.1.0.tar.gz",
    "platform": null,
    "description": "# CBCTCardiacSegmentation\r\n\r\n[![test](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/actions/workflows/python-app.yml)\r\n[![codecov](https://codecov.io/github/Image-X-Institute/CBCTCardiacSegmentation/graph/badge.svg?token=YKpvfVsa5X)](https://codecov.io/github/Image-X-Institute/CBCTCardiacSegmentation)\r\n\r\n**Author:** *Mark Gardner*\r\n\r\n![CBCTExampleImage](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/blob/main/docs/_images/GTHeartSegs.png?raw=true)\r\n\r\nThis code will generate cardiac segmentations in CBCT images. The input is dicom or volume files of a CBCT image and an optional planning CT and will output dicom and nifti segmentations of cardiac segmentations that are compatible with the input CBCT image. **Currently this works in Linux only**\r\n\r\n\r\n## Setup/Build/Install\r\n\r\nThe module can installed using pip:\r\n\r\n```\r\npip install CBCTCardiacSegmentation\r\n```\r\n\r\nThis code uses the platipy repo (https://github.com/pyplati/platipy). If the platipy module is not automatically installed when installing the CTHeadDeformation code, the platipy library can be installed separately using the installation instructions (https://pyplati.github.io/platipy/getting_started.html). \r\n\r\nInstall elastix (https://elastix.lumc.nl/index.php)\r\n\r\n## Usage\r\n\r\nSample Data can be downloaded from the cancer imaging archive. For this example we will be using data from the 4d-lung dataset.  (https://www.cancerimagingarchive.net/collection/4d-lung/)\r\n\r\n### Download example data\r\n\r\nDownload the dicom data for one phase of the 4D-CBCT scan, and one phase of the 4D-CT. For example for patientID 100_HM10395, download the <P4^P100^S100^I0, Gated, 0.0%> CBCT dicom data from the Sep 14, 1997, and the <P4^P100^S300^I00003, Gated, 0.0%A> CT dicom data from the Jul 01, 2003.\r\n\r\nThe CBCT and CT directories can then be set to:\r\n\r\n```\r\nCBCTDicomDir = \"<Directory where data was downloaded to>/4D-Lung/100_HM10395/09-15-1997-NA-p4-69351/500.000000-P4P100S100I0 Gated 0.0-90726\"\r\nCTDicomDir = \"<Directory where data was downloaded to>/4D-Lung/100_HM10395/07-02-2003-NA-p4-14571/1.000000-P4P100S300I00003 Gated 0.0A-29193\"\r\n```\r\nThe directory where the created segmentations can also be set\r\n```\r\nOutputDir = \"<Directory where data was downloaded to>/4D-Lung/100_HM10395/CardiacSegmentations\r\n```\r\n\r\n### Run in python script\r\nSee [DemonstrateCBCTSegmentation.py](https://github.com/Image-X-Institute/CBCTCardiacSegmentation/blob/master/CBCTCardiacSegmentation/DemonstrateCBCTSegmentation.py) for an example python script. \r\n```\r\nfrom  CBCTCardiacSegmentation import CreateCBCTSegmentations\r\nCreateCBCTSegmentations(CBCTDicomDir,OutputDir=OutputDir,PlanningCTDir=CTDicomDir)\r\n```\r\n\r\n### Run in a command line\r\n\r\nIn a command line (such as anaconda command prompt) navigate to the directory that the CTHeadDeformation repo was cloned to and run \r\n```python CreateCBCTSegmentations.py <CBCTDicomDir> --OutputDir <OutputDir> --PlanningCTDir <CTDicomDir>``` \r\n\r\n### Function Options\r\n A summary of the input options are shown below\r\n ```\r\n  --CBCTDir CBCTDIR     Location of the Cone-beam CT that is to be segmented. Can be a Dicom Series or Volume file.\r\n  --OutputDir OUTPUTDIR\r\n                        Directory where the created segmentations will be created. Default is ./CBCTSegmentations. (Optional)\r\n  --SegmentationMethod SEGMENTATIONMETHOD\r\n                        The method used to segment the CBCT image {Synthetic|Transform|Direct}. Default is Synthetic. (Optional)\r\n  --PlanningCTDir PLANNINGCTDIR\r\n                        Location of the Planning CT that is to be segmented. Can be a Dicom Series or Volume file.\r\n                        Default is None. (Optional)\r\n  --ElastixParamDir ELASTIXPARAMDIR\r\n                        Location of the elastix parameter files used for the registrations. Default is the parameters\r\n                        is the provided ElastixParameterFiles. (Optional)\r\n  --StructFile STRUCTFILE\r\n                        Location of the structures contoured from the planning CT File. Default is None\r\n  --KeepTempFiles       If true the temporary files and directories created will not be deleted. If False these files\r\n                        will be deleted. (Optional)\r\n ```\r\n \r\n The different segmentation methods are:\r\n - Synthetic: A synthetic CT is created by deforming a planning CT to match the CBCT. CT cardiac segmentation is then applied to this image.\r\n - Transform: The Planning CT is first segmented. The planning CT and CBCT are deformably registered and the output transformation is used to map the planning CT segmentations to the CBCT.\r\n - Direct: The CT segmentation method is directly applied to the CBCT image. May perform unreliably, particularly for noisy CBCT images. \r\n \r\n \r\n## Directory Structure\r\nCBCTCardiacSegmentation - Main code directory.\r\nElastixParameterFiles - Contains parameter files required for elastix.\r\ndocs - Files and info for the wiki. \r\nexamples - Files and data for examples of how to run the code.\r\ntests - Files for testing the code. \r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Segment Cardiac structures in CBCT images",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/Image-X-Institute/CBCTCardiacSegmentation/issues",
        "Home Page": "https://github.com/Image-X-Institute/CBCTCardiacSegmentation"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a6d1d1adc13221b8b26f5f0d1f2b76b2b3e973bfb0c79043eefc6833c3920c5",
                "md5": "8ea86b28ec9a626acd868cb3b7f2440e",
                "sha256": "6e269f17c82a67b6e21cf3cc13d4a8c4c456a5bcce5d4687c26f6b94f47788de"
            },
            "downloads": -1,
            "filename": "CBCTCardiacSegmentation-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ea86b28ec9a626acd868cb3b7f2440e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 19956,
            "upload_time": "2024-08-19T00:29:56",
            "upload_time_iso_8601": "2024-08-19T00:29:56.099369Z",
            "url": "https://files.pythonhosted.org/packages/2a/6d/1d1adc13221b8b26f5f0d1f2b76b2b3e973bfb0c79043eefc6833c3920c5/CBCTCardiacSegmentation-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d63977d6ebd652fd0074d954aaf7f6d49b4590b07a1a12986757b65095eb8d4",
                "md5": "318b1337822f27c63114c32a61cf8c74",
                "sha256": "0838e3b3b4049d77846d64489aacfd46f834071ce908059fb791cb7c9875d458"
            },
            "downloads": -1,
            "filename": "cbctcardiacsegmentation-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "318b1337822f27c63114c32a61cf8c74",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 19446,
            "upload_time": "2024-08-19T00:29:57",
            "upload_time_iso_8601": "2024-08-19T00:29:57.429418Z",
            "url": "https://files.pythonhosted.org/packages/5d/63/977d6ebd652fd0074d954aaf7f6d49b4590b07a1a12986757b65095eb8d4/cbctcardiacsegmentation-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-19 00:29:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Image-X-Institute",
    "github_project": "CBCTCardiacSegmentation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "cbctcardiacsegmentation"
}
        
Elapsed time: 0.92895s