GDCM_NAME_SPACE::JPEGFragment Class Reference

*very* internal class . Shouldn't appear here ! Utility class for summerizing the informations of a JPEG fragment of an "Encapsulated JPEG Compressed Image". This information is a mix of: More...

#include <gdcmJPEGFragment.h>

Inheritance diagram for GDCM_NAME_SPACE::JPEGFragment:

Inheritance graph
[legend]
Collaboration diagram for GDCM_NAME_SPACE::JPEGFragment:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 JPEGFragment ()
 Default constructor.
void Print (std::ostream &os=std::cout, std::string const &indent="")
 Print self.
void DecompressJPEGFramesFromFile (std::ifstream *fp, uint8_t *buffer, int nBits, int &statesuspension)
 Decompress 8bits JPEG Fragment.
bool ReadJPEGFile8 (std::ifstream *fp, void *image_buffer, int &statesuspension)
bool ReadJPEGFile12 (std::ifstream *fp, void *image_buffer, int &statesuspension)
bool ReadJPEGFile16 (std::ifstream *fp, void *image_buffer, int &statesuspension)
void SetLength (uint32_t length)
uint32_t GetLength ()
void SetOffset (uint32_t offset)
uint32_t GetOffset ()
uint8_t * GetImage ()
void SetPrintLevel (int level)
 Sets the print level for the Dicom Header Elements.
int GetPrintLevel ()
 Gets the print level for the Dicom Entries.

Protected Attributes

int PrintLevel
 Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Private Attributes

uint32_t Offset
uint32_t Length
uint8_t * pImage

Detailed Description

*very* internal class . Shouldn't appear here ! Utility class for summerizing the informations of a JPEG fragment of an "Encapsulated JPEG Compressed Image". This information is a mix of:

Each instance of this class (they can be as many instances for a given Document as they are JPEG fragments and they are collected in a JPEGFragmentsInfo )

Definition at line 42 of file gdcmJPEGFragment.h.


Constructor & Destructor Documentation

GDCM_NAME_SPACE::JPEGFragment::JPEGFragment  ) 
 

Default constructor.

Definition at line 38 of file gdcmJPEGFragment.cxx.

References Length, Offset, and pImage.

00039 {
00040    Offset = 0;
00041    Length = 0;
00042 
00043    pImage = 0;
00044 
00045 }


Member Function Documentation

void GDCM_NAME_SPACE::JPEGFragment::DecompressJPEGFramesFromFile std::ifstream *  fp,
uint8_t *  buffer,
int  nBits,
int &  statesuspension
 

Decompress 8bits JPEG Fragment.

Parameters:
fp ifstream to write to
buffer output (data decompress)
nBits 8/12 or 16 bits jpeg
statesuspension state suspension

Definition at line 56 of file gdcmJPEGFragment.cxx.

References gdcmErrorMacro, Offset, ReadJPEGFile12(), ReadJPEGFile16(), and ReadJPEGFile8().

00059 {
00060    // First thing need to reset file to proper position:
00061    fp->seekg( Offset, std::ios::beg);
00062 
00063    if ( nBits == 8 )
00064    {
00065       // JPEG Lossy : call to IJG 6b - 8 bits
00066       ReadJPEGFile8( fp, buffer, statesuspension);
00067    }
00068    else if ( nBits <= 12 )
00069    {
00070        assert( nBits >= 8 );
00071       // JPEG Lossy : call to IJG 6b - 12 bits
00072       ReadJPEGFile12 ( fp, buffer, statesuspension);
00073    }
00074    else if ( nBits <= 16 )
00075    {
00076        assert( nBits >= 12 );
00077       // JPEG Lossy : call to IJG 6b - 16 bits
00078       ReadJPEGFile16 ( fp, buffer, statesuspension);
00079       //gdcmAssertMacro( IsJPEGLossless );
00080    }
00081    else
00082    {
00083       // FIXME : only the bits number is checked,
00084       //         NOT the compression method
00085 
00086       // other JPEG lossy not supported
00087       gdcmErrorMacro( "Unknown jpeg lossy compression ");
00088    }
00089 }

uint8_t* GDCM_NAME_SPACE::JPEGFragment::GetImage  )  [inline]
 

Definition at line 59 of file gdcmJPEGFragment.h.

00059 { return pImage;   }

uint32_t GDCM_NAME_SPACE::JPEGFragment::GetLength  )  [inline]
 

Definition at line 56 of file gdcmJPEGFragment.h.

Referenced by GDCM_NAME_SPACE::PixelReadConvert::ReadAndDecompressJPEGFile().

00056 { return Length;   }

uint32_t GDCM_NAME_SPACE::JPEGFragment::GetOffset  )  [inline]
 

Definition at line 58 of file gdcmJPEGFragment.h.

Referenced by GDCM_NAME_SPACE::PixelReadConvert::ReadAndDecompressJPEGFile().

00058 { return Offset;   }

int GDCM_NAME_SPACE::Base::GetPrintLevel  )  [inline, inherited]
 

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

void GDCM_NAME_SPACE::JPEGFragment::Print std::ostream &  os = std::cout,
std::string const &  indent = ""
[virtual]
 

Print self.

Parameters:
os Stream to print to.
indent Indentation string to be prepended during printing.

Reimplemented from GDCM_NAME_SPACE::Base.

Definition at line 104 of file gdcmJPEGFragment.cxx.

References Length, and Offset.

00105 {
00106    os << indent
00107       << "JPEG fragment: offset : " <<  Offset
00108       << "   length : " <<  Length
00109       << std::endl;
00110 }

bool GDCM_NAME_SPACE::JPEGFragment::ReadJPEGFile12 std::ifstream *  fp,
void *  image_buffer,
int &  statesuspension
 

Referenced by DecompressJPEGFramesFromFile().

bool GDCM_NAME_SPACE::JPEGFragment::ReadJPEGFile16 std::ifstream *  fp,
void *  image_buffer,
int &  statesuspension
 

Referenced by DecompressJPEGFramesFromFile().

bool GDCM_NAME_SPACE::JPEGFragment::ReadJPEGFile8 std::ifstream *  fp,
void *  image_buffer,
int &  statesuspension
 

Referenced by DecompressJPEGFramesFromFile().

void GDCM_NAME_SPACE::JPEGFragment::SetLength uint32_t  length  )  [inline]
 

Definition at line 55 of file gdcmJPEGFragment.h.

Referenced by GDCM_NAME_SPACE::File::ComputeJPEGFragmentInfo().

00055 { Length = length; }

void GDCM_NAME_SPACE::JPEGFragment::SetOffset uint32_t  offset  )  [inline]
 

Definition at line 57 of file gdcmJPEGFragment.h.

Referenced by GDCM_NAME_SPACE::File::ComputeJPEGFragmentInfo().

00057 { Offset = offset; }

void GDCM_NAME_SPACE::Base::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header Elements.

Note:
0 for Light Print; 1 for 'medium' Print, 2 for Heavy Print

Definition at line 47 of file gdcmBase.h.

Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print().

00047 { PrintLevel = level; }


Member Data Documentation

uint32_t GDCM_NAME_SPACE::JPEGFragment::Length [private]
 

Definition at line 63 of file gdcmJPEGFragment.h.

Referenced by JPEGFragment(), and Print().

uint32_t GDCM_NAME_SPACE::JPEGFragment::Offset [private]
 

Definition at line 62 of file gdcmJPEGFragment.h.

Referenced by DecompressJPEGFramesFromFile(), JPEGFragment(), and Print().

uint8_t* GDCM_NAME_SPACE::JPEGFragment::pImage [private]
 

Definition at line 65 of file gdcmJPEGFragment.h.

Referenced by JPEGFragment().

int GDCM_NAME_SPACE::Base::PrintLevel [protected, inherited]
 

Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Definition at line 55 of file gdcmBase.h.

Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 12:57:16 2007 for gdcm by  doxygen 1.4.6