Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

gdcm::TS Class Reference

Container for dicom 'Transfer Syntax' Hash Table. More...

#include <gdcmTS.h>

List of all members.

Public Types

enum  SpecialType {
  ImplicitVRLittleEndian = 0, ImplicitVRLittleEndianDLXGE, ExplicitVRLittleEndian, DeflatedExplicitVRLittleEndian,
  ExplicitVRBigEndian, JPEGBaselineProcess1, JPEGExtendedProcess2_4, JPEGExtendedProcess3_5,
  JPEGSpectralSelectionProcess6_8, JPEGFullProgressionProcess10_12, JPEGLosslessProcess14, JPEGLosslessProcess14_1,
  JPEGLSLossless, JPEGLSNearLossless, JPEG2000Lossless, JPEG2000,
  RLELossless, UnknownTS
}

Public Member Functions

 TS ()
 ~TS ()
void Print (std::ostream &os=std::cout)
 Print all.

int Count (TSKey const &key)
TSAtr const & GetValue (TSKey const &key)
bool IsTransferSyntax (TSKey const &key)
 Determines if the key passed corresponds to a 'Transfer Syntax' as defined in DICOM (and stored in gdcm::TS class).

bool IsRLELossless (TSKey const &key)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a Run Length Encoding Lossless one.

bool IsJPEGLossless (TSKey const &key)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a 'classical' JPEG Lossless one.

bool IsJPEGLossy (TSKey const &key)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a 'classical' JPEG Lossy one.

bool IsJPEG2000 (TSKey const &key)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEG2000 one.

bool IsJPEG (TSKey const &key)
 Determines if the Transfer Syntax corresponds to 'classical' Jpeg Lossless or Jpeg lossy.

bool IsJPEGLS (TSKey const &key)
 Determines if the Transfer Syntax corresponds to any form of Jpeg-LS encoded Pixel data.

SpecialType GetSpecialTransferSyntax (TSKey const &key)
const char * GetSpecialTransferSyntax (SpecialType t)

Private Attributes

TSHT TsMap


Detailed Description

Container for dicom 'Transfer Syntax' Hash Table.

Note:
This is a singleton

Definition at line 41 of file gdcmTS.h.


Member Enumeration Documentation

enum gdcm::TS::SpecialType
 

Enumeration values:
ImplicitVRLittleEndian 
ImplicitVRLittleEndianDLXGE 
ExplicitVRLittleEndian 
DeflatedExplicitVRLittleEndian 
ExplicitVRBigEndian 
JPEGBaselineProcess1 
JPEGExtendedProcess2_4 
JPEGExtendedProcess3_5 
JPEGSpectralSelectionProcess6_8 
JPEGFullProgressionProcess10_12 
JPEGLosslessProcess14 
JPEGLosslessProcess14_1 
JPEGLSLossless 
JPEGLSNearLossless 
JPEG2000Lossless 
JPEG2000 
RLELossless 
UnknownTS 

Definition at line 44 of file gdcmTS.h.

Referenced by GetSpecialTransferSyntax().


Constructor & Destructor Documentation

gdcm::TS::TS  ) 
 

Definition at line 81 of file gdcmTS.cxx.

References DICT_TS, gdcm::FillDefaultTSDict(), gdcmWarningMacro, gdcm::TSAtr, gdcm::TSKey, and TsMap.

00082 {
00083    std::string filename = DictSet::BuildDictPath() + DICT_TS;
00084    std::ifstream from(filename.c_str());
00085    if( !from )
00086    {
00087       gdcmWarningMacro("Can't open dictionary" << filename.c_str());
00088       FillDefaultTSDict( TsMap );
00089    }
00090    else
00091    {
00092       TSKey key;
00093       TSAtr name;
00094 
00095       while (!from.eof())
00096       {
00097          from >> key;
00098          from >> std::ws;
00099          std::getline(from, name);
00100 
00101          if(key != "")
00102          {
00103             TsMap[key] = name;
00104          }
00105       }
00106       from.close();
00107    }
00108 }

gdcm::TS::~TS  ) 
 

Definition at line 110 of file gdcmTS.cxx.

References TsMap.

00111 {
00112    TsMap.clear();
00113 }


Member Function Documentation

int gdcm::TS::Count TSKey const &  key  ) 
 

Definition at line 117 of file gdcmTS.cxx.

References gdcm::TSKey, and TsMap.

00118 {
00119    return TsMap.count(key);
00120 }

const char * gdcm::TS::GetSpecialTransferSyntax SpecialType  t  ) 
 

Definition at line 290 of file gdcmTS.cxx.

References gdcm::SpecialStrings.

00291 {
00292    return SpecialStrings[t];
00293 }

TS::SpecialType gdcm::TS::GetSpecialTransferSyntax TSKey const &  key  ) 
 

Definition at line 277 of file gdcmTS.cxx.

References gdcm::SpecialStrings, SpecialType, gdcm::TSKey, and UnknownTS.

00278 {
00279    for (int i = 0; SpecialStrings[i] != NULL; i++)
00280    {
00281       if ( SpecialStrings[i] == key )
00282       {
00283          return SpecialType(i);
00284       }
00285    }
00286 
00287    return UnknownTS;
00288 }

TSAtr const & gdcm::TS::GetValue TSKey const &  key  ) 
 

Definition at line 122 of file gdcmTS.cxx.

References gdcm::GDCM_UNFOUND, gdcm::TSAtr, gdcm::TSKey, and TsMap.

Referenced by gdcm::ValEntry::Print().

00123 {
00124    // First thing clean up the string sometime the transfer syntax is padded with spaces
00125    std::string copy = key;
00126    while ( copy.size() && !isdigit((unsigned char)copy[copy.size()-1]) )
00127    {
00128       copy.erase(copy.size()-1, 1);
00129    }
00130 
00131    TSHT::const_iterator it = TsMap.find(copy);
00132    if (it == TsMap.end())
00133    {
00134       return GDCM_UNFOUND;
00135    }
00136    return it->second;
00137 }

bool gdcm::TS::IsJPEG TSKey const &  key  ) 
 

Determines if the Transfer Syntax corresponds to 'classical' Jpeg Lossless or Jpeg lossy.

Returns:
True when any form of JPEG found. False otherwise.

Definition at line 241 of file gdcmTS.cxx.

References IsJPEGLossless(), IsJPEGLossy(), IsTransferSyntax(), and gdcm::TSKey.

00242 {
00243    bool r = false;
00244    // First check this is an actual transfer syntax
00245    if( IsTransferSyntax(key) )
00246    {
00247       if ( IsJPEGLossy( key )
00248         || IsJPEGLossless( key )
00249          )
00250       {
00251          r = true;
00252       }
00253    }
00254    return r;
00255 }

bool gdcm::TS::IsJPEG2000 TSKey const &  key  ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEG2000 one.

Returns:
True when JPEG2000 (Lossly or LossLess) found. False in all other cases.

Definition at line 221 of file gdcmTS.cxx.

References IsTransferSyntax(), JPEG2000, JPEG2000Lossless, gdcm::SpecialStrings, and gdcm::TSKey.

00222 {
00223    bool r = false;
00224    // First check this is an actual transfer syntax
00225    if( IsTransferSyntax(key) )
00226    {
00227       if ( key == SpecialStrings[JPEG2000Lossless]
00228         || key == SpecialStrings[JPEG2000] )
00229       {
00230          r = true;
00231       }
00232    }
00233    return r;
00234 }

bool gdcm::TS::IsJPEGLossless TSKey const &  key  ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a 'classical' JPEG Lossless one.

Returns:
True when 'classical' Lossless found. False in all other cases.

Definition at line 176 of file gdcmTS.cxx.

References IsTransferSyntax(), JPEGFullProgressionProcess10_12, JPEGLosslessProcess14, JPEGLosslessProcess14_1, gdcm::SpecialStrings, and gdcm::TSKey.

Referenced by IsJPEG().

00177 {
00178    bool r = false;
00179    // First check this is an actual transfer syntax
00180    if( IsTransferSyntax(key) )
00181    {
00182       if ( key == SpecialStrings[JPEGFullProgressionProcess10_12]
00183         || key == SpecialStrings[JPEGLosslessProcess14]
00184         || key == SpecialStrings[JPEGLosslessProcess14_1] )
00185       {
00186          r = true;
00187       }
00188    }
00189    return r;
00190 }

bool gdcm::TS::IsJPEGLossy TSKey const &  key  ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a 'classical' JPEG Lossy one.

Returns:
True when 'classical' Lossy found. False in all other cases.

Definition at line 198 of file gdcmTS.cxx.

References IsTransferSyntax(), JPEGBaselineProcess1, JPEGExtendedProcess2_4, JPEGExtendedProcess3_5, JPEGSpectralSelectionProcess6_8, gdcm::SpecialStrings, and gdcm::TSKey.

Referenced by IsJPEG().

00199 {
00200    bool r = false;
00201    // First check this is an actual transfer syntax
00202    if( IsTransferSyntax(key) )
00203    {
00204       if ( key == SpecialStrings[JPEGBaselineProcess1]
00205         || key == SpecialStrings[JPEGExtendedProcess2_4]
00206         || key == SpecialStrings[JPEGExtendedProcess3_5]
00207         || key == SpecialStrings[JPEGSpectralSelectionProcess6_8] )
00208       {
00209          r = true;
00210       }
00211    }
00212    return r;
00213 }

bool gdcm::TS::IsJPEGLS TSKey const &  key  ) 
 

Determines if the Transfer Syntax corresponds to any form of Jpeg-LS encoded Pixel data.

Returns:
True when any form of JPEG-LS found. False otherwise.

Definition at line 262 of file gdcmTS.cxx.

References IsTransferSyntax(), JPEGLSLossless, JPEGLSNearLossless, gdcm::SpecialStrings, and gdcm::TSKey.

00263 {
00264    bool r = false;
00265    // First check this is an actual transfer syntax
00266    if( IsTransferSyntax(key) )
00267    {
00268       if ( key == SpecialStrings[JPEGLSLossless]
00269         || key == SpecialStrings[JPEGLSNearLossless] ) 
00270       {
00271          r = true;
00272       }
00273    }
00274    return r;
00275 }

bool gdcm::TS::IsRLELossless TSKey const &  key  ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a Run Length Encoding Lossless one.

Returns:
True when Run Length Encoding Lossless found. False in all other cases.

Definition at line 156 of file gdcmTS.cxx.

References IsTransferSyntax(), RLELossless, gdcm::SpecialStrings, and gdcm::TSKey.

00157 {
00158    bool r = false;
00159    // First check this is an actual transfer syntax
00160    if( IsTransferSyntax(key) )
00161    {
00162       if ( key == SpecialStrings[RLELossless] )
00163       {
00164          r = true;
00165       }
00166    }
00167    return r;
00168 }

bool gdcm::TS::IsTransferSyntax TSKey const &  key  ) 
 

Determines if the key passed corresponds to a 'Transfer Syntax' as defined in DICOM (and stored in gdcm::TS class).

Returns:
True when key is an actual 'Transfer Syntax'. False in all other cases.

Definition at line 144 of file gdcmTS.cxx.

References gdcm::TSKey, and TsMap.

Referenced by IsJPEG(), IsJPEG2000(), IsJPEGLossless(), IsJPEGLossy(), IsJPEGLS(), and IsRLELossless().

00145 {
00146    TSHT::const_iterator it = TsMap.find(key);
00147    return it != TsMap.end();
00148 }

void gdcm::TS::Print std::ostream &  os = std::cout  ) 
 

Print all.

Parameters:
os The output stream to be written to.

Definition at line 307 of file gdcmTS.cxx.

References TsMap.

00308 {
00309    std::ostringstream s;
00310 
00311    for (TSHT::const_iterator it = TsMap.begin(); it != TsMap.end(); ++it)
00312    {
00313       s << "TS : " << it->first << " = " << it->second << std::endl;
00314    }
00315    os << s.str();
00316 }


Member Data Documentation

TSHT gdcm::TS::TsMap [private]
 

Definition at line 86 of file gdcmTS.h.

Referenced by Count(), GetValue(), IsTransferSyntax(), Print(), TS(), and ~TS().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 22:17:44 2005 for gdcm by doxygen 1.3.6