DicomRTTool


NameDicomRTTool JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/brianmanderson/Dicom_RT_and_Images_to_Mask
SummaryTools for reading dicom files, RT structures, and dose files, as well as tools for converting numpy prediction masks back to an RT structure
upload_time2020-09-16 18:06:13
maintainer
docs_urlNone
authorBrian Mark Anderson
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # This code provides functionality for turning dicom images and RT structures into nifti files as well as turning prediction masks back into RT structures
# Installation guide
    pip install DicomRTTool
## Highly recommend to go through the jupyter notebook Data_Curation_and_Predictions_to_RT
## Data_Curation_and_Predictions_to_RT has three main parts
### 1) Identify RT structures and names in multiple patients
### 2) Creating associations file and turning dicom into nifti/numpy files
### 3) Turning predictions into RT structures
#### If you find this code useful, please provide a reference to my github page for others www.github.com/brianmanderson , thank you!
##### Please consider using the .write_parallel if you have many patients
##### Ring update allows for multiple rings to be represented correctly

![multiple_rings.png](./Images/multiple_rings.png)

Various utilities created to help with the interpretation of dicom images/RT Structures

RT Structure and dicom conversion to numpy arrays

This code is designed to receive an input path to a folder which contains both dicom images and a single RT structure file

For example, assume a folder exists with dicom files and an RT structure located at 'C:\users\brianmanderson\Patient_1\CT1\' with the roi 'Liver'

