Class DeidentifyAndRedact
- Direct Known Subclasses:
DeidentifyAndRedactWithOriginalFileName
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
A protected class that actually does all the work of finding and processing the files.protected class
A protected class to store sets of rectangular redaction regions indexed by a String classname. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDeidentifyAndRedact
(String inputPathName, String outputFolderName, String redactionControlFileName, boolean decompress, boolean keepAllPrivate) Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.DeidentifyAndRedact
(String inputPathName, String outputFolderName, 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
(String inputPathName, String outputFolderName, 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
(String inputPathName, String outputFolderName, 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
Modifier and TypeMethodDescriptionGet file names that failed to import.static void
Read DICOM format image files, de-identify them and apply any specified redactions to the Pixel Data.protected String
makeOutputFileName
(String outputFolderName, String inputFileName, String sopInstanceUID) Make a suitable file name to use for a deidentified and redacted input file.
-
Field Details
-
ourCalledAETitle
-
failedSet
-
-
Constructor Details
-
DeidentifyAndRedact
public DeidentifyAndRedact(String inputPathName, String outputFolderName, String redactionControlFileName, boolean decompress, boolean keepAllPrivate, boolean addContributingEquipmentSequence, AttributeList replacementAttributes) throws DicomException, Exception, 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
.- 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:
DicomException
IOException
Exception
-
DeidentifyAndRedact
public DeidentifyAndRedact(String inputPathName, String outputFolderName, String redactionControlFileName, boolean decompress, boolean keepAllPrivate, AttributeList replacementAttributes) throws DicomException, Exception, 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.
- 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:
DicomException
IOException
Exception
-
DeidentifyAndRedact
public DeidentifyAndRedact(String inputPathName, String outputFolderName, String redactionControlFileName, boolean decompress, boolean keepAllPrivate, boolean addContributingEquipmentSequence) throws DicomException, Exception, 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
.- 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:
DicomException
IOException
Exception
-
DeidentifyAndRedact
public DeidentifyAndRedact(String inputPathName, String outputFolderName, String redactionControlFileName, boolean decompress, boolean keepAllPrivate) throws DicomException, Exception, 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.
- 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:
DicomException
IOException
Exception
-
-
Method Details
-
makeOutputFileName
protected String makeOutputFileName(String outputFolderName, String inputFileName, String sopInstanceUID) throws 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.
- 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:
IOException
- if a filename cannot be constructed
-
getFilePathNamesThatFailedToProcess
Get file names that failed to import.
- Returns:
- file names that failed to import (empty if did not fail)
-
main
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")
-