Once you write a script to anonymize fields within a single scan, you can apply that anonymization to any number of other scans that came from the same scanner. Here is how to do that.
Add the steps involved:
Write a remapping config file. This is an XML file that describes the spreadsheet that will be built from the data. The root element is
<Columns>; each subelement describes either one or two columns in the spreadsheet:
where tag is the 32-bit DICOM tag for the attribute to be displayed, expressed as two 16-bit numbers separated by a comma and surrounded by parentheses, e.g., (0008,0080) for Institution Name; and LEVEL is one of
Global, Patient, Study, or Series, describing the highest domain over which the attribute will have a single value: Patient ID, for example, should be at the Patient level.
The LEVEL element shown above adds one column to the spreadsheet, with column title equal to the name of the specified DICOM attribute, and each entry in the column the original value of that attribute in the DICOM files.
To allow an attribute value to be changed, add the
<LEVEL remap="Remap Column Name">tag</LEVEL>
This element will add two columns to the spreadsheet: one showing the original data values, as described above, and a new column with the given column name, in which replacement values can be specified. The new values column will appear immediately to the right of the original values column, unless the optional attribute append="true" is used, in which case the new values column will be placed at the far right, after all the original values columns.
<Columns> <Global remap="Fixed Institution Name">(0008,0080)</Global> <Patient remap="Anon Patient Name">(0010,0010)</Patient> <Patient remap="Anon PatientID">(0010,0020)</Patient> <Study>(0020,0010)</Study> <Study>(0008,0020)</Study> <Series>(0020,0011)</Series> <Series>(0008,0031)</Series> </Columns>
Generate a spreadsheet from the data.
DicomSummarize -c remap-config-file.xml -v remap.csv [directory-1 ...]
where the arguments in brackets are a list of directories containing the source DICOM data. Remember this list of directories, because you’ll use it again in step 5.
(This is a little complicated, but the remapper does some consistency checking. If you don’t fill in a required cell, the remapper will complain. If you give, for example, a Patient-level remap column multiple values for a single patient, the remapper will complain.)
Run the remapper.
DicomRemap -c remap-config-file.xml -o <path-to-output-directory> -v remap.csv [directory-1 ...]
where the remap config XML should be the same file you used in step 3, remap.csv is the spreadsheet generated in step 3 that you edited in step 4, and the list of directories is the same list of source directories from step 3.
If you’re anonymizing many files, go get a cup of coffee, because it will take a while. If all goes well, the program will finish quietly, and the output directory will be full of anonymized files. If all doesn’t go well, the program will print some error messages providing clues as to what went wrong.
You can add an anonymization script to be applied at this stage by using the
|DicomRemap and DicomSummarize can each be run with the |
<iframe src="https://player.vimeo.com/video/46706068" width="640" height="480" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>