Class DeidentifyAndRedact.OurMediaImporter

  • Enclosing class:
    DeidentifyAndRedact

    protected class DeidentifyAndRedact.OurMediaImporter
    extends MediaImporter

    A protected class that actually does all the work of finding and processing the files.

    • Field Detail

      • canUseBzip

        protected boolean canUseBzip
    • Constructor Detail

      • OurMediaImporter

        public OurMediaImporter​(MessageLogger logger,
                                java.lang.String outputFolderName,
                                DeidentifyAndRedact.RedactionRegions redactionRegions,
                                boolean decompress,
                                boolean keepAllPrivate,
                                boolean addContributingEquipmentSequence,
                                AttributeList replacementAttributes,
                                java.util.Set<java.lang.String> failedSet)

        Deidentify both the DICOM Attributes and the Pixel Data using the RedactionRegions specified in the constructor.

        Parameters:
        logger -
        outputFolderName - where to store all the processed output files
        redactionRegions - which regions to redact in all the processed files
        decompress - decompress JPEG rather than try to avoid loss in unredacted blocks
        keepAllPrivate - retain all private attributes, not just known safe ones
        addContributingEquipmentSequence - whether or not to add ContributingEquipmentSequence
        replacementAttributes - additional attributes with values to add or replace during de-identification
        failedSet - set to add paths of files that failed to import (does not have to be empty; will be added to)
    • Method Detail

      • 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)
      • doSomethingWithDicomFileOnMedia

        protected void doSomethingWithDicomFileOnMedia​(java.lang.String dicomFileName,
                                                       java.lang.String inputTransferSyntaxUID,
                                                       java.lang.String sopClassUID)

        Deidentify both the DICOM Attributes and the Pixel Data using the RedactionRegions specified in the constructor.

        Implements the following options of ClinicalTrialsAttributes.removeOrNullIdentifyingAttributes():

        keepDescriptors, keepSeriesDescriptors, keepProtocolName, keepPatientCharacteristics, keepDeviceIdentity, keepInstitutionIdentity, ClinicalTrialsAttributes.HandleDates.keep

        Also performs AttributeList.removeUnsafePrivateAttributes()

        Also performs ClinicalTrialsAttributes.remapUIDAttributes(AttributeList)

        If the pixel data can be redacted without decompressing it (i.e., for Baseline JPEG), then that will be done, otherwise the pixel data will be decompressed and store in Explicit VR Little Endian Transfer Syntax.

        The output file is stored in the outputFolderName specified in the constructor and is named by its SOP Instance UID, a suffix of _Anon" and an extension of ".dcm"

        Any exceptions encountered during processing are logged to stderr, and processing of the next file will continue.

        Overrides:
        doSomethingWithDicomFileOnMedia in class MediaImporter
        Parameters:
        dicomFileName - the fully qualified path name to a DICOM file
        inputTransferSyntaxUID - the Transfer Syntax of the Data Set if a DICOM file, from the DICOMDIR or Meta Information Header
        sopClassUID - the SOP Class of the Data Set if a DICOM file, from the DICOMDIR or Meta Information Header
      • isOKToImport

        protected boolean isOKToImport​(java.lang.String sopClassUID,
                                       java.lang.String transferSyntaxUID)

        Allows all types of DICOM files, images or not, uncompressed or compressed, with supported Transfer Syntaxes to be processed

        Overrides:
        isOKToImport in class MediaImporter
        Parameters:
        sopClassUID -
        transferSyntaxUID -
        Returns:
        true if is suitable