Skip to content

Commit 8d116ba

Browse files
authored
Merge pull request #100 from KitwareMedical/release_2_0
Release version 2.0.0 with Pydicom>3 and Python>=3.10
2 parents 099b9c9 + 6dcb17a commit 8d116ba

9 files changed

Lines changed: 751 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
# Tracked via issue #77
14-
# 3.6: Not available on ubuntu-22.04
15-
# 3.7: Results in failures in `test_cli.py`
16-
# 3.12: pkg_resources not supported
17-
python-version: ["3.8", "3.9", "3.10", "3.11"]
13+
python-version: ["3.10", "3.11", "3.12"]
1814

1915
steps:
2016
- uses: actions/checkout@v4

dicomanonymizer/dicom_anonymization_databases/dicomfields_2026c.py

Lines changed: 709 additions & 0 deletions
Large diffs are not rendered by default.

doc/Setup_build_test.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ The sources files can be packaged by using:
5252
`python ./setup.py bdist_wheel`
5353

5454
This command will generate a wheel package in `dist` folder which can be then installed as a python package using
55-
`pip install ./dist/dicom_anonymizer-1.0.13-1-py2.py3-none-any.whl`
55+
`pip install ./dist/dicom_anonymizer-2.0.0-py2.py3-none-any.whl`
5656

5757
On Windows, if you see a warning message
58-
`'./dist/dicom_anonymizer-1.0.13-1-py2.py3-none-any.whl' looks like a filename, but the file does not exist`,
58+
`'./dist/dicom_anonymizer-2.0.0-py2.py3-none-any.whl' looks like a filename, but the file does not exist`,
5959
this could be due to pip not being able to handle relative path (See issue https://github.com/pypa/pip/issues/10808). As a work-around, change directory to `dist` and then install it using
60-
`pip install dicom_anonymizer-1.0.13-1-py2.py3-none-any.whl`
60+
`pip install dicom_anonymizer-2.0.0-py2.py3-none-any.whl`
6161

6262

6363
Installing this package will also install an executable named `dicom-anonymizer`. In order to use it, please refer to the next section.

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This folder contains the following examples:
44
- `anonymize_dataset.py`: Anonymize dicom tags for a dataset
55
- `anonymize_extra_rules.py`: Anonymize dicom tags for a file with extra rules
6+
- `anonymize_with_different_standard.py`: Anonymize dicom file with a different NEMA standard
67

78
The supporting files are:
89
- `Pipfile`: The [pipenv](https://packaging.python.org/en/latest/tutorials/managing-dependencies/) file.

examples/anonymize_dataset.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
from dicomanonymizer import anonymize_dataset
2-
from pydicom.data import get_testdata_file
1+
import copy
2+
33
from pydicom import dcmread
4+
from pydicom.data import get_testdata_file
5+
6+
from dicomanonymizer import anonymize_dataset
47

58

69
def main():
710
original_ds = dcmread(get_testdata_file("CT_small.dcm"))
8-
data_ds = original_ds.copy()
11+
data_ds = copy.deepcopy(original_ds)
912
anonymize_dataset(
1013
data_ds, delete_private_tags=True
1114
) # Anonymization is done in-place

examples/anonymize_extra_rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22

3-
from dicomanonymizer.dicom_anonymization_databases.dicomfields_2023 import ALL_TAGS
43
from dicomanonymizer import anonymize, keep
4+
from dicomanonymizer.dicom_anonymization_databases.dicomfields_2023 import ALL_TAGS
55

66

77
def main():
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import copy
2+
3+
from pydicom import dcmread
4+
from pydicom.data import get_testdata_file
5+
6+
from dicomanonymizer import anonymize_dataset
7+
from dicomanonymizer.simpledicomanonymizer import initialize_actions
8+
9+
10+
def initialize_actions_2026c():
11+
return initialize_actions("dicomfields_2026c")
12+
13+
14+
def main():
15+
original_ds = dcmread(get_testdata_file("CT_small.dcm"))
16+
data_ds = copy.deepcopy(original_ds)
17+
anonymize_dataset(
18+
data_ds, delete_private_tags=True, base_rules_gen=initialize_actions_2026c
19+
) # Anonymization is done in-place
20+
print("Examples of original -> anonymized values:")
21+
for tt in ["PatientName", "PatientID", "StudyDate"]:
22+
print(f" {tt}: '{original_ds[tt].value}' -> '{data_ds[tt].value}'")
23+
24+
25+
if __name__ == "__main__":
26+
main()

scripts/scrap_DICOM_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def create_DICOM_fields(profiles):
115115

116116
def main(
117117
url="https://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_e.html",
118-
output_path="dicomanonymizer/dicomfields_2024b.py",
118+
output_path="dicomanonymizer/dicom_anonymization_databases/dicomfields_2024b.py",
119119
):
120120
# As of 2024.05.14, the current version of DICOM spec is 2024b.
121121
profiles = scrap_profiles(url)

setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="dicom_anonymizer", # Required
15-
version="1.0.13-1", # Required
15+
version="2.0.0", # Required
1616
author="Laurenn Lam",
1717
author_email="laurenn.lam@kitware.com",
1818
description="Program to anonymize dicom files with default and custom rules",
@@ -31,7 +31,7 @@
3131
"Programming Language :: Python",
3232
],
3333
keywords=["dicom", "anonymizer", "medical"],
34-
python_requires=">=3.6",
34+
python_requires=">=3.10",
3535
packages=find_packages(), # Required
3636
# Define an executable calls dicom-anonymizer from a specific file
3737
entry_points={
@@ -44,7 +44,5 @@
4444
# For an analysis of "install_requires" vs pip's requirements files see:
4545
# https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/
4646
install_requires=["pydicom", "tqdm"], # Optional
47-
extras_require={
48-
"dev": ["pytest", "bs4", "fire", "requests", "pre-commit", "ruff===0.12.10"]
49-
},
47+
extras_require={"dev": ["pytest", "bs4", "fire", "requests", "pre-commit", "ruff"]},
5048
)

0 commit comments

Comments
 (0)