Skip to content

Commit

Permalink
Merge pull request #44 from pchoisel/improve_usage_instructions
Browse files Browse the repository at this point in the history
DOC: Improve usage instrucion
  • Loading branch information
pchoisel authored Aug 5, 2024
2 parents 8432e23 + 3cd5853 commit 609de14
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ __pycache__
build
*.egg-info
.python-version
# Ignore Pipfile.lock, since different versions of python and OS produce different hashes
Pipfile.lock
dist
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Python package to anonymize DICOM files.
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).

The default behaviour of this package is to anonymize DICOM fields referenced in [dicomfields](dicomanonymizer/dicomfields.py).
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).
Another standard can be selected, see *Change the DICOM anonymization standard*.

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

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

### DICOMDIR

> DICOMDIR anonymization is not specified. It is therefore discouraged and it is recommended to regenerate new DICOMDIR files after anonymizing the original DICOM files.

DICOMDIR files can have a `(0x0004, 0x1220) Directory Record Sequence` tag that can contain patient information.
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:

```python
python anonymizer.py InputFilePath OutputFilePath -t '(0x0004, 0x1220)' replace
```

## Custom rules with dictionary file

Expand Down Expand Up @@ -194,6 +205,8 @@ def main():
)
args = parser.parse_args()
deletePrivateTags = False
input_dicom_path = args.input
output_dicom_path = args.output
Expand Down Expand Up @@ -305,3 +318,17 @@ You can also add `extra_anonymization_rules` as above:
** VR: Value Representation
Work originally done by Edern Haumont
# Change the DICOM anonymization standard
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`.
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`.
Example:
```python
from dicomanonymizer.simpledicomanonymizer import anonymize_dataset, initialize_actions
anonymize_dataset(
dataset, base_rules_gen=lambda: initialize_actions("dicomfields_2024b")
)
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tags anonymized in DICOM standard
# Documentation for groups meaning can be found in default associated actions.
# http://dicom.nema.org/dicom/2023/output/chtml/part15/chapter_E.html#table_E.1-1
# https://dicom.nema.org/medical/dicom/2023e/output/chtml/part15/chapter_E.html#table_E.1-1

# Replaced tags
D_TAGS = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tags anonymized in DICOM standard
# Documentation for groups meaning can be found in default associated actions.
# https://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_e.html
# https://dicom.nema.org/medical/dicom/2024b/output/chtml/part15/chapter_E.html#table_E.1-1

# Replaced tags
D_TAGS = [
Expand Down

1 comment on commit 609de14

@smasuda
Copy link
Contributor

@smasuda smasuda commented on 609de14 Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks for adding the doc @pchoisel

Please sign in to comment.