public class CompressDicomFiles extends MediaImporter
This class copies a set of DICOM image files, compressing them losslessly with JPEG 2000 (default), JPEG 10918-1 Lossless Huffman SV1, JPEG-LS or RLE.
MediaImporter.MediaImporterWithFileChooserDialogThread, MediaImporter.OurReadTerminationStrategy
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
outputFormat |
protected java.lang.String |
outputPath |
protected boolean |
reuseSameBaseFileName |
protected java.lang.String |
transferSyntaxUID |
logger, mediaDirectoryPath, progressBar, progressBarUpdater, terminateAfterIdentifyingGroup
Constructor and Description |
---|
CompressDicomFiles(MessageLogger logger) |
Modifier and Type | Method and Description |
---|---|
protected void |
doSomethingWithDicomFileOnMedia(java.lang.String mediaFileName)
Compress the DICOM file.
|
protected void |
doSomethingWithUnwantedFileOnMedia(java.lang.String mediaFileName,
java.lang.String transferSyntaxUID,
java.lang.String sopClassUID)
Log that file cannot be compressed.
|
protected boolean |
isOKToImport(java.lang.String sopClassUID,
java.lang.String transferSyntaxUID)
Is the DICOM file OK to compress?
|
static void |
main(java.lang.String[] arg)
Copy a set of DICOM image files, compressing them losslessly with JPEG 2000 (default), JPEG 10918-1 Lossless Huffman SV1, JPEG-LS or RLE.
|
choosePathAndImportDicomFiles, choosePathAndImportDicomFiles, doSomethingWithDicomFileOnMedia, getDirectory, importDicomFiles, logLn
protected java.lang.String outputFormat
protected java.lang.String outputPath
protected boolean reuseSameBaseFileName
protected java.lang.String transferSyntaxUID
public CompressDicomFiles(MessageLogger logger)
protected void doSomethingWithDicomFileOnMedia(java.lang.String mediaFileName)
Compress the DICOM file.
doSomethingWithDicomFileOnMedia
in class MediaImporter
mediaFileName
- the fully qualified path name to a DICOM fileprotected void doSomethingWithUnwantedFileOnMedia(java.lang.String mediaFileName, java.lang.String transferSyntaxUID, java.lang.String sopClassUID)
Log that file cannot be compressed.
A subclass could do something more creative, like copy the file to a new file without recompressing it to make sure the set of files remains complete.
doSomethingWithUnwantedFileOnMedia
in class MediaImporter
mediaFileName
- the fully qualified path name to a DICOM filetransferSyntaxUID
- the Transfer Syntax of the Data Set if a DICOM file, from the DICOMDIR or Meta Information HeadersopClassUID
- the SOP Class of the Data Set if a DICOM file, from the DICOMDIR or Meta Information Headerprotected boolean isOKToImport(java.lang.String sopClassUID, java.lang.String transferSyntaxUID)
Is the DICOM file OK to compress?
isOKToImport
in class MediaImporter
sopClassUID
- the SOP Class UID of the filetransferSyntaxUID
- the Transfer Syntax UID of the filepublic static void main(java.lang.String[] arg)
Copy a set of DICOM image files, compressing them losslessly with JPEG 2000 (default), JPEG 10918-1 Lossless Huffman SV1, JPEG-LS or RLE.
Non-image files are ignored (not copied).
arg
- array of two or three strings - the input path and the output path and optionally the requested compressed transfer syntax [1.2.840.10008.1.2.4.90|1.2.840.10008.1.2.4.70|1.2.840.10008.1.2.4.80|1.2.840.10008.1.2.5] or output format string [jpeg2000|jpeg-lossless|jpeg-ls|rle]