Trispark JDT
2.50.13

com.archimed.dicom.codec
Class Compression

java.lang.Object
  extended by com.archimed.dicom.codec.Compression

public class Compression
extends java.lang.Object

This is a class providing methods to decompress pixel data. DICOM supports many different kinds of compression techniques for Media Storage. Here's a list of supported compression schemes (most common) and their transfer syntaxes.

1.2.840.10008.1.2.4.50 JPEGBaseline
1.2.840.10008.1.2.4.70 JPEGLossless
1.2.840.10008.1.2.5 RLELossless

See Also:
TransferSyntax

Field Summary
protected  JdtLogger log
           
 
Constructor Summary
Compression()
          Empty constructor.
Compression(DicomObject d)
          Constructs a new Compression object for a DicomObject.
 
Method Summary
 void compress(int ts)
          Encodes the pixeldata of the associated DicomObject.
static byte[] compressFrame(int encoding, byte[] frame, int w, int h)
          Encodes a frame and returns the encoded frame.
 void decompress()
          Decompresses the pixeldata of the DicomObject specified in the constructor (or last call of setDicomObject), and replaces it in this DicomObject.
static byte[] decompressFrame(int encoding, byte[] frame, int w, int h)
          decodes a encoded bytearray 'frame' and returns the result.
 DicomObject getDicomObject()
          Returns the DicomObject associated with the Compression object.
 void setDicomObject(DicomObject d)
          replaces the current DicomObject with a new one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected JdtLogger log
Constructor Detail

Compression

public Compression()
Empty constructor. Use setDicomObject to specify the source for compression.


Compression

public Compression(DicomObject d)
            throws DicomException
Constructs a new Compression object for a DicomObject. It just stores the DicomObject internally. No checking is performed here
Note: the DicomObject is stored referentially, not copied. Any changes are directly performed on the DicomObject.

Throws:
DicomException
Method Detail

decompress

public void decompress()
                throws DicomException,
                       java.io.IOException
Decompresses the pixeldata of the DicomObject specified in the constructor (or last call of setDicomObject), and replaces it in this DicomObject.

Throws:
DicomException - gets thrown when needed information is missing.
java.io.IOException - is thrown when the compressed pixel data seems corrupt.

decompressFrame

public static byte[] decompressFrame(int encoding,
                                     byte[] frame,
                                     int w,
                                     int h)
                              throws DicomException,
                                     java.io.IOException
decodes a encoded bytearray 'frame' and returns the result.
Note that the first value in the Data Element PixelData, contains a basic offset table. If the frame couldn't be decoded, this method returns null.

Parameters:
encoding - - use one of the encapsulating transfer syntaxes specified in TransferSyntax
Throws:
DicomException
java.io.IOException

compress

public void compress(int ts)
              throws java.io.IOException,
                     DicomException
Encodes the pixeldata of the associated DicomObject. The original pixeldata is replaced with the compressed pixeldata in the associated DicomObject.

Parameters:
ts - the transfer syntax for the wanted compression scheme
Throws:
java.io.IOException
DicomException
See Also:
TransferSyntax

compressFrame

public static byte[] compressFrame(int encoding,
                                   byte[] frame,
                                   int w,
                                   int h)
                            throws java.io.IOException,
                                   DicomException
Encodes a frame and returns the encoded frame. If the byte array length of the specified byte array is equal to the product of the width and height, the pixeldata is encoded as an 8 bit grayscale image. If the byte array length of the specified byte array is equal to 2 times the product of the width and height, the pixeldata is encoded as an 16 bit grayscale image. If the byte array length of the specified byte array is equal to 3 times the product of the width and height, the pixeldata is encoded as an 24 bit RGB image. In the last case the pixeldata in the specified byte array is assumed to be ordered color by pixel.

Parameters:
encoding - - use one of the encapsulating transfer syntaxes specified in TransferSyntax
Throws:
java.io.IOException
DicomException

setDicomObject

public void setDicomObject(DicomObject d)
                    throws DicomException
replaces the current DicomObject with a new one.
Note: the DicomObject is stored referentially, not copied. Any changes are directly performed on the DicomObject.

Throws:
DicomException

getDicomObject

public DicomObject getDicomObject()
Returns the DicomObject associated with the Compression object.


Trispark JDT
2.50.13

Copyright © 1999-2008 Trispark. All Rights Reserved.