Assume there are 100 images, the generated data will be:
Dicom_Image.ArrayDicom is the image numpy array in the format [# images, rows, cols]

You can then call it to return a mask based on contour names called DicomImage.get_mask(), this takes in a list of Contour Names

You can see the available contour names with

Example:

    from DicomRTTool import DicomReaderWriter
    Dicom_reader = DicomReaderWriter(get_images_mask=False)
    path = 'C:\users\brianmanderson\Patients\'
    Dicom_reader.down_folder(path)
    # See all rois in the folders
    for roi in Dicom_reader.all_rois:
        print(roi)


    Contour_Names = ['Liver']
    associations = {'Liver_BMA_Program4':'Liver','Liver':'Liver'}
    path = 'C:\users\brianmanderson\Patients\Patient_1\CT_1\'
    Dicom_reader = DicomReaderWriter(get_images_mask=True, Contour_Names=Contour_Names, associations=associations)

    Dicom_reader.Make_Contour_From_directory(path)
    image = DicomImage.ArrayDicom
    mask = DicomImage.mask

    pred = np.zeros([mask.shape[0],mask.shape[1],mask.shape[2],2]) # prediction needs to be [# images, rows, cols, # classes]
    pred[:,200:300,200:300,1] = 1

    output_path= os.path.join('.','Output')
    Dicom_reader.with_annotations(pred,output_path,ROI_Names=['test'])

    '''
    Write the images and annotations as niftii files in parallel!
    '''
    Dicom_Reader.write_parallel(out_path=export_path,excel_file=os.path.join('.','MRN_Path_To_Iteration.xlsx'))




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/brianmanderson/Dicom_RT_and_Images_to_Mask",
    "name": "DicomRTTool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Brian Mark Anderson",
    "author_email": "bmanderson@mdanderson.org",
    "download_url": "https://files.pythonhosted.org/packages/5f/f3/e15c350c7530434511f4bdf0a4fe2fadb10af573ab94e4362d7903a27113/DicomRTTool-0.1.3.tar.gz",
    "platform": "",
    "description": "# This code provides functionality for turning dicom images and RT structures into nifti files as well as turning prediction masks back into RT structures\n# Installation guide\n    pip install DicomRTTool\n## Highly recommend to go through the jupyter notebook Data_Curation_and_Predictions_to_RT\n## Data_Curation_and_Predictions_to_RT has three main parts\n### 1) Identify RT structures and names in multiple patients\n### 2) Creating associations file and turning dicom into nifti/numpy files\n### 3) Turning predictions into RT structures\n#### If you find this code useful, please provide a reference to my github page for others www.github.com/brianmanderson , thank you!\n##### Please consider using the .write_parallel if you have many patients\n##### Ring update allows for multiple rings to be represented correctly\n\n![multiple_rings.png](./Images/multiple_rings.png)\n\nVarious utilities created to help with the interpretation of dicom images/RT Structures\n\nRT Structure and dicom conversion to numpy arrays\n\nThis code is designed to receive an input path to a folder which contains both dicom images and a single RT structure file\n\nFor example, assume a folder exists with dicom files and an RT structure located at 'C:\\users\\brianmanderson\\Patient_1\\CT1\\' with the roi 'Liver'\n\nAssume there are 100 images, the generated data will be:\nDicom_Image.ArrayDicom is the image numpy array in the format [# images, rows, cols]\n\nYou can then call it to return a mask based on contour names called DicomImage.get_mask(), this takes in a list of Contour Names\n\nYou can see the available contour names with\n\nExample:\n\n    from DicomRTTool import DicomReaderWriter\n    Dicom_reader = DicomReaderWriter(get_images_mask=False)\n    path = 'C:\\users\\brianmanderson\\Patients\\'\n    Dicom_reader.down_folder(path)\n    # See all rois in the folders\n    for roi in Dicom_reader.all_rois:\n        print(roi)\n\n\n    Contour_Names = ['Liver']\n    associations = {'Liver_BMA_Program4':'Liver','Liver':'Liver'}\n    path = 'C:\\users\\brianmanderson\\Patients\\Patient_1\\CT_1\\'\n    Dicom_reader = DicomReaderWriter(get_images_mask=True, Contour_Names=Contour_Names, associations=associations)\n\n    Dicom_reader.Make_Contour_From_directory(path)\n    image = DicomImage.ArrayDicom\n    mask = DicomImage.mask\n\n    pred = np.zeros([mask.shape[0],mask.shape[1],mask.shape[2],2]) # prediction needs to be [# images, rows, cols, # classes]\n    pred[:,200:300,200:300,1] = 1\n\n    output_path= os.path.join('.','Output')\n    Dicom_reader.with_annotations(pred,output_path,ROI_Names=['test'])\n\n    '''\n    Write the images and annotations as niftii files in parallel!\n    '''\n    Dicom_Reader.write_parallel(out_path=export_path,excel_file=os.path.join('.','MRN_Path_To_Iteration.xlsx'))\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Tools for reading dicom files, RT structures, and dose files, as well as tools for converting numpy prediction masks back to an RT structure",
    "version": "0.1.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9820f820554af88f4e7aad41cff5346c",
                "sha256": "4eca8e7a0c8bb77b72b9a2c4a059c118ff559d8355047b6bab5dd3526752b370"
            },
            "downloads": -1,
            "filename": "DicomRTTool-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9820f820554af88f4e7aad41cff5346c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 25133,
            "upload_time": "2020-09-16T18:06:12",
            "upload_time_iso_8601": "2020-09-16T18:06:12.450923Z",
            "url": "https://files.pythonhosted.org/packages/9a/f6/931fc1420cc6887ae1db9f2fbe0ed1d7e7a90f9d6b7b15cc70dcf450b74a/DicomRTTool-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "f03c615f230ab777b3bb6090f0fe2c8f",
                "sha256": "fd5689194c510417fd55698f21be827c13ae3d5fb69ebaaaf30bdcec62c94e74"
            },
            "downloads": -1,
            "filename": "DicomRTTool-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f03c615f230ab777b3bb6090f0fe2c8f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 616263,
            "upload_time": "2020-09-16T18:06:13",
            "upload_time_iso_8601": "2020-09-16T18:06:13.614786Z",
            "url": "https://files.pythonhosted.org/packages/5f/f3/e15c350c7530434511f4bdf0a4fe2fadb10af573ab94e4362d7903a27113/DicomRTTool-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-09-16 18:06:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "brianmanderson",
    "error": "Could not fetch GitHub repository",
    "lcname": "dicomrttool"
}
        
Elapsed time: 0.14995s