dicognito


Namedicognito JSON
Version 0.17.0 PyPI version JSON
download
home_pagehttps://github.com/blairconrad/dicognito
SummaryA tool for anonymizing DICOM files
upload_time2023-11-15 11:17:44
maintainer
docs_urlNone
authorBlair Conrad
requires_python
licenseMIT
keywords anonymize deidentify dicom python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Dicognito logo](https://github.com/blairconrad/dicognito/raw/main/assets/dicognito_128.png "Dicognito logo")

Dicognito is a [Python](https://www.python.org/) module and command-line utility that anonymizes
[DICOM](https://www.dicomstandard.org/) files.

Use it to anonymize one or more DICOM files belonging to one or any number of patients. Objects will remain grouped
in their original patients, studies, and series.

Anonymization causes significant elements, such as identifiers, names, and
addresses, to be replaced by new values. Dates and times will be shifted into the
past, but their order will remain consistent within and across the files.

The package is [available on pypi](https://pypi.org/project/dicognito/) and can be installed from the command line by typing

```
pip install dicognito
```

## Anonymizing from the command line

Once installed, a `dicognito` command will be added to your Python scripts directory.
You can run it on entire filesystem trees or a collection of files specified by glob like so:

```bash
# Recurse down the filesystem, anonymizing all found DICOM files.
# Anonymized files will be placed in out-dir, named by new SOP
# instance UID.
dicognito --output-directory out-dir .

# Anonymize all files in the current directory with the dcm extension
# (-o is an alias for --output-directory).
dicognito -o out-dir *.dcm

# Anonymize all files in the current directory with the dcm extension
# but overwrite the original files.
# Note: repeatedly anonymizing the same files will cause date elements
# to  move farther into the past.
dicognito --in-place *.dcm
```
Get more help via `dicognito --help`.

## Anonymizing from within Python

To anonymize a bunch of DICOM objects from within a Python program, import the objects using
[pydicom](https://pydicom.github.io/) and use the `Anonymizer` class:

```python
import pydicom
import dicognito.anonymizer

anonymizer = dicognito.anonymizer.Anonymizer()

for original_filename in ("original1.dcm", "original2.dcm"):
    with pydicom.dcmread(original_filename) as dataset:
        anonymizer.anonymize(dataset)
        dataset.save_as("clean-" + original_filename)
```

Use a single `Anonymizer` on datasets that might be part of the same series, or the identifiers will not be
consistent across objects.

Additional (even custom) element handlers can be added to the `Anonymizer` via `add_element_handler` to augment
or override builtin behavior.

## Exactly what does dicognito do?
Using the default settings, dicognito will
* Add "DICOGNITO" to DeidentificationMethod
* Remove BranchOfService
* Remove MedicalRecordLocator
* Remove MilitaryRank
* Remove Occupation
* Remove PatientInsurancePlanCodeSequence
* Remove PatientReligiousPreference
* Remove PatientTelecomInformation
* Remove PatientTelephoneNumbers
* Remove ReferencedPatientPhotoSequence
* Remove ResponsibleOrganization
* Replace AccessionNumber with anonymized values
* Replace CountryOfResidence with anonymized values
* Replace CurrentPatientLocation with ""
* Replace FillerOrderNumberImagingServiceRequest with anonymized values
* Replace FillerOrderNumberImagingServiceRequestRetired with anonymized values
* Replace FillerOrderNumberProcedure with anonymized values
* Replace InstitutionAddress with anonymized values (only if replacing matching InstitutionName element)
* Replace InstitutionName with anonymized values
* Replace InstitutionalDepartmentName with "RADIOLOGY"
* Replace IssuerOfPatientID with "DICOGNITO"
* Replace OtherPatientIDs with anonymized values
* Replace PatientAddress with anonymized values
* Replace PatientID with anonymized values
* Replace PerformedProcedureStepID with anonymized values
* Replace PlacerOrderNumberImagingServiceRequest with anonymized values
* Replace PlacerOrderNumberImagingServiceRequestRetired with anonymized values
* Replace PlacerOrderNumberProcedure with anonymized values
* Replace RegionOfResidence with anonymized values
* Replace RequestedProcedureID with anonymized values
* Replace RequestingService with ""
* Replace ScheduledProcedureStepID with anonymized values
* Replace StationName with anonymized values
* Replace StudyID with anonymized values
* Replace all DA elements with anonymized values that precede the originals
* Replace all DT elements with anonymized values that precede the originals
* Replace all PN elements with anonymized values
* Replace all TM elements with anonymized values that precede the originals (only if replacing matching DA element)
* Replace all UI elements with anonymized values
* Replace private "MITRA LINKED ATTRIBUTES 1.0" element "Global Patient ID" with anonymized values
* Set PatientIdentityRemoved to "YES" if BurnedInAnnotation is "NO"
----
Logo: Remixed from [Radiology](https://thenounproject.com/search/?q=x-ray&i=1777366)
by [priyanka](https://thenounproject.com/creativepriyanka/) and [Incognito](https://thenounproject.com/search/?q=incognito&i=7572) by [d͡ʒɛrmi Good](https://thenounproject.com/geremygood/) from [the Noun Project](https://thenounproject.com/).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/blairconrad/dicognito",
    "name": "dicognito",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "anonymize deidentify dicom python",
    "author": "Blair Conrad",
    "author_email": "blair@blairconrad.com",
    "download_url": "https://files.pythonhosted.org/packages/17/be/1346f7651886170bc7000436b632471c943c8ade60923684b228e5d10ef6/dicognito-0.17.0.tar.gz",
    "platform": null,
    "description": "![Dicognito logo](https://github.com/blairconrad/dicognito/raw/main/assets/dicognito_128.png \"Dicognito logo\")\n\nDicognito is a [Python](https://www.python.org/) module and command-line utility that anonymizes\n[DICOM](https://www.dicomstandard.org/) files.\n\nUse it to anonymize one or more DICOM files belonging to one or any number of patients. Objects will remain grouped\nin their original patients, studies, and series.\n\nAnonymization causes significant elements, such as identifiers, names, and\naddresses, to be replaced by new values. Dates and times will be shifted into the\npast, but their order will remain consistent within and across the files.\n\nThe package is [available on pypi](https://pypi.org/project/dicognito/) and can be installed from the command line by typing\n\n```\npip install dicognito\n```\n\n## Anonymizing from the command line\n\nOnce installed, a `dicognito` command will be added to your Python scripts directory.\nYou can run it on entire filesystem trees or a collection of files specified by glob like so:\n\n```bash\n# Recurse down the filesystem, anonymizing all found DICOM files.\n# Anonymized files will be placed in out-dir, named by new SOP\n# instance UID.\ndicognito --output-directory out-dir .\n\n# Anonymize all files in the current directory with the dcm extension\n# (-o is an alias for --output-directory).\ndicognito -o out-dir *.dcm\n\n# Anonymize all files in the current directory with the dcm extension\n# but overwrite the original files.\n# Note: repeatedly anonymizing the same files will cause date elements\n# to  move farther into the past.\ndicognito --in-place *.dcm\n```\nGet more help via `dicognito --help`.\n\n## Anonymizing from within Python\n\nTo anonymize a bunch of DICOM objects from within a Python program, import the objects using\n[pydicom](https://pydicom.github.io/) and use the `Anonymizer` class:\n\n```python\nimport pydicom\nimport dicognito.anonymizer\n\nanonymizer = dicognito.anonymizer.Anonymizer()\n\nfor original_filename in (\"original1.dcm\", \"original2.dcm\"):\n    with pydicom.dcmread(original_filename) as dataset:\n        anonymizer.anonymize(dataset)\n        dataset.save_as(\"clean-\" + original_filename)\n```\n\nUse a single `Anonymizer` on datasets that might be part of the same series, or the identifiers will not be\nconsistent across objects.\n\nAdditional (even custom) element handlers can be added to the `Anonymizer` via `add_element_handler` to augment\nor override builtin behavior.\n\n## Exactly what does dicognito do?\nUsing the default settings, dicognito will\n* Add \"DICOGNITO\" to DeidentificationMethod\n* Remove BranchOfService\n* Remove MedicalRecordLocator\n* Remove MilitaryRank\n* Remove Occupation\n* Remove PatientInsurancePlanCodeSequence\n* Remove PatientReligiousPreference\n* Remove PatientTelecomInformation\n* Remove PatientTelephoneNumbers\n* Remove ReferencedPatientPhotoSequence\n* Remove ResponsibleOrganization\n* Replace AccessionNumber with anonymized values\n* Replace CountryOfResidence with anonymized values\n* Replace CurrentPatientLocation with \"\"\n* Replace FillerOrderNumberImagingServiceRequest with anonymized values\n* Replace FillerOrderNumberImagingServiceRequestRetired with anonymized values\n* Replace FillerOrderNumberProcedure with anonymized values\n* Replace InstitutionAddress with anonymized values (only if replacing matching InstitutionName element)\n* Replace InstitutionName with anonymized values\n* Replace InstitutionalDepartmentName with \"RADIOLOGY\"\n* Replace IssuerOfPatientID with \"DICOGNITO\"\n* Replace OtherPatientIDs with anonymized values\n* Replace PatientAddress with anonymized values\n* Replace PatientID with anonymized values\n* Replace PerformedProcedureStepID with anonymized values\n* Replace PlacerOrderNumberImagingServiceRequest with anonymized values\n* Replace PlacerOrderNumberImagingServiceRequestRetired with anonymized values\n* Replace PlacerOrderNumberProcedure with anonymized values\n* Replace RegionOfResidence with anonymized values\n* Replace RequestedProcedureID with anonymized values\n* Replace RequestingService with \"\"\n* Replace ScheduledProcedureStepID with anonymized values\n* Replace StationName with anonymized values\n* Replace StudyID with anonymized values\n* Replace all DA elements with anonymized values that precede the originals\n* Replace all DT elements with anonymized values that precede the originals\n* Replace all PN elements with anonymized values\n* Replace all TM elements with anonymized values that precede the originals (only if replacing matching DA element)\n* Replace all UI elements with anonymized values\n* Replace private \"MITRA LINKED ATTRIBUTES 1.0\" element \"Global Patient ID\" with anonymized values\n* Set PatientIdentityRemoved to \"YES\" if BurnedInAnnotation is \"NO\"\n----\nLogo: Remixed from [Radiology](https://thenounproject.com/search/?q=x-ray&i=1777366)\nby [priyanka](https://thenounproject.com/creativepriyanka/) and [Incognito](https://thenounproject.com/search/?q=incognito&i=7572) by [d\u0361\u0292\u025brmi Good](https://thenounproject.com/geremygood/) from [the Noun Project](https://thenounproject.com/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A tool for anonymizing DICOM files",
    "version": "0.17.0",
    "project_urls": {
        "Download": "https://github.com/blairconrad/dicognito/releases/0.17.0",
        "Homepage": "https://github.com/blairconrad/dicognito"
    },
    "split_keywords": [
        "anonymize",
        "deidentify",
        "dicom",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aad3696490216d9fdc549e9d96ed2e7ba3a759f1703e93eb5f905d40ee96e1df",
                "md5": "ac834d0cf7d44e63d1e4b86fc220f237",
                "sha256": "91058bd58ab92d2cdbfecec64a2aa7e84c62b42dabdc72962cf40e7b921d759d"
            },
            "downloads": -1,
            "filename": "dicognito-0.17.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac834d0cf7d44e63d1e4b86fc220f237",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 42032,
            "upload_time": "2023-11-15T11:17:42",
            "upload_time_iso_8601": "2023-11-15T11:17:42.256208Z",
            "url": "https://files.pythonhosted.org/packages/aa/d3/696490216d9fdc549e9d96ed2e7ba3a759f1703e93eb5f905d40ee96e1df/dicognito-0.17.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17be1346f7651886170bc7000436b632471c943c8ade60923684b228e5d10ef6",
                "md5": "62cb4ca02fe903c7bcf87334f7b782e2",
                "sha256": "96e700d69d4915251a297b72ab0f6fe414b42fc9b709f04b440847805ca502af"
            },
            "downloads": -1,
            "filename": "dicognito-0.17.0.tar.gz",
            "has_sig": false,
            "md5_digest": "62cb4ca02fe903c7bcf87334f7b782e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 46585,
            "upload_time": "2023-11-15T11:17:44",
            "upload_time_iso_8601": "2023-11-15T11:17:44.752701Z",
            "url": "https://files.pythonhosted.org/packages/17/be/1346f7651886170bc7000436b632471c943c8ade60923684b228e5d10ef6/dicognito-0.17.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-15 11:17:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "blairconrad",
    "github_project": "dicognito",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "dicognito"
}
        
Elapsed time: 0.14426s