dicom-csv


Namedicom-csv JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/neuro-ml/dicom-csv
SummaryUtils for gathering, aggregation and handling metadata from DICOM files.
upload_time2024-10-22 11:35:06
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2017-2023 NeuroML Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords dicom
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Utils for gathering, aggregation and handling metadata from DICOM files.

# Installation

From pip
```
pip install dicom-csv
```

or from GitHub

```bash
git clone https://github.com/neuro-ml/dicom-csv
cd dicom-csv
pip install -e .
```

# Example `join_tree`

```python
>>> from dicom_csv import join_tree
>>> folder = '/path/to/folder/'
>>> meta = join_tree(folder, verbose=2)
>>> meta.head(3)
```
| AccessionNumber | AcquisitionDate |  ...  | WindowCenter | WindowWidth |
| -------------: | -------------:   | :---: | --------:    | :---------: |
|000002621237 	 |20200922          |...    |-500.0        |1500.0       |
|000002621237 	 |20200922          |...    |-40.0         |400.0        |
|000002621237 	 |20200922          |...    |-500.0        |1500.0       |
3 rows x 155 columns


# Example load 3D image
from a series of dicom files (each containing 2D image)

```python
from dicom_csv import join_tree, order_series, stack_images
from pydicom import dcmread
from pathlib import Path

# 1. Collect metadata from all dicom files
folder = Path('/path/to/folder/')
meta = join_tree(folder, verbose=2)

# 2. Select series to load
uid = '...' # unique identifier of a series you want to load,
            # you could list them by `meta.SeriesInstanceUID.unique()`
series = meta.query("SeriesInstanceUID==@uid")

# 3. Read files & combine them into a single volume
images2d = [dcmread(folder / row[1].PathToFolder / row[1].FileName) for row in series.iterrows()] 
image3d = stack_images(order_series(images2d))
```

# Documentation

You can find the documentation [here](https://dicom-csv.readthedocs.io/en/latest/index.html).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/neuro-ml/dicom-csv",
    "name": "dicom-csv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "DICOM",
    "author": null,
    "author_email": "NeuroML Group <max@ira-labs.com>",
    "download_url": "https://files.pythonhosted.org/packages/c0/3e/118737aaeaaa2fef5be7d1e326bc5862cd988645b96477b254564b424c4c/dicom_csv-0.3.1.tar.gz",
    "platform": null,
    "description": "Utils for gathering, aggregation and handling metadata from DICOM files.\n\n# Installation\n\nFrom pip\n```\npip install dicom-csv\n```\n\nor from GitHub\n\n```bash\ngit clone https://github.com/neuro-ml/dicom-csv\ncd dicom-csv\npip install -e .\n```\n\n# Example `join_tree`\n\n```python\n>>> from dicom_csv import join_tree\n>>> folder = '/path/to/folder/'\n>>> meta = join_tree(folder, verbose=2)\n>>> meta.head(3)\n```\n| AccessionNumber | AcquisitionDate |  ...  | WindowCenter | WindowWidth |\n| -------------: | -------------:   | :---: | --------:    | :---------: |\n|000002621237 \t |20200922          |...    |-500.0        |1500.0       |\n|000002621237 \t |20200922          |...    |-40.0         |400.0        |\n|000002621237 \t |20200922          |...    |-500.0        |1500.0       |\n3 rows x 155 columns\n\n\n# Example load 3D image\nfrom a series of dicom files (each containing 2D image)\n\n```python\nfrom dicom_csv import join_tree, order_series, stack_images\nfrom pydicom import dcmread\nfrom pathlib import Path\n\n# 1. Collect metadata from all dicom files\nfolder = Path('/path/to/folder/')\nmeta = join_tree(folder, verbose=2)\n\n# 2. Select series to load\nuid = '...' # unique identifier of a series you want to load,\n            # you could list them by `meta.SeriesInstanceUID.unique()`\nseries = meta.query(\"SeriesInstanceUID==@uid\")\n\n# 3. Read files & combine them into a single volume\nimages2d = [dcmread(folder / row[1].PathToFolder / row[1].FileName) for row in series.iterrows()] \nimage3d = stack_images(order_series(images2d))\n```\n\n# Documentation\n\nYou can find the documentation [here](https://dicom-csv.readthedocs.io/en/latest/index.html).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2017-2023 NeuroML Group  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Utils for gathering, aggregation and handling metadata from DICOM files.",
    "version": "0.3.1",
    "project_urls": {
        "Docs": "https://dicom-csv.readthedocs.io/en/latest/index.html",
        "Download": "https://github.com/neuro-ml/dicom-csv/v0.3.1.tar.gz",
        "Homepage": "https://github.com/neuro-ml/dicom_csv",
        "Issues": "https://github.com/neuro-ml/dicom_csv/issues",
        "Source": "https://github.com/neuro-ml/dicom_csv"
    },
    "split_keywords": [
        "dicom"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c03e118737aaeaaa2fef5be7d1e326bc5862cd988645b96477b254564b424c4c",
                "md5": "9acce4c6c681004e508113ad73c4bbab",
                "sha256": "b9551e4423bb05d0e02be09ebd01fe8f0754b28258259343dd56024896a4004f"
            },
            "downloads": -1,
            "filename": "dicom_csv-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9acce4c6c681004e508113ad73c4bbab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 20289,
            "upload_time": "2024-10-22T11:35:06",
            "upload_time_iso_8601": "2024-10-22T11:35:06.434899Z",
            "url": "https://files.pythonhosted.org/packages/c0/3e/118737aaeaaa2fef5be7d1e326bc5862cd988645b96477b254564b424c4c/dicom_csv-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 11:35:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "neuro-ml",
    "github_project": "dicom-csv",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "dicom-csv"
}
        
Elapsed time: 1.71679s