Package com.pixelmed.dicom

# Class CompressedFrameEncoder

java.lang.Object
com.pixelmed.dicom.CompressedFrameEncoder

public class CompressedFrameEncoder extends Object

The `CompressedFrameEncoder` class implements compression of specified frames in various supported Transfer Syntaxes, which can then be incorporated in DICOM encapsulated images.

## Constructor Summary

Constructors
Constructor
Description
`CompressedFrameEncoder()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`chooseOutputFormatForTransferSyntax(String transferSyntaxUID)`
Determine the output format string used by the JIIO codecs for the DICOM Transfer Syntax.
`static String`
`chooseTransferSyntaxForOutputFormat(String outputFormat)`
Determine the DICOM Transfer Syntax for the output format string used by the JIIO codecs.
`static File`
`getCompressedFrameAsFile(AttributeList list, BufferedImage renderedImage, String outputFormat, File tmpFrameFile)`
Compress the supplied frame.

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

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

## Constructor Details

### CompressedFrameEncoder

public CompressedFrameEncoder()

## Method Details

### chooseOutputFormatForTransferSyntax

public static String chooseOutputFormatForTransferSyntax(String transferSyntaxUID)

Determine the output format string used by the JIIO codecs for the DICOM Transfer Syntax.

Though not supported by the JIIO codecs, an output format string of "rle" is also recognized.

Parameters:
  `transferSyntaxUID` - the DICOM Transfer Syntax UID
Returns:
  the format string (lower case) or null if unrecognized

### chooseTransferSyntaxForOutputFormat

public static String chooseTransferSyntaxForOutputFormat(String outputFormat)

Determine the DICOM Transfer Syntax for the output format string used by the JIIO codecs.

Though not supported by the JIIO codecs, an output format string of "rle" is also recognized.

Parameters:
  `outputFormat` - the format string (lower case)
Returns:
  the DICOM Transfer Syntax UID or null if unrecognized

### getCompressedFrameAsFile

public static File getCompressedFrameAsFile(AttributeList list, BufferedImage renderedImage, String outputFormat, File tmpFrameFile) throws IOException, FileNotFoundException, DicomException

Compress the supplied frame.

Parameters:
  `list` - the AttributeList from which the frame was extracted
  `renderedImage` - the frame as an image
  `outputFormat` - the compression format to use [jpeg2000|jpeg-lossless|jpeg-ls|rle]
  `tmpFrameFile` - the file to write the compressed bit stream to
Returns:
  the file written to, or null if compression failed
Throws:
  `IOException` - if there is an error writing the file
  `FileNotFoundException` - if the supplied file path cannot be found
  `DicomException` - if the image cannot be compressed