dicompare


Namedicompare JSON
Version 0.1.10 PyPI version JSON
download
home_pagehttps://github.com/astewartau/dicompare
SummaryA tool for checking DICOM compliance against a reference model using Pydantic
upload_time2024-12-18 20:52:42
maintainerNone
docs_urlNone
authorAshley Stewart
requires_python>=3.10
licenseNone
keywords dicom compliance validation medical imaging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dicompare

[![](img/button.png)](https://astewartau.github.io/dicompare/)

dicompare is a DICOM validation tool designed to ensure compliance with study-specific imaging protocols and domain-specific guidelines while preserving data privacy. It provides multiple interfaces, including support for validation directly in the browser, leveraging WebAssembly (WASM), Pyodide, and the underlying pip package [`dicompare`](#dicompare). dicompare is suitable for multi-site studies and clinical environments without requiring software installation or external data uploads.

dicompare supports DICOM session validation against:

- **Session schemas**: JSON schema files that can be generated based on a reference session;
- **[TESTING] domain guidelines**: Flexible guidelines for specific domains (currently [QSM](https://doi.org/10.1002/mrm.30006));
- **[FUTURE] landmark studies**: Schema files based on landmark studies such as the [HCP](https://doi.org/10.1038/s41586-018-0579-z), [ABCD](https://doi.org/10.1016/j.dcn.2018.03.001), and [UK BioBank](https://doi.org/10.1038/s41586-018-0579-z) projects.

# Command-line interface (CLI) and application programming interface (API)

While you can run [dicompare](https://astewartau.github.io/dicompare/) in your browser now without any installation, you may also use the underlying `dicompare` pip package if you wish to use the command-line interface (CLI) or application programming interface (API).

```bash
pip install dicompare
```

## Command-line interface (CLI)

The package provides the following CLI entry points:

- `dcm-gen-session`: Generate JSON schemas for DICOM validation.
- `dcm-check-session`: Validate DICOM sessions against predefined schemas.

1. Generate a JSON Reference Schema

```bash
dcm-gen-session \
    --in_session_dir /path/to/dicom/session \
    --out_json_ref schema.json \
    --acquisition_fields ProtocolName SeriesDescription \
    --reference_fields EchoTime RepetitionTime
```

This will create a JSON schema describing the session based on the specified fields.

2. Validate a DICOM Session

```bash
dicompare-session \
    --in_session /path/to/dicom/session \
    --json_ref schema.json \
    --out_json compliance_report.json
```

The tool will output a compliance summary, indicating deviations from the reference schema.

## Python API

The `dicompare` package provides a Python API for programmatic schema generation and validation.

**Generate a schema:**

```python
from dicompare.io import read_dicom_session

reference_fields = ["EchoTime", "RepetitionTime"]
acquisition_fields = ["ProtocolName", "SeriesDescription"]

session_data = read_dicom_session(
    session_dir="/path/to/dicom/session",
    acquisition_fields=acquisition_fields,
    reference_fields=reference_fields
)

# Save the schema as JSON
import json
with open("schema.json", "w") as f:
    json.dump(session_data, f, indent=4)
```

**Validate a session:**

```python
from dicompare.io import read_json_session, read_dicom_session
from dicompare.compliance import check_session_compliance

# Load the schema
acquisition_fields, reference_fields, ref_session = read_json_session(json_ref="schema.json")

# Read the input session
in_session = read_dicom_session(
    session_dir="/path/to/dicom/session",
    acquisition_fields=acquisition_fields,
    reference_fields=reference_fields
)

# Perform compliance check
compliance_summary = check_session_compliance(
    in_session=in_session,
    ref_session=ref_session,
    series_map=None  # Optional: map series if needed
)

# Print compliance summary
for entry in compliance_summary:
    print(entry)
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/astewartau/dicompare",
    "name": "dicompare",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "DICOM compliance validation medical imaging",
    "author": "Ashley Stewart",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/5d/23/836fc1aa8f30033372282bc54c2255bbf2c004be263ca8c6f053e434fac5/dicompare-0.1.10.tar.gz",
    "platform": null,
    "description": "# dicompare\n\n[![](img/button.png)](https://astewartau.github.io/dicompare/)\n\ndicompare is a DICOM validation tool designed to ensure compliance with study-specific imaging protocols and domain-specific guidelines while preserving data privacy. It provides multiple interfaces, including support for validation directly in the browser, leveraging WebAssembly (WASM), Pyodide, and the underlying pip package [`dicompare`](#dicompare). dicompare is suitable for multi-site studies and clinical environments without requiring software installation or external data uploads.\n\ndicompare supports DICOM session validation against:\n\n- **Session schemas**: JSON schema files that can be generated based on a reference session;\n- **[TESTING] domain guidelines**: Flexible guidelines for specific domains (currently [QSM](https://doi.org/10.1002/mrm.30006));\n- **[FUTURE] landmark studies**: Schema files based on landmark studies such as the [HCP](https://doi.org/10.1038/s41586-018-0579-z), [ABCD](https://doi.org/10.1016/j.dcn.2018.03.001), and [UK BioBank](https://doi.org/10.1038/s41586-018-0579-z) projects.\n\n# Command-line interface (CLI) and application programming interface (API)\n\nWhile you can run [dicompare](https://astewartau.github.io/dicompare/) in your browser now without any installation, you may also use the underlying `dicompare` pip package if you wish to use the command-line interface (CLI) or application programming interface (API).\n\n```bash\npip install dicompare\n```\n\n## Command-line interface (CLI)\n\nThe package provides the following CLI entry points:\n\n- `dcm-gen-session`: Generate JSON schemas for DICOM validation.\n- `dcm-check-session`: Validate DICOM sessions against predefined schemas.\n\n1. Generate a JSON Reference Schema\n\n```bash\ndcm-gen-session \\\n    --in_session_dir /path/to/dicom/session \\\n    --out_json_ref schema.json \\\n    --acquisition_fields ProtocolName SeriesDescription \\\n    --reference_fields EchoTime RepetitionTime\n```\n\nThis will create a JSON schema describing the session based on the specified fields.\n\n2. Validate a DICOM Session\n\n```bash\ndicompare-session \\\n    --in_session /path/to/dicom/session \\\n    --json_ref schema.json \\\n    --out_json compliance_report.json\n```\n\nThe tool will output a compliance summary, indicating deviations from the reference schema.\n\n## Python API\n\nThe `dicompare` package provides a Python API for programmatic schema generation and validation.\n\n**Generate a schema:**\n\n```python\nfrom dicompare.io import read_dicom_session\n\nreference_fields = [\"EchoTime\", \"RepetitionTime\"]\nacquisition_fields = [\"ProtocolName\", \"SeriesDescription\"]\n\nsession_data = read_dicom_session(\n    session_dir=\"/path/to/dicom/session\",\n    acquisition_fields=acquisition_fields,\n    reference_fields=reference_fields\n)\n\n# Save the schema as JSON\nimport json\nwith open(\"schema.json\", \"w\") as f:\n    json.dump(session_data, f, indent=4)\n```\n\n**Validate a session:**\n\n```python\nfrom dicompare.io import read_json_session, read_dicom_session\nfrom dicompare.compliance import check_session_compliance\n\n# Load the schema\nacquisition_fields, reference_fields, ref_session = read_json_session(json_ref=\"schema.json\")\n\n# Read the input session\nin_session = read_dicom_session(\n    session_dir=\"/path/to/dicom/session\",\n    acquisition_fields=acquisition_fields,\n    reference_fields=reference_fields\n)\n\n# Perform compliance check\ncompliance_summary = check_session_compliance(\n    in_session=in_session,\n    ref_session=ref_session,\n    series_map=None  # Optional: map series if needed\n)\n\n# Print compliance summary\nfor entry in compliance_summary:\n    print(entry)\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool for checking DICOM compliance against a reference model using Pydantic",
    "version": "0.1.10",
    "project_urls": {
        "Homepage": "https://github.com/astewartau/dicompare"
    },
    "split_keywords": [
        "dicom",
        "compliance",
        "validation",
        "medical",
        "imaging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83e126aa8acba8cd4461bf849fe8c7fe01f4612aa1fea0f9ed05fb05ca0c613d",
                "md5": "8e8777312d011046091be7124aaaa47f",
                "sha256": "25d8360e50a79f76c04a69966fb5cbeb98f456a3a0e81ce5422739d426a5ee61"
            },
            "downloads": -1,
            "filename": "dicompare-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e8777312d011046091be7124aaaa47f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 29784,
            "upload_time": "2024-12-18T20:52:40",
            "upload_time_iso_8601": "2024-12-18T20:52:40.492899Z",
            "url": "https://files.pythonhosted.org/packages/83/e1/26aa8acba8cd4461bf849fe8c7fe01f4612aa1fea0f9ed05fb05ca0c613d/dicompare-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d23836fc1aa8f30033372282bc54c2255bbf2c004be263ca8c6f053e434fac5",
                "md5": "a1aff11cb5dbbd231bf0da6d5aad3305",
                "sha256": "651235abcfdce58c0c6ee6ccd54cea520fe59e11ac24340e9fc1d5c602d25ac3"
            },
            "downloads": -1,
            "filename": "dicompare-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "a1aff11cb5dbbd231bf0da6d5aad3305",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 26048,
            "upload_time": "2024-12-18T20:52:42",
            "upload_time_iso_8601": "2024-12-18T20:52:42.590672Z",
            "url": "https://files.pythonhosted.org/packages/5d/23/836fc1aa8f30033372282bc54c2255bbf2c004be263ca8c6f053e434fac5/dicompare-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 20:52:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "astewartau",
    "github_project": "dicompare",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dicompare"
}
        
Elapsed time: 0.77588s