Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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>

Inheritance diagram for gdcm::TS:

Inheritance graph
[legend]
Collaboration diagram for gdcm::TS:

Collaboration graph
[legend]
List of all members.

Public Types

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

Public Member Functions

virtual void Print (std::ostream &os=std::cout, std::string const &="")
 Print all.
int Count (TSKey const &key)
 returns occurence number of the given key
TSAtr const & GetValue (TSKey const &key)
 returns the human readable value of a Transfer Syntax string
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.
bool IsMPEG (TSKey const &key)
 Determines if the Transfer Syntax corresponds to any form of MPEG encoded Pixel data.
SpecialType GetSpecialTransferSyntax (TSKey const &key)
 GetSpecialTransferSyntax ??
const char * GetSpecialTransferSyntax (SpecialType t)
 GetSpecialTransferSyntax ??
void Delete ()
 Delete the object.
void Register ()
 Register the object.
void Unregister ()
 Unregister the object.
const unsigned long & GetRefCount () const
 Get the reference counting.
void SetPrintLevel (int level)
 Sets the print level for the Dicom Header Elements.
int GetPrintLevel ()
 Gets the print level for the Dicom Entries.

Static Public Member Functions

static TSNew ()
 Constructs a gdcmTS with a RefCounter.

Protected Member Functions

 TS ()
 ~TS ()

Protected Attributes

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

Private Member Functions

 gdcmTypeMacro (TS)

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
 

Enumerator:
ImplicitVRLittleEndian 
ImplicitVRBigEndianPrivateGE 
ExplicitVRLittleEndian 
DeflatedExplicitVRLittleEndian 
ExplicitVRBigEndian 
JPEGBaselineProcess1 
JPEGExtendedProcess2_4 
JPEGExtendedProcess3_5 
JPEGSpectralSelectionProcess6_8 
JPEGFullProgressionProcess10_12 
JPEGLosslessProcess14 
JPEGLosslessProcess14_1 
JPEGLSLossless 
JPEGLSNearLossless 
JPEG2000Lossless 
JPEG2000 
RLELossless 
MPEG2MainProfile 
UnknownTS 

Definition at line 46 of file gdcmTS.h.


Constructor & Destructor Documentation

gdcm::TS::TS  )  [protected]
 

Definition at line 93 of file gdcmTS.cxx.

References gdcm::DictSet::BuildDictPath(), DICT_TS, gdcm::FillDefaultTSDict(), gdcmWarningMacro, and TsMap.

00094 {
00095    std::string filename = DictSet::BuildDictPath() + DICT_TS;
00096    std::ifstream from(filename.c_str());
00097    if ( !from )
00098    {
00099       gdcmWarningMacro("Can't open dictionary" << filename.c_str());
00100       FillDefaultTSDict( TsMap );
00101    }
00102    else
00103    {
00104       TSKey key;
00105       TSAtr name;
00106 
00107       while (!from.eof())
00108       {
00109          from >> key;
00110          from >> std::ws;
00111          std::getline(from, name);
00112 
00113          if (key != "")
00114          {
00115             TsMap[key] = name;
00116          }
00117       }
00118       from.close();
00119    }
00120 }

gdcm::TS::~TS  )  [protected]
 

Definition at line 122 of file gdcmTS.cxx.

References TsMap.

00123 {
00124    TsMap.clear();
00125 }


Member Function Documentation

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

returns occurence number of the given key

Definition at line 131 of file gdcmTS.cxx.

References TsMap.

00132 {
00133    return TsMap.count(key);
00134 }

void gdcm::RefCounter::Delete  )  [inline, inherited]
 

Delete the object.

Remarks:
The object is deleted only if its reference counting is to zero

Definition at line 39 of file gdcmRefCounter.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::File::DoTheLoadingJob(), gdcm::Dict::DoTheLoadingJob(), gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), vtkGdcmReader::LoadImageInMemory(), main(), gdcm::DicomDir::NewMeta(), gdcm::DicomDirStudy::NewVisit(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::Document::ReadNextDocEntry(), gdcm::DicomDir::SetElement(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), vtkGdcmWriter::WriteDcmFile(), gdcm::DicomDir::~DicomDir(), and gdcm::Global::~Global().

00039 { Unregister(); }

gdcm::TS::gdcmTypeMacro TS   )  [private]
 

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

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

const unsigned long& gdcm::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 56 of file gdcmRefCounter.h.

00057    {
00058       return RefCount;
00059    }

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

GetSpecialTransferSyntax ??

Parameters:
t SpecialType t ??
Returns:
char* TS : SpecialStrings[t] ??.

Definition at line 336 of file gdcmTS.cxx.

References gdcm::SpecialStrings.

00337 {
00338    return SpecialStrings[t];
00339 }

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

GetSpecialTransferSyntax ??

Parameters:
key TSKey const &key ??
Returns:
TS::SpecialType ??.

Definition at line 319 of file gdcmTS.cxx.

References gdcm::SpecialStrings, and UnknownTS.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00320 {
00321    for (int i = 0; SpecialStrings[i] != NULL; i++)
00322    {
00323       if ( SpecialStrings[i] == key )
00324       {
00325          return SpecialType(i);
00326       }
00327    }
00328    return UnknownTS;
00329 }

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

returns the human readable value of a Transfer Syntax string

Definition at line 137 of file gdcmTS.cxx.

References gdcm::GDCM_UNFOUND, and TsMap.

Referenced by gdcm::Document::GetTransferSyntaxName(), and gdcm::DataEntry::Print().

00138 {
00139    // First thing clean up the string 
00140    // (sometimes the transfer syntax is padded with spaces)
00141    std::string copy = key;
00142    while ( copy.size() && !isdigit((unsigned char)copy[copy.size()-1]) )
00143    {
00144       copy.erase(copy.size()-1, 1);
00145    }
00146 
00147    TSHT::const_iterator it = TsMap.find(copy);
00148    if (it == TsMap.end())
00149    {
00150       return GDCM_UNFOUND;
00151    }
00152    return it->second;
00153 }

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 257 of file gdcmTS.cxx.

References IsJPEG2000(), IsJPEGLossless(), IsJPEGLossy(), IsJPEGLS(), and IsTransferSyntax().

00258 {
00259    bool r = false;
00260    // First check this is an actual transfer syntax
00261    if ( IsTransferSyntax(key) )
00262    {
00263       if ( IsJPEGLossy( key )
00264         || IsJPEGLossless( key )
00265         || IsJPEG2000( key )
00266         || IsJPEGLS( key )
00267          )
00268       {
00269          r = true;
00270       }
00271    }
00272    return r;
00273 }

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 237 of file gdcmTS.cxx.

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

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile(), and IsJPEG().

00238 {
00239    bool r = false;
00240    // First check this is an actual transfer syntax
00241    if ( IsTransferSyntax(key) )
00242    {
00243       if ( key == SpecialStrings[JPEG2000Lossless]
00244         || key == SpecialStrings[JPEG2000] )
00245       {
00246          r = true;
00247       }
00248    }
00249    return r;
00250 }

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 192 of file gdcmTS.cxx.

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

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile(), and IsJPEG().

00193 {
00194    bool r = false;
00195    // First check this is an actual transfer syntax
00196    if ( IsTransferSyntax(key) )
00197    {
00198       if ( key == SpecialStrings[JPEGFullProgressionProcess10_12]
00199         || key == SpecialStrings[JPEGLosslessProcess14]
00200         || key == SpecialStrings[JPEGLosslessProcess14_1] )
00201       {
00202          r = true;
00203       }
00204    }
00205    return r;
00206 }

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 214 of file gdcmTS.cxx.

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

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile(), and IsJPEG().

00215 {
00216    bool r = false;
00217    // First check this is an actual transfer syntax
00218    if ( IsTransferSyntax(key) )
00219    {
00220       if ( key == SpecialStrings[JPEGBaselineProcess1]
00221         || key == SpecialStrings[JPEGExtendedProcess2_4]
00222         || key == SpecialStrings[JPEGExtendedProcess3_5]
00223         || key == SpecialStrings[JPEGSpectralSelectionProcess6_8] )
00224       {
00225          r = true;
00226       }
00227    }
00228    return r;
00229 }

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 280 of file gdcmTS.cxx.

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

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile(), and IsJPEG().

00281 {
00282    bool r = false;
00283    // First check this is an actual transfer syntax
00284    if ( IsTransferSyntax(key) )
00285    {
00286       if ( key == SpecialStrings[JPEGLSLossless]
00287         || key == SpecialStrings[JPEGLSNearLossless] ) 
00288       {
00289          r = true;
00290       }
00291    }
00292    return r;
00293 }

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

Determines if the Transfer Syntax corresponds to any form of MPEG encoded Pixel data.

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

Definition at line 300 of file gdcmTS.cxx.

References IsTransferSyntax(), MPEG2MainProfile, and gdcm::SpecialStrings.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00301 {
00302    bool r = false;
00303    // First check this is an actual transfer syntax
00304    if ( IsTransferSyntax(key) )
00305    {
00306       if ( key == SpecialStrings[MPEG2MainProfile] ) 
00307       {
00308          r = true;
00309       }
00310    }
00311    return r;
00312 }

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 172 of file gdcmTS.cxx.

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

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00173 {
00174    bool r = false;
00175    // First check this is an actual transfer syntax
00176    if ( IsTransferSyntax(key) )
00177    {
00178       if ( key == SpecialStrings[RLELossless] )
00179       {
00180          r = true;
00181       }
00182    }
00183    return r;
00184 }

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 160 of file gdcmTS.cxx.

References TsMap.

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

00161 {
00162    TSHT::const_iterator it = TsMap.find(key);
00163    return it != TsMap.end();
00164 }

static TS* gdcm::TS::New  )  [inline, static]
 

Constructs a gdcmTS with a RefCounter.

Definition at line 70 of file gdcmTS.h.

Referenced by gdcm::Global::Global().

00070 {return new TS();}

void gdcm::TS::Print std::ostream &  os = std::cout,
std::string const &  = ""
[virtual]
 

Print all.

Parameters:
os The output stream to be written to.

Reimplemented from gdcm::Base.

Definition at line 353 of file gdcmTS.cxx.

References TsMap.

00354 {
00355    std::ostringstream s;
00356 
00357    for (TSHT::const_iterator it = TsMap.begin(); it != TsMap.end(); ++it)
00358    {
00359       s << "TS : " << it->first << " = " << it->second << std::endl;
00360    }
00361    os << s.str();
00362 }

void gdcm::RefCounter::Register  )  [inline, inherited]
 

Register the object.

Remarks:
It increments the reference counting

Definition at line 44 of file gdcmRefCounter.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem().

00044 { RefCount++; }

void gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().

00047 { PrintLevel = level; }

void gdcm::RefCounter::Unregister  )  [inline, inherited]
 

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 48 of file gdcmRefCounter.h.

Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().

00049    {
00050       RefCount--;
00051       if(RefCount<=0)
00052          delete this;
00053    }


Member Data Documentation

int gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print().

TSHT gdcm::TS::TsMap [private]
 

Definition at line 95 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 Fri Jan 20 10:14:38 2006 for gdcm by  doxygen 1.4.4