public class DeidentifyAndRedact
extends java.lang.Object
A class to implement bulk de-identification and redaction of DICOM files.
Development of this class was supported by funding from MDDX Research and Informatics.
| Modifier and Type | Class and Description |
|---|---|
protected class |
DeidentifyAndRedact.OurMediaImporter
A protected class that actually does all the work of finding and processing the files.
|
protected class |
DeidentifyAndRedact.RedactionRegions
A protected class to store sets of rectangular redaction regions indexed by a String classname.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<java.lang.String> |
failedSet |
protected static java.lang.String |
ourCalledAETitle |
| Constructor and Description |
|---|
DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate)
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
|
DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate,
AttributeList replacementAttributes)
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
|
DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate,
boolean addContributingEquipmentSequence)
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
|
DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate,
boolean addContributingEquipmentSequence,
AttributeList replacementAttributes)
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.String> |
getFilePathNamesThatFailedToProcess()
Get file names that failed to import.
|
static void |
main(java.lang.String[] arg)
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
|
protected java.lang.String |
makeOutputFileName(java.lang.String outputFolderName,
java.lang.String inputFileName,
java.lang.String sopInstanceUID)
Make a suitable file name to use for a deidentified and redacted input file.
|
protected static java.lang.String ourCalledAETitle
protected java.util.Set<java.lang.String> failedSet
public DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate,
boolean addContributingEquipmentSequence,
AttributeList replacementAttributes)
throws DicomException,
java.lang.Exception,
java.io.IOException
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
Searches the specified input path recursively for suitable files.
If Baseline (sequential 8 bit) JPEG, can either redact without affecting other JPEG blocks or decompress JPEG entirely, redact and recompress (lossy)For details of the processing, see DeidentifyAndRedact.OurMediaImporter.doSomethingWithDicomFileOnMedia(String,String,String).
For specification of the contents of the redaction control file, see DeidentifyAndRedact.RedactionRegions.
inputPathName - the path to search for DICOM filesoutputFolderName - where to store all the processed output filesredactionControlFileName - which regions to redact in all the processed filesdecompress - decompress JPEG rather than try to avoid loss in unredacted blockskeepAllPrivate - retain all private attributes, not just known safe onesaddContributingEquipmentSequence - whether or not to add ContributingEquipmentSequencereplacementAttributes - additional attributes with values to add or replace during de-identificationDicomExceptionjava.io.IOExceptionjava.lang.Exceptionpublic DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate,
AttributeList replacementAttributes)
throws DicomException,
java.lang.Exception,
java.io.IOException
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
Searches the specified input path recursively for suitable files.
If Baseline (sequential 8 bit) JPEG, can either redact without affecting other JPEG blocks or decompress JPEG entirely, redact and recompress (lossy)For details of the processing, see DeidentifyAndRedact.OurMediaImporter.doSomethingWithDicomFileOnMedia(String,String,String).
For specification of the contents of the redaction control file, see DeidentifyAndRedact.RedactionRegions.
Adds ContributingEquipmentSequence by default.
inputPathName - the path to search for DICOM filesoutputFolderName - where to store all the processed output filesredactionControlFileName - which regions to redact in all the processed filesdecompress - decompress JPEG rather than try to avoid loss in unredacted blockskeepAllPrivate - retain all private attributes, not just known safe onesreplacementAttributes - additional attributes with values to add or replace during de-identificationDicomExceptionjava.io.IOExceptionjava.lang.Exceptionpublic DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate,
boolean addContributingEquipmentSequence)
throws DicomException,
java.lang.Exception,
java.io.IOException
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
Searches the specified input path recursively for suitable files.
If Baseline (sequential 8 bit) JPEG, can either redact without affecting other JPEG blocks or decompress JPEG entirely, redact and recompress (lossy)For details of the processing, see DeidentifyAndRedact.OurMediaImporter.doSomethingWithDicomFileOnMedia(String,String,String).
For specification of the contents of the redaction control file, see DeidentifyAndRedact.RedactionRegions.
inputPathName - the path to search for DICOM filesoutputFolderName - where to store all the processed output filesredactionControlFileName - which regions to redact in all the processed filesdecompress - decompress JPEG rather than try to avoid loss in unredacted blockskeepAllPrivate - retain all private attributes, not just known safe onesaddContributingEquipmentSequence - whether or not to add ContributingEquipmentSequenceDicomExceptionjava.io.IOExceptionjava.lang.Exceptionpublic DeidentifyAndRedact(java.lang.String inputPathName,
java.lang.String outputFolderName,
java.lang.String redactionControlFileName,
boolean decompress,
boolean keepAllPrivate)
throws DicomException,
java.lang.Exception,
java.io.IOException
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
Searches the specified input path recursively for suitable files.
If Baseline (sequential 8 bit) JPEG, can either redact without affecting other JPEG blocks or decompress JPEG entirely, redact and recompress (lossy)For details of the processing, see DeidentifyAndRedact.OurMediaImporter.doSomethingWithDicomFileOnMedia(String,String,String).
For specification of the contents of the redaction control file, see DeidentifyAndRedact.RedactionRegions.
Adds ContributingEquipmentSequence by default.
inputPathName - the path to search for DICOM filesoutputFolderName - where to store all the processed output filesredactionControlFileName - which regions to redact in all the processed filesdecompress - decompress JPEG rather than try to avoid loss in unredacted blockskeepAllPrivate - retain all private attributes, not just known safe onesDicomExceptionjava.io.IOExceptionjava.lang.Exceptionprotected java.lang.String makeOutputFileName(java.lang.String outputFolderName,
java.lang.String inputFileName,
java.lang.String sopInstanceUID)
throws java.io.IOException
Make a suitable file name to use for a deidentified and redacted input file.
The default is the UID plus "_Anon.dcm" in the outputFolderName (ignoring the inputFileName).
Override this method in a subclass if a different file name is required.
outputFolderName - where to store all the processed output filesinputFileName - the path to search for DICOM filessopInstanceUID - the SOP Instance UID of the output filejava.io.IOException - if a filename cannot be constructedpublic java.util.Set<java.lang.String> getFilePathNamesThatFailedToProcess()
Get file names that failed to import.
public static void main(java.lang.String[] arg)
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.
Searches the specified input path recursively for suitable files If Baseline (sequential 8 bit) JPEG, can either redact without affecting other JPEG blocks or decompress JPEG entirely, redact and recompress (lossy)arg - three, four or more parameters, the inputPath (file or folder), outputFolder, redactionControlFile,
optionally the redaction method BLOCK|DECOMPRESS (default is BLOCK),
optionally whether or not to keep all or just known safe private data elements KEEPALLPRIVATE|KEEPSAFEPRIVATE (default is KEEPSAFEPRIVATE),
optionally whether or not to add ContributingEquipmentSequence ADDCONTRIBUTINGEQUIPMENT|DONOTADDCONTRIBUTINGEQUIPMENT (default is ADDCONTRIBUTINGEQUIPMENT),
followed by optional pairs of keyword and value attribute replacements (e.g., PatientName "Doe^Jane")