Skip to content

Commit 609de14

Browse files
authored
Merge pull request #44 from pchoisel/improve_usage_instructions
DOC: Improve usage instrucion
2 parents 8432e23 + 3cd5853 commit 609de14

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ __pycache__
55
build
66
*.egg-info
77
.python-version
8-
# Ignore Pipfile.lock, since different versions of python and OS produce different hashes
9-
Pipfile.lock
8+
dist

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
Python package to anonymize DICOM files.
44
The anonymization answer to the standard . More information about dicom fields for anonymization can be found [here](https://dicom.nema.org/medical/dicom/current/output/html/part15.html#table_E.1-1).
55

6-
The default behaviour of this package is to anonymize DICOM fields referenced in [dicomfields](dicomanonymizer/dicomfields.py).
6+
The default behaviour of this package is to anonymize DICOM fields referenced in the 2023e DICOM standard. These fields are referenced in [dicomfields](dicomanonymizer/dicom_anonymization_databases/dicomfields_2023.py).
7+
Another standard can be selected, see *Change the DICOM anonymization standard*.
78

89
Dicom fields are separated into different groups. Each groups will be anonymized in a different way.
910

@@ -142,6 +143,16 @@ Example 3: Change the tag value with an arbitrary value
142143
python anonymizer.py InputFilePath OutputFilePath -t '(0x0010, 0x0010)' 'replace_with_value' 'new_value'
143144
```
144145

146+
### DICOMDIR
147+
148+
> DICOMDIR anonymization is not specified. It is therefore discouraged and it is recommended to regenerate new DICOMDIR files after anonymizing the original DICOM files.
149+
150+
DICOMDIR files can have a `(0x0004, 0x1220) Directory Record Sequence` tag that can contain patient information.
151+
However, this tag is not part of the standard tag to anonymize set. If you still want dicom-anonymizer to anonymize it, you have to instruct it explicitly:
152+
153+
```python
154+
python anonymizer.py InputFilePath OutputFilePath -t '(0x0004, 0x1220)' replace
155+
```
145156

146157
## Custom rules with dictionary file
147158

@@ -194,6 +205,8 @@ def main():
194205
)
195206
args = parser.parse_args()
196207
208+
deletePrivateTags = False
209+
197210
input_dicom_path = args.input
198211
output_dicom_path = args.output
199212
@@ -305,3 +318,17 @@ You can also add `extra_anonymization_rules` as above:
305318
** VR: Value Representation
306319
307320
Work originally done by Edern Haumont
321+
322+
# Change the DICOM anonymization standard
323+
324+
You can customize the DICOM standard that will be used to anonymize the dataset by giving an argument `base_rules_gen` to the function `anonymize_dicom_file` or `anonymize_dataset`.
325+
The value should be a function returning a dict of anonymization rules. Use the function `initialize_actions` to create such dict from a anonymization database from the folder `dicomanonymizer/dicom_anonymization_databases`.
326+
327+
Example:
328+
```python
329+
from dicomanonymizer.simpledicomanonymizer import anonymize_dataset, initialize_actions
330+
331+
anonymize_dataset(
332+
dataset, base_rules_gen=lambda: initialize_actions("dicomfields_2024b")
333+
)
334+
```

dicomanonymizer/dicom_anonymization_databases/dicomfields_2023.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tags anonymized in DICOM standard
22
# Documentation for groups meaning can be found in default associated actions.
3-
# http://dicom.nema.org/dicom/2023/output/chtml/part15/chapter_E.html#table_E.1-1
3+
# https://dicom.nema.org/medical/dicom/2023e/output/chtml/part15/chapter_E.html#table_E.1-1
44

55
# Replaced tags
66
D_TAGS = [

dicomanonymizer/dicom_anonymization_databases/dicomfields_2024b.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tags anonymized in DICOM standard
22
# Documentation for groups meaning can be found in default associated actions.
3-
# https://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_e.html
3+
# https://dicom.nema.org/medical/dicom/2024b/output/chtml/part15/chapter_E.html#table_E.1-1
44

55
# Replaced tags
66
D_TAGS = [

0 commit comments

Comments
 (0)