Package com.pixelmed.apps

# Class DeidentifyAndRedact.OurMediaImporter

java.lang.Object
com.pixelmed.dicom.MediaImporter
com.pixelmed.apps.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.

## Nested Class Summary

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

`MediaImporter.MediaImporterWithFileChooserDialogThread, MediaImporter.OurReadTerminationStrategy`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`canUseBzip`

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

`logger, mediaDirectoryPath, progressBar, progressBarUpdater, terminateAfterIdentifyingGroup`

## Constructor Summary

Constructors
Constructor
Description
`OurMediaImporter(MessageLogger logger, String outputFolderName, DeidentifyAndRedact.RedactionRegions redactionRegions, boolean decompress, boolean keepAllPrivate, boolean addContributingEquipmentSequence, AttributeList replacementAttributes, Set<String> failedSet)`
Deidentify both the DICOM Attributes and the Pixel Data using the RedactionRegions specified in the constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doSomethingWithDicomFileOnMedia(String dicomFileName, String inputTransferSyntaxUID, String sopClassUID)`
Deidentify both the DICOM Attributes and the Pixel Data using the RedactionRegions specified in the constructor.
`Set<String>`
`getFilePathNamesThatFailedToProcess()`
Get file names that failed to import.
`protected boolean`
`isOKToImport(String sopClassUID, String transferSyntaxUID)`
Allows all types of DICOM files, images or not, uncompressed or compressed, with supported Transfer Syntaxes 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`

## Field Details

### canUseBzip

protected boolean canUseBzip

## Constructor Details

### OurMediaImporter

public OurMediaImporter(MessageLogger logger, String outputFolderName, DeidentifyAndRedact.RedactionRegions redactionRegions, boolean decompress, boolean keepAllPrivate, boolean addContributingEquipmentSequence, AttributeList replacementAttributes, Set<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 Details

### getFilePathNamesThatFailedToProcess

public Set<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(String dicomFileName, String inputTransferSyntaxUID, 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(String sopClassUID, 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