Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Add metadata fields for DeIdentificationMethod/CodeSequence for MRI and PET #1772

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/modality-specific-files/magnetic-resonance-imaging-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,32 @@ recommended metadata fields, and the application specific entity or
metadata requirement levels of [file collections](../appendices/file-collections.md) that can generate
them, visit the [qMRI appendix](../appendices/qmri.md).

### Deidentification information

Describes the mechanism or method used to modify or remove metadata
and/or pixel data to protect the patient or participant's identity.

<!-- This block generates a metadata table.
These tables are defined in
src/schema/rules/sidecars
The definitions of the fields specified in these tables may be found in
src/schema/objects/metadata.yaml
A guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
{{ MACROS___make_sidecar_table("mri.DeidentificationMethod") }}

Each object in the `DeidentificationMethodCodeSequence` array includes the following RECOMMENDED keys:

<!-- This block generates a table describing subfields within a metadata field.
The definitions of these fields can be found in
src/schema/objects/metadata.yaml
and a guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
{{ MACROS___make_subobject_table("metadata.DeidentificationMethodCodeSequence.items") }}


CGSchwarzMayo marked this conversation as resolved.
Show resolved Hide resolved
### Defacing masks

If the structural images included in the dataset were defaced (to protect
Expand Down
47 changes: 47 additions & 0 deletions src/modality-specific-files/positron-emission-tomography.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,50 @@ time plasma_radioactivity whole_blood_radioactivity metabolite_parent_fraction m
5407 22.70 19.49 0.032 0.523
7193 19.71 15.70 0.02 0.559
```

### Deidentification information

Describes the mechanism or method used to modify or remove metadata
and/or pixel data to protect the patient or participant's identity.

<!-- This block generates a metadata table.
These tables are defined in
src/schema/rules/sidecars
The definitions of the fields specified in these tables may be found in
src/schema/objects/metadata.yaml
A guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
{{ MACROS___make_sidecar_table("mri.DeidentificationMethod") }}

Each object in the `DeidentificationMethodCodeSequence` array includes the following RECOMMENDED keys:

<!-- This block generates a table describing subfields within a metadata field.
The definitions of these fields can be found in
src/schema/objects/metadata.yaml
and a guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
{{ MACROS___make_subobject_table("metadata.DeidentificationMethodCodeSequence.items") }}
CGSchwarzMayo marked this conversation as resolved.
Show resolved Hide resolved


### Defacing masks

If the structural images included in the dataset were defaced (to protect
identity of participants) one MAY provide the binary mask that was used to
remove facial features in the form of `_defacemask` files.
In such cases, the OPTIONAL [`mod-<label>`](../appendices/entities.md#mod)
entity corresponds to modality suffix,
such as `T1w` or `inplaneT1`, referenced by the defacemask image.
For example, `sub-01_mod-T1w_defacemask.nii.gz`.

<!--
This block generates a filename templates.
The inputs for this macro can be found in the directory
src/schema/rules/files/raw
and a guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
{{ MACROS___make_filename_template("raw", datatypes=["anat"], suffixes=[
"defacemask",
])
effigies marked this conversation as resolved.
Show resolved Hide resolved
47 changes: 47 additions & 0 deletions src/schema/objects/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,53 @@ DecayCorrectionFactor:
type: array
items:
type: number
DeidentificationMethod:
name: DeidentificationMethod
display_name: Deidentification Method
description: |
A description of the mechanism or method used to remove the Patient's identity.
Corresponds to DICOM Tag 0012, 0063 `De-identification Method`.
type: string
DeidentificationMethodCodeSequence:
name: DeidentificationMethodCodeSequence
display_name: Deidentification Method Code Sequence
description: |
A sequence of code objects describing the mechanism or method use to remove the Patient's identity.
Corresponds to DICOM Tag 0012, 0064 `De-identification Method Code Sequence`.
type: array
items:
type: object
recommended_fields:
- CodeValue
- CodeMeaning
- CodingSchemeDesignator
- CodingSchemeVersion
properties:
CodeValue:
name: CodeValue
type: string
description: |
An identifier that is unambiguous within the Coding Scheme
denoted by Coding Scheme Designator and Coding Scheme Version.
Corresponds to DICOM Tag 0008, 0100 `Code Value`.
CodeMeaning:
name: CodeMeaning
type: string
description: |
Text that has meaning to a human and conveys the meaning of the term
Corresponds to DICOM Tag 0008, 0104 `Code Meaning`.
CodingSchemeDesignator:
name: CodingSchemeDesignator
type: string
description: |
The identifier of the coding scheme in which the coded entry is defined.
Corresponds to DICOM Tag 0008, 0102 `Coding Scheme Designator`.
CodingSchemeVersion:
name: CodingSchemeVersion
type: string
description: |
An identifier of the version of the coding scheme if necessary to resolve ambiguity.
Corresponds to DICOM Tag 0008, 0103 `Coding Scheme Version`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is complicated enough warranting addition to https://github.com/bids-standard/bids-examples if not as an example here in the BIDS spec text. Do we have some nice example DICOMs to check those fields out?

Copy link
Author

Choose a reason for hiding this comment

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

I think if someone were creating these tags from scratch at the BIDS level, they would use DeidentificationMethod rather than DeidentificationMethodCodeSequence. The latter is more provided to allow direct translation by dcm->nii and dcm->bids software.

I'm attaching some nice example DICOM, as requested. This is MRI of a spaghetti squash (thanks @captainnova), and I've further de-identified it, so there's no PHI. I included the tags as if I had de-faced it, but it is a squash, so there was no face to de-face.

dcm_fruit_deidentified.zip

The relevant dcm tags look like this:

(0012, 0063) De-identification Method            LO: ['mri_reface 0.3.4', 'Per DICOM PS 3.15 AnnexE. Details in 0012,0064']
(0012, 0064)  De-identification Method Code Sequence   5 item(s) ---- 
   (0008, 0100) Code Value                          SH: '113102'
   (0008, 0102) Coding Scheme Designator            SH: 'DCM'
   (0008, 0103) Coding Scheme Version               SH: '01'
   (0008, 0104) Code Meaning                        LO: 'Clean Recognizable Visual Features Option'
   ---------
   (0008, 0100) Code Value                          SH: 'replace_recognizable'
   (0008, 0102) Coding Scheme Designator            SH: 'mri_reface'
   (0008, 0103) Coding Scheme Version               SH: '0.3.4'
   (0008, 0104) Code Meaning                        LO: 'Replace face, ears, and artifacts in air'
   ---------
   (0008, 0100) Code Value                          SH: '113100'
   (0008, 0102) Coding Scheme Designator            SH: 'DCM'
   (0008, 0104) Code Meaning                        LO: 'Basic Application Confidentiality Profile'
   ---------
   (0008, 0100) Code Value                          SH: '113107'
   (0008, 0102) Coding Scheme Designator            SH: 'DCM'
   (0008, 0104) Code Meaning                        LO: 'Retain Longitudinal Temporal Information Modified Dates Option'
   ---------
   (0008, 0100) Code Value                          SH: '113111'
   (0008, 0102) Coding Scheme Designator            SH: 'DCM'
   (0008, 0104) Code Meaning                        LO: 'Retain Safe Private Option'
   ---------

With rordenlab/dcm2niix#813, the relevant portion of json output is:

        "DeidentificationMethod": "mri_reface 0.3.4\\Per DICOM PS 3.15 AnnexE. Details in 0012,0064",
        "DeidentificationMethodCodeSequence": [ 
          { 
                "CodeValue": "113102",
                "CodingSchemeDesignator": "DCM",
                "CodingSchemeVersion": "01",
                "CodeMeaning": "Clean Recognizable Visual Features Option"
          },
          { 
                "CodeValue": "replace_recognizable",
                "CodingSchemeDesignator": "mri_reface",
                "CodingSchemeVersion": "0.3.4",
                "CodeMeaning": "Replace face, ears, and artifacts in air"
          },
          { 
                "CodeValue": "113100",
                "CodingSchemeDesignator": "DCM",
                "CodeMeaning": "Basic Application Confidentiality Profile"
          },
          { 
                "CodeValue": "113107",
                "CodingSchemeDesignator": "DCM",
                "CodeMeaning": "Retain Longitudinal Temporal Information Modified Dates Option"
          },
          { 
                "CodeValue": "113111",
                "CodingSchemeDesignator": "DCM",
                "CodeMeaning": "Retain Safe Private Option"
          }
        ],

DelayAfterTrigger:
name: DelayAfterTrigger
display_name: Delay After Trigger
Expand Down
11 changes: 11 additions & 0 deletions src/schema/rules/sidecars/mri.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,14 @@ MRIInstitutionInformation:
InstitutionalDepartmentName:
level: recommended
description_addendum: Corresponds to DICOM Tag 0008, 1040 `Institutional Department Name`.

DeidentificationMethod:
selectors:
- intersects([modality], ["mri", "pet"])
fields:
DeidentificationMethod:
level: optional
description_addendum: Corresponds to DICOM Tag 0012, 0063 `De-identification Method`.
DeidentificationMethodCodeSequence:
level: optional
description_addendum: Corresponds to DICOM Tag 0012, 0064 `De-identification Method Code Sequence`.
11 changes: 11 additions & 0 deletions src/schema/rules/sidecars/pet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,14 @@ PETTask:
TaskDescription: recommended
CogAtlasID: recommended
CogPOID: recommended

DeidentificationMethod:
selectors:
- intersects([modality], ["mri", "pet"])
fields:
DeidentificationMethod:
level: optional
description_addendum: Corresponds to DICOM Tag 0012, 0063 `De-identification Method`.
DeidentificationMethodCodeSequence:
level: optional
description_addendum: Corresponds to DICOM Tag 0012, 0064 `De-identification Method Code Sequence`.
CGSchwarzMayo marked this conversation as resolved.
Show resolved Hide resolved