Skip to main content

Collection of tools to check uploaded scans and records for identifiable data.

Project description

PHI-finder

CI/CD Codecov

Local testing (docker required)

conda create -n phi-finder python==3.11
conda activate phi-finder
pip install -e .[dev,test] --no-cache-dir
pytest .

Building

python -m pip install --upgrade build

python -m build

pip install dist/phi_finder-0.1.13-py3-none-any.whl

Basic usage (headers only)

import pydicom as dicom
from phi_finder.dicom_tools import anonymise_dicom

path = "/path/to/some/dicom.dcm"
dcm = dicom.dcmread(path)
anonymised_dcm = anonymise_dicom.anonymise_image(dcm)
anonymised_dcm.save_as('/path/to/some/dicom_anon.dcm')

More advanced usage

import pydicom as dicom
from presidio_image_redactor import (
    DicomImageRedactorEngine, ImageAnalyzerEngine, ContrastSegmentedImageEnhancer)
from phi_finder.dicom_tools import anonymise_dicom

path = "/path/to/some/dicom.dcm"
dcm = dicom.dcmread(path)
score_threshold=.15
analyser = anonymise_dicom._build_presidio_analyser(score_threshold, "en_core_web_lg")
image_redactor = DicomImageRedactorEngine(
    image_analyzer_engine=ImageAnalyzerEngine(
        analyzer_engine=analyser, 
        image_preprocessor=ContrastSegmentedImageEnhancer(),
        ))
anonymised_dcm = anonymise_dicom.anonymise_image(dcm,score_threshold=score_threshold,
                                                 analyser=analyser,
                                                 image_redactor=image_redactor,
                                                 )
anonymised_dcm.save_as('/path/to/some/dicom_anon.dcm')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phi_finder-0.1.13.tar.gz (53.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phi_finder-0.1.13-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file phi_finder-0.1.13.tar.gz.

File metadata

  • Download URL: phi_finder-0.1.13.tar.gz
  • Upload date:
  • Size: 53.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for phi_finder-0.1.13.tar.gz
Algorithm Hash digest
SHA256 356b72ff5281ef3db0df916a26af7a32fb5a27d9418b9f3df2f2b0880f1df1be
MD5 00e04fc18214ec980508ed2289433e58
BLAKE2b-256 5aea63b940549c920f64ecfcf52989b26540ee384311b971051a8000ec449e83

See more details on using hashes here.

File details

Details for the file phi_finder-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: phi_finder-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for phi_finder-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 4eec3c87be17f02214449d72324dea66f3f904428e9f5dba8f617b10f2bb34a9
MD5 3ff86b4eb4543f3556d447ec6e307f4b
BLAKE2b-256 158318f08b7d7b762f6b6c8fe5acda39e35f9fe20bebc7fed656a3cfe1a57831

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page