Class DeidentifyAndRedact
- java.lang.Object
-
- com.pixelmed.apps.DeidentifyAndRedact
-
- Direct Known Subclasses:
DeidentifyAndRedactWithOriginalFileName
public class DeidentifyAndRedact extends java.lang.ObjectA class to implement bulk de-identification and redaction of DICOM files.
Development of this class was supported by funding from MDDX Research and Informatics.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDeidentifyAndRedact.OurMediaImporterA protected class that actually does all the work of finding and processing the files.protected classDeidentifyAndRedact.RedactionRegionsA protected class to store sets of rectangular redaction regions indexed by a String classname.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>failedSetprotected static java.lang.StringourCalledAETitle
-
Constructor Summary
Constructors Constructor 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, 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.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>getFilePathNamesThatFailedToProcess()Get file names that failed to import.static voidmain(java.lang.String[] arg)Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.protected java.lang.StringmakeOutputFileName(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.
-
-
-
Constructor Detail
-
DeidentifyAndRedact
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.IOExceptionRead 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.- Parameters:
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-identification- Throws:
DicomExceptionjava.io.IOExceptionjava.lang.Exception
-
DeidentifyAndRedact
public 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.IOExceptionRead 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.
- Parameters:
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-identification- Throws:
DicomExceptionjava.io.IOExceptionjava.lang.Exception
-
DeidentifyAndRedact
public 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.IOExceptionRead 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.- Parameters:
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 ContributingEquipmentSequence- Throws:
DicomExceptionjava.io.IOExceptionjava.lang.Exception
-
DeidentifyAndRedact
public DeidentifyAndRedact(java.lang.String inputPathName, java.lang.String outputFolderName, java.lang.String redactionControlFileName, boolean decompress, boolean keepAllPrivate) throws DicomException, java.lang.Exception, java.io.IOExceptionRead 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.
- Parameters:
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 ones- Throws:
DicomExceptionjava.io.IOExceptionjava.lang.Exception
-
-
Method Detail
-
makeOutputFileName
protected java.lang.String makeOutputFileName(java.lang.String outputFolderName, java.lang.String inputFileName, java.lang.String sopInstanceUID) throws java.io.IOExceptionMake 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.
- Parameters:
outputFolderName- where to store all the processed output filesinputFileName- the path to search for DICOM filessopInstanceUID- the SOP Instance UID of the output file- Throws:
java.io.IOException- if a filename cannot be constructed
-
getFilePathNamesThatFailedToProcess
public java.util.Set<java.lang.String> getFilePathNamesThatFailedToProcess()
Get file names that failed to import.
- Returns:
- file names that failed to import (empty if did not fail)
-
main
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)- Parameters:
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")
-
-