Package com.pixelmed.apps

## Class PseudonymizeAndSequester.OurMediaImporter

- java.lang.Object
- - com.pixelmed.dicom.MediaImporter
  - - com.pixelmed.apps.PseudonymizeAndSequester.OurMediaImporter

- Enclosing class:
    PseudonymizeAndSequester

      protected class PseudonymizeAndSequester.OurMediaImporter
      extends MediaImporter

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

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.pixelmed.dicom.MediaImporter

      `MediaImporter.MediaImporterWithFileChooserDialogThread, MediaImporter.OurReadTerminationStrategy`

  - ### Field Summary

    - ### Fields inherited from class com.pixelmed.dicom.MediaImporter

      `logger, mediaDirectoryPath, progressBar, progressBarUpdater, terminateAfterIdentifyingGroup`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---

    `OurMediaImporter​(MessageLogger logger, java.lang.String inputPathName, java.lang.String outputFolderCleanName, java.lang.String outputFolderDirtyName, java.lang.String pseudonymizationControlFileName, java.lang.String pseudonymizationResulttByOriginalPatientIDFileName, java.lang.String pseudonymizationResultByOriginalStudyInstanceUIDFileName, java.lang.String failedFilesFileName, java.lang.String uidMapResultFileName, boolean keepAllPrivate, boolean addContributingEquipmentSequence, boolean keepDescriptors, boolean keepSeriesDescriptors, boolean keepProtocolName, boolean keepPatientCharacteristics, boolean keepDeviceIdentity, boolean keepInstitutionIdentity, int handleDates, int handleStructuredContent)`

    De-identify the DICOM Attributes and pseudonymize them and sequester any files that may have risk of identity leakage.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `doSomethingWithDicomFileOnMedia​(java.lang.String dicomFileName, java.lang.String inputTransferSyntaxUID, java.lang.String sopClassUID)` | De-identify the DICOM Attributes and pseudonymize them and sequester if may have risk of identity leakage.
    `protected void` | `finish()` |
    `protected boolean` | `isOKToImport​(java.lang.String sopClassUID, java.lang.String transferSyntaxUID)` | Allows all types of DICOM files, images or not, with any Transfer Syntax to be processed

    - ### Methods inherited from class com.pixelmed.dicom.MediaImporter

      `choosePathAndImportDicomFiles, choosePathAndImportDicomFiles, doSomethingWithDicomFileOnMedia, doSomethingWithUnwantedFileOnMedia, getDirectory, importDicomFiles, logLn, main`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OurMediaImporter

          public OurMediaImporter​(MessageLogger logger,
                                  java.lang.String inputPathName,
                                  java.lang.String outputFolderCleanName,
                                  java.lang.String outputFolderDirtyName,
                                  java.lang.String pseudonymizationControlFileName,
                                  java.lang.String pseudonymizationResulttByOriginalPatientIDFileName,
                                  java.lang.String pseudonymizationResultByOriginalStudyInstanceUIDFileName,
                                  java.lang.String failedFilesFileName,
                                  java.lang.String uidMapResultFileName,
                                  boolean keepAllPrivate,
                                  boolean addContributingEquipmentSequence,
                                  boolean keepDescriptors,
                                  boolean keepSeriesDescriptors,
                                  boolean keepProtocolName,
                                  boolean keepPatientCharacteristics,
                                  boolean keepDeviceIdentity,
                                  boolean keepInstitutionIdentity,
                                  int handleDates,
                                  int handleStructuredContent)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException

      De-identify the DICOM Attributes and pseudonymize them and sequester any files that may have risk of identity leakage.

      Parameters:
        `logger` -
        `outputFolderCleanName` - where to store all the low risk processed output files (must already exist)
        `outputFolderDirtyName` - where to store all the high risk processed output files (must already exist)
        `pseudonymizationControlFileName` - values to use for pseudonymization, may be null or empty in which case random values are used
        `pseudonymizationResulttByOriginalPatientIDFileName` - file into which to store pseudonymization by original PatientID performed
        `pseudonymizationResultByOriginalStudyInstanceUIDFileName` - file into which to store pseudonymization by original StudyInstanceUID performed
        `failedFilesFileName` - file into which to store the paths of files that failed to process
        `uidMapResultFileName` - file into which to store the map of original to new UIDs
        `keepAllPrivate` - retain all private attributes, not just known safe ones
        `addContributingEquipmentSequence` - whether or not to add ContributingEquipmentSequence
        `keepDescriptors` - if true, keep the text description and comment attributes
        `keepSeriesDescriptors` - if true, keep the series description even if all other descriptors are removed
        `keepProtocolName` - if true, keep protocol name even if all other descriptors are removed
        `keepPatientCharacteristics` - if true, keep patient characteristics (such as might be needed for PET SUV calculations)
        `keepDeviceIdentity` - if true, keep device identity
        `keepInstitutionIdentity` - if true, keep institution identity
        `handleDates` - keep, remove or modify dates and times
        `handleStructuredContent` - keep, remove or modify structured content
      Throws:
        `java.io.FileNotFoundException`
        `java.io.IOException`

  - ### Method Detail

    - #### finish

          protected void finish()
                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### doSomethingWithDicomFileOnMedia

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

      De-identify the DICOM Attributes and pseudonymize them and sequester if may have risk of identity leakage.

      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)`

      The pixel data is not redacted.

      The output file is stored in the outputFolderName specified in the constructor and is named ...

      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, with any Transfer Syntax to be processed

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