deid

When you add a new image format, it should go under “deid,” akin to “diom”.

deid
├── data
├── ,,,
└── dicom

This folder, and others like it, should contain should contain the following files:

Note that, since we are working in Python, we will be using dicom headers that are mapped from the standard to pydicom, the entire mapping which is provided here, and programatically accessible via:

from pydicom._dicom_dict import DicomDictionary

field_names = []

for key,entry in DicomDictionary.items():
   if entry[3] != "Retired":
       field_names.append(entry[4])

Since there are so many, we enforce (at least for dicom) the most conservative approach of removing header fields that the client has not asked anything special to be done for. Let’s now talk about the config.json.

Config.json

The base of the json has two classes, and they correspond with the actions of get and put, where a “get” is broadly the step of getting identifiers from the data, and the “put” is putting things back (and realistically, removing a lot). Here they are, completely empty:

{
 "get": {},
 "put": {}
}

The entire data structure isn’t very large, and can be shown to you:

{
   "get": { 

         
         "skip": ["PixelData"],
         "ids":{
            "entity":"PatientID",
            "item":"SOPInstanceUID"
         }

   },

   "put":{

          "actions":[
 
              {"action":"ADD","field":"PatientIdentityRemoved","value": "Yes"},

      ]
   }
}

Note that we don’t need to specify the datatypes like “PixelData” or “Columns”, or other fields related to the data. These fields are by default kept, as they are specific to the pixel data. For details see this issue.

Get

If you read the details about get (usage for the client) see get, you probably see some commonality. We have identified default fields in the header for entity and item under ['get']['ids'] (both which can be altered by the user via a function call) and then we skip over PixelData, because we don’t want to return that for inspection, or have it in the list to include. If there are others you don’t want returned, then add them to the skip list. Have caution that the user won’t see the field returned, and likely won’t ask for any action to be taken, meaning it will by default be blanked.

Put

Put is primarily concerned with actions, which as they are for the user, can be ADD, KEEP, REMOVE, or BLANK. For the default, we keep the useful pixel data, and specify that we have removed the patient identity.