The DicomAnonymizerTool

From MircWiki
Jump to: navigation, search

The DicomAnonymizerTool is a command-line program that processes a single file or a tree of directories using pipeline stages like those in CTP. It contains a DicomFilter, a DicomPixeAnonymizer, and a DicomAnonymizer. Each of the stages can be enabled, disabled, or configured through command-line parameters.

The installer for the program can be obtained at http://mirc.rsna.org/download/DicomAnonymizerTool.jar.

To install the program, run the installer and select a directory. The installer will create a subdirectory called DicomAnonymizerTool in the selected directory and place all the necessary files in it.

The program runs on Java 7 or better, including Java 9 and 10.

To run the program, open a command window in the program's directory and run the program from the command line.

If the program is run with no command-line parameters, it will list help information and information about the configuration of the platform on which it is running:

D:\JavaPrograms\DicomAnonymizerTool>java -jar DAT.jar
Usage: java -jar DAT.jar {parameters}
where:
  -in {input} specifies the file or directory to be anonymized
       If {input} is a directory, all files in it and its subdirectories are processed.
  -out {output} specifies the file or directory in which to store the anonymized file or files.
       If -out is missing and -in specifies a file, the anonymized file is named {input}-an.
       If -out is missing and -in specifies a directory, an output directory named {input}-an is created.
       If {output} is missing and -in specifies a file, the anonymized file overwrites {input}
       If {output} is present and -in specifies a file, the anonymized file is named {output}
       If {output} is present and -in specifies a directory, an output directory named {output} is created.
  -f {scriptfile} specifies the filter script.
       If -f is missing, all files are accepted.
       If {scriptfile} is missing, the default script is used.
  -da {scriptfile} specifies the anonymizer script.
       If -da is missing, element anonymization is not performed.
       If {scriptfile} is missing, the default script is used.
  -p{param} "{value}" specifies a value for the specified parameter.
       {value} must be encapsulated in quotes.
  -e{element} "{script}" specifies a script for the specified element.
       {element} may be specified as a DICOM keyword, e.g. -ePatientName.
       {element} may be specified as (group,element), e.g. -e(0010,0010).
       {element} may be specified as [group,element], e.g. -e[0010,0010].
       {element} may be specified as groupelement, e.g. -e00100010.
       {script} must be encapsulated in quotes.
  -lut {lookuptablefile} specifies the anonymizer lookup table properties file.
       If -lut is missing, the default lookup table is used.
  -dpa {pixelscriptfile} specifies the pixel anonymizer script file.
       If -dpa is missing, pixel anonymization is not performed.
       If {pixelscriptfile} is missing, the default pixel script is used.
  -dec specifies that the image is to be decompressed if the pixel anonymizer requires it.
  -rec specifies that the image is to be recompressed after pixel anonymization if it was decompressed.
  -test specifies that the pixel anonymizer is to blank regions in mid-gray.
  -check {frame} specifies that the anonymized image is to be tested to ensure that the images load.
       If -check is missing, no frame checking is done.
       If {frame} is missing, only the last frame is checked.
       If {frame} is specified as first, only the first frame is checked.
       If {frame} is specified as last, only the last frame is checked.
       If {frame} is specified as all, all frames are checked.
  -n {threads} specifies the number of parallel threads used for processing.
  -v specifies verbose output

Configuration:
os.name:               Windows 10
java.version:          10.0.1
sun.arch.data.model:   64
java.home:             C:\Program Files\Java\jre-10.0.1
clib:                  D:\JavaPrograms\DicomAnonymizerTool\clibwrapper_jiio-1.2-pre-dr-b04.jar
jai:                   D:\JavaPrograms\DicomAnonymizerTool\jai_imageio-1.2-pre-dr-b04.jar
jiio:                  null
jiio sse2:             null
jiio util:             null
ImageIO Tools version: 1.2-pre-dr-b04

This Java does not have the ImageIOTools native code extensions installed.

Available codecs:
R/W BMP
R/W DICOM
R/W GIF
R/W JPEG
R/W JPEG2000
R/W JPG
R/W PCX
R/W PNG
R/W PNM
R/W RAW
R   RLE
R/W TIFF
R/W WBMP

All the default script files are contained in the same directory as the DAT.jar file. The defaults can be edited with any text editor, but changes will be overwritten during an upgrade. If specialized scripts are required, it is best to create new files for them and specify the script files in the appropriate program parameters.

In special situations where one or more AnonymizerExtensions are required, a config.xml file must be put in the directory to specify the plugins. An example file might be:

<Configuration>
    <Plugin
        baseDate="20000101"
        class="edu.emory.anonymizer.AnonymizerDateExtension"
        dateTableFile="D:/Data/Emory/testzip/testzip/TimeOfInjury.csv"
        id="ADEID"
        name="AnonymizerDateExtension"
        root="test/AnonymizerDateExtension"/>
</Configuration>

When a config.xml file is found, it is loaded in the same way the CTP config.xml file is loaded, so there will be quite a bit of additional logging in the command window before file processing starts.

IMPORTANT: For technical reasons, any AnonymizerExtension plugins must be contained in files with the names extensions1.jar, extensions2.jar, and/or extensions3.jar. No other extensions jars are loaded by the program. A single extensions jar file can contain many AnonymizerExtensions.