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

gdcm::BinEntry Class Reference

Any Dicom Document (File or DicomDir) contains a set of DocEntry - Dicom entries - BinEntry is an elementary DocEntry (i.e. a ContentEntry, as opposite to SeqEntry) whose content is non std::string representable BinEntry is a specialisation of ContentEntry. More...

#include <gdcmBinEntry.h>

Inheritance diagram for gdcm::BinEntry:

gdcm::ContentEntry gdcm::DocEntry gdcm::Base List of all members.

Public Member Functions

 BinEntry (DictEntry *e)
 Constructor from a given BinEntry.

 BinEntry (DocEntry *d)
 Constructor from a given BinEntry.

 ~BinEntry ()
 Canonical destructor.

void Print (std::ostream &os=std::cout, std::string const &indent="")
 Prints a BinEntry (Dicom entry).

void WriteContent (std::ofstream *fp, FileType ft)
 canonical Writer

uint8_t * GetBinArea ()
 Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon).

void SetBinArea (uint8_t *area, bool self=true)
 Sets the value (non string) of the current Dicom Header Entry.

void SetSelfArea (bool area)
 Sets SelfArea.

bool IsSelfArea ()
 Returns SelfArea.

virtual void SetValue (std::string const &val)
 Sets the value (string) of the current Dicom entry.

std::string const & GetValue () const
 Returns the 'Value' (e.g. "Dupond Marcel") converted into a 'string', event if it's physically stored on disk as an integer.

void Copy (DocEntry *doc)
 Copies all the attributes from an other DocEntry.

DictEntryGetDictEntry ()
 Gets the DicEntry of the current Dicom entry.

uint16_t GetGroup ()
 Returns the Dicom Group number of the current Dicom entry.

uint16_t GetElement ()
 Returns the Dicom Element number of the current Dicom entry.

void SetKey (TagKey const &key)
 Set the 'key' of the current Dicom entry.

std::string const & GetKey () const
 Returns the 'key' of the current Dicom entry.

std::string const & GetName () const
 Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.

std::string const & GetVR () const
 Returns the 'Value Representation' (e.g. "PN" : Person Name, "SL" : Signed Long), found in the Dicom header or in the Dicom Dictionnary, of the current Dicom entry.

std::string const & GetVM () const
 Returns the 'Value Multiplicity' (e.g. "1", "1-n", "6"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry.

void SetVM (TagName const &v)
 Sets the 'Value Multiplicity' of the current Dicom entry.

size_t GetOffset ()
 Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry.

void SetReadLength (uint32_t l)
 Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.

uint32_t GetReadLength ()
 Returns the 'read length' of the current Dicom entry.

void SetLength (uint32_t l)
 Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.

uint32_t GetLength ()
 Returns the actual value length of the current Dicom entry.

uint32_t GetFullLength ()
 Gets the full length of the elementary DocEntry (not only value length) depending on the VR.

void SetOffset (size_t of)
 Sets the offset of the Dicom entry.

void SetImplicitVR ()
 Sets to TRUE the ImplicitVr flag of the current Dicom entry.

bool IsImplicitVR ()
 Tells us if the current Dicom entry was checked as ImplicitVr.

bool IsVRUnknown ()
 Tells us if the VR of the current Dicom entry is Unknown.

bool IsVMUnknown ()
 Tells us if the VM of the current Dicom entry is Unknown.

bool IsItemDelimitor ()
 tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)

bool IsSequenceDelimitor ()
 tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)

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

DictEntryDicomDict
 pointer to the underlying Dicom dictionary element

uint32_t Length
 Correspond to the real length of the data This length might always be even.

uint32_t ReadLength
 Length to read in the file to obtain data.

bool ImplicitVR
 Even when reading explicit vr files, some elements happen to be implicit. Flag them here since we can't use the entry->vr without breaking the underlying dictionary.

size_t Offset
 Offset from the beginning of file for direct user access.

TagKey Key
 Generalized key of this DocEntry (for details on the generalized key refer to TagKey documentation).

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


Private Attributes

uint8_t * BinArea
 memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons)

bool SelfArea
 Whether BinEntry has its own BinArea or not.


Detailed Description

Any Dicom Document (File or DicomDir) contains a set of DocEntry - Dicom entries - BinEntry is an elementary DocEntry (i.e. a ContentEntry, as opposite to SeqEntry) whose content is non std::string representable BinEntry is a specialisation of ContentEntry.

Definition at line 38 of file gdcmBinEntry.h.


Constructor & Destructor Documentation

gdcm::BinEntry::BinEntry DictEntry e  ) 
 

Constructor from a given BinEntry.

Definition at line 35 of file gdcmBinEntry.cxx.

References BinArea, and SelfArea.

00036          :ContentEntry(e)
00037 {
00038    BinArea = 0;
00039    SelfArea = true;
00040 }

gdcm::BinEntry::BinEntry DocEntry e  ) 
 

Constructor from a given BinEntry.

Parameters:
e Pointer to existing Doc entry

Definition at line 46 of file gdcmBinEntry.cxx.

References BinArea, gdcm::ContentEntry::Copy(), and SelfArea.

00047         : ContentEntry(e->GetDictEntry())
00048 {
00049    Copy(e);
00050 
00051    BinArea = 0;
00052    SelfArea = true;
00053 }

gdcm::BinEntry::~BinEntry  ) 
 

Canonical destructor.

Definition at line 58 of file gdcmBinEntry.cxx.

References BinArea, and SelfArea.

00059 {
00060    if (BinArea && SelfArea)
00061    {
00062       delete[] BinArea;
00063       BinArea = 0; // let's be carefull !
00064    }
00065 }


Member Function Documentation

void gdcm::ContentEntry::Copy DocEntry doc  )  [virtual, inherited]
 

Copies all the attributes from an other DocEntry.

Parameters:
doc entry to copy from

Reimplemented from gdcm::DocEntry.

Definition at line 65 of file gdcmContentEntry.cxx.

References gdcm::ContentEntry::Value.

Referenced by BinEntry(), gdcm::ContentEntry::ContentEntry(), gdcm::FileHelper::CopyBinEntry(), gdcm::FileHelper::CopyValEntry(), gdcm::File::File(), gdcm::FileHelper::SetWriteToLibido(), and gdcm::ValEntry::ValEntry().

00066 {
00067    DocEntry::Copy(doc);
00068 
00069    ContentEntry *entry = dynamic_cast<ContentEntry *>(doc);
00070    if(entry)
00071       Value = entry->Value;
00072 }

uint8_t* gdcm::BinEntry::GetBinArea  )  [inline]
 

Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon).

Definition at line 52 of file gdcmBinEntry.h.

Referenced by gdcm::File::File(), gdcm::DocEntrySet::GetEntryBinArea(), gdcm::Document::LoadEntryBinArea(), Print(), and WriteContent().

00052 { return BinArea; }

DictEntry* gdcm::DocEntry::GetDictEntry  )  [inline, inherited]
 

Gets the DicEntry of the current Dicom entry.

Returns:
The DicEntry of the current Dicom entry

Definition at line 52 of file gdcmDocEntry.h.

Referenced by gdcm::FileHelper::CopyBinEntry(), gdcm::FileHelper::CopyValEntry(), gdcm::DocEntryArchive::Push(), and gdcm::FileHelper::SetWriteToLibido().

00052 { return DicomDict; }; 

uint16_t gdcm::DocEntry::GetElement  )  [inline, inherited]
 

Returns the Dicom Element number of the current Dicom entry.

Definition at line 58 of file gdcmDocEntry.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), gdcm::DocEntry::Print(), gdcm::Document::ReadNextDocEntry(), and gdcm::DocEntry::WriteContent().

00058 { return DicomDict->GetElement();};

uint32_t gdcm::DocEntry::GetFullLength  )  [inherited]
 

Gets the full length of the elementary DocEntry (not only value length) depending on the VR.

Definition at line 150 of file gdcmDocEntry.cxx.

References gdcm::DocEntry::GetReadLength(), gdcm::DocEntry::GetVR(), and gdcm::DocEntry::IsImplicitVR().

00151 {
00152    uint32_t l = GetReadLength();
00153    if ( IsImplicitVR() )
00154    {
00155       l = l + 8;  // 2 (gr) + 2 (el) + 4 (lgth) 
00156    }
00157    else
00158    {
00159       if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" )
00160       {
00161          l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth)
00162       }
00163       else
00164       {
00165          l = l + 8;  // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth)
00166       }
00167    }
00168    return l;
00169 }

uint16_t gdcm::DocEntry::GetGroup  )  [inline, inherited]
 

Returns the Dicom Group number of the current Dicom entry.

Definition at line 55 of file gdcmDocEntry.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), gdcm::DocEntry::Print(), gdcm::Document::ReadNextDocEntry(), gdcm::Document::SkipToNextDocEntry(), gdcm::ValEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and WriteContent().

00055 { return DicomDict->GetGroup();  };

std::string const& gdcm::DocEntry::GetKey  )  const [inline, inherited]
 

Returns the 'key' of the current Dicom entry.

Definition at line 63 of file gdcmDocEntry.h.

Referenced by gdcm::ElementSet::AddEntry(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SQItem::RemoveEntryNoDestroy(), and gdcm::ElementSet::RemoveEntryNoDestroy().

00063 { return Key; }

uint32_t gdcm::DocEntry::GetLength  )  [inline, inherited]
 

Returns the actual value length of the current Dicom entry.

Warning:
this value is not *always* the one stored in the Dicom header in case of well knowned bugs

Definition at line 102 of file gdcmDocEntry.h.

Referenced by gdcm::File::AnonymizeNoLoad(), gdcm::Document::ComputeGroup0002Length(), gdcm::Document::GetDocEntryValue(), gdcm::DocEntrySet::GetEntryLength(), gdcm::File::GetPixelAreaLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::ValEntry::Print(), Print(), gdcm::Document::SkipDocEntry(), gdcm::ValEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and WriteContent().

00102 { return Length; };

std::string const& gdcm::DocEntry::GetName  )  const [inline, inherited]
 

Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.

Definition at line 67 of file gdcmDocEntry.h.

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

00067 { return DicomDict->GetName(); };

size_t gdcm::DocEntry::GetOffset  )  [inline, inherited]
 

Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry.

Warning:
offset of the *value*, not of the Dicom entry

Definition at line 85 of file gdcmDocEntry.h.

Referenced by gdcm::File::AnonymizeNoLoad(), gdcm::File::File(), gdcm::File::GetPixelOffset(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), gdcm::SeqEntry::SeqEntry(), and gdcm::Document::SkipToNextDocEntry().

00085 { return Offset; };

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

Gets the print level for the Dicom Entries.

Definition at line 48 of file gdcmBase.h.

00048 { return PrintLevel; };

uint32_t gdcm::DocEntry::GetReadLength  )  [inline, inherited]
 

Returns the 'read length' of the current Dicom entry.

Warning:
this value is the one stored in the Dicom header but not mandatoryly the one thats's used (in case on SQ, or delimiters, the usable length is set to zero)

Definition at line 94 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::GetFullLength(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SeqEntry::Print(), gdcm::DocEntry::Print(), and gdcm::Document::SkipToNextDocEntry().

00094 { return ReadLength; };

std::string const& gdcm::ContentEntry::GetValue  )  const [inline, inherited]
 

Returns the 'Value' (e.g. "Dupond Marcel") converted into a 'string', event if it's physically stored on disk as an integer.

Definition at line 46 of file gdcmContentEntry.h.

Referenced by gdcm::DicomDir::CreateDicomDir(), gdcm::DocEntrySet::GetEntryValue(), gdcm::Document::GetTransferSyntax(), gdcm::ValEntry::Print(), Print(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), and gdcm::ValEntry::WriteContent().

00046 { return Value; };

std::string const& gdcm::DocEntry::GetVM  )  const [inline, inherited]
 

Returns the 'Value Multiplicity' (e.g. "1", "1-n", "6"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry.

Definition at line 77 of file gdcmDocEntry.h.

00077 { return DicomDict->GetVM(); };

std::string const& gdcm::DocEntry::GetVR  )  const [inline, inherited]
 

Returns the 'Value Representation' (e.g. "PN" : Person Name, "SL" : Signed Long), found in the Dicom header or in the Dicom Dictionnary, of the current Dicom entry.

Definition at line 72 of file gdcmDocEntry.h.

Referenced by gdcm::Document::ComputeGroup0002Length(), gdcm::FileHelper::CopyBinEntry(), gdcm::File::File(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::GetDocEntryUnvalue(), gdcm::Document::GetDocEntryValue(), gdcm::DocEntrySet::GetEntryVR(), gdcm::DocEntry::GetFullLength(), gdcm::DocEntrySet::InsertBinEntry(), gdcm::DocEntrySet::InsertValEntry(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), gdcm::DocEntry::Print(), gdcm::ValEntry::SetValue(), gdcm::ValEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and WriteContent().

00072 { return DicomDict->GetVR(); };

bool gdcm::DocEntry::IsImplicitVR  )  [inline, inherited]
 

Tells us if the current Dicom entry was checked as ImplicitVr.

Returns:
true if the current Dicom entry was checked as ImplicitVr

Definition at line 117 of file gdcmDocEntry.h.

References gdcm::ImplicitVR.

Referenced by gdcm::Document::GetDocEntryUnvalue(), gdcm::Document::GetDocEntryValue(), gdcm::DocEntry::GetFullLength(), and gdcm::SeqEntry::SeqEntry().

00117 { return ImplicitVR; };

bool gdcm::DocEntry::IsItemDelimitor  )  [inherited]
 

tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)

Definition at line 175 of file gdcmDocEntry.cxx.

References gdcm::DocEntry::GetElement(), and gdcm::DocEntry::GetGroup().

Referenced by gdcm::Document::ParseDES().

00176 {
00177    return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
00178 }

bool gdcm::BinEntry::IsSelfArea  )  [inline]
 

Returns SelfArea.

Definition at line 58 of file gdcmBinEntry.h.

Referenced by gdcm::File::File().

00058 { return SelfArea; };

bool gdcm::DocEntry::IsSequenceDelimitor  )  [inherited]
 

tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)

Definition at line 184 of file gdcmDocEntry.cxx.

References gdcm::DocEntry::GetElement(), and gdcm::DocEntry::GetGroup().

Referenced by gdcm::Document::ParseSQ().

00185 {
00186    return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
00187 }

bool gdcm::DocEntry::IsVMUnknown  )  [inline, inherited]
 

Tells us if the VM of the current Dicom entry is Unknown.

Returns:
true if the VM is unknown

Definition at line 125 of file gdcmDocEntry.h.

00125 { return DicomDict->IsVMUnknown(); };

bool gdcm::DocEntry::IsVRUnknown  )  [inline, inherited]
 

Tells us if the VR of the current Dicom entry is Unknown.

Returns:
true if the VR is unknown

Definition at line 121 of file gdcmDocEntry.h.

00121 { return DicomDict->IsVRUnknown(); };

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

Prints a BinEntry (Dicom entry).

Parameters:
os ostream we want to print in
indent Indentation string to be prepended during printing

Reimplemented from gdcm::DocEntry.

Definition at line 167 of file gdcmBinEntry.cxx.

References GetBinArea(), gdcm::DocEntry::GetLength(), and gdcm::ContentEntry::GetValue().

00168 {
00169    os << "B ";
00170    DocEntry::Print(os);
00171    std::ostringstream s;
00172    void* binArea = GetBinArea();
00173    if (binArea)
00174    {
00175       s << " [" << GetValue()
00176         << "; length = " << GetLength() << "]";
00177    }
00178    else
00179    {
00180       if ( GetLength() == 0 )
00181       {
00182          s << " []";
00183       }
00184       else 
00185       {
00186          s << " [" <<GetValue() << "]";
00187       }         
00188    }
00189    os << s.str();
00190 }

void gdcm::BinEntry::SetBinArea uint8_t *  area,
bool  self = true
 

Sets the value (non string) of the current Dicom Header Entry.

Definition at line 145 of file gdcmBinEntry.cxx.

References BinArea, and SelfArea.

Referenced by gdcm::File::File(), gdcm::Document::LoadEntryBinArea(), gdcm::DocEntrySet::SetBinEntry(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().

00146 { 
00147    if (BinArea && SelfArea)
00148       delete[] BinArea;
00149 
00150    BinArea = area;
00151    SelfArea=self;
00152 }

void gdcm::DocEntry::SetImplicitVR  )  [inline, inherited]
 

Sets to TRUE the ImplicitVr flag of the current Dicom entry.

Definition at line 113 of file gdcmDocEntry.h.

References gdcm::ImplicitVR.

Referenced by gdcm::Document::ReadNextDocEntry().

00113 { ImplicitVR = true; };

void gdcm::DocEntry::SetKey TagKey const &  key  )  [inline, inherited]
 

Set the 'key' of the current Dicom entry.

Definition at line 61 of file gdcmDocEntry.h.

References gdcm::TagKey.

Referenced by gdcm::DocEntry::DocEntry(), and gdcm::Document::ParseDES().

00061 { Key = key; }

void gdcm::DocEntry::SetLength uint32_t  l  )  [inline, inherited]
 

Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.

Definition at line 98 of file gdcmDocEntry.h.

Referenced by gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntrySet::SetBinEntry(), gdcm::ValEntry::SetValue(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().

00098 { Length = l; };

void gdcm::DocEntry::SetOffset size_t  of  )  [inline, inherited]
 

Sets the offset of the Dicom entry.

Warning:
use with caution !
Parameters:
of offset to be set

Definition at line 110 of file gdcmDocEntry.h.

Referenced by gdcm::DicomDirObject::FillObject(), gdcm::Document::ReadNextDocEntry(), and gdcm::DicomDir::SetElement().

00110 { Offset = of; };

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

Definition at line 45 of file gdcmBase.h.

Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().

00045 { PrintLevel = level; };

void gdcm::DocEntry::SetReadLength uint32_t  l  )  [inline, inherited]
 

Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.

Definition at line 89 of file gdcmDocEntry.h.

Referenced by gdcm::Document::FixDocEntryFoundLength().

00089 { ReadLength = l; };

void gdcm::BinEntry::SetSelfArea bool  area  )  [inline]
 

Sets SelfArea.

Definition at line 56 of file gdcmBinEntry.h.

Referenced by gdcm::File::File().

00056 { SelfArea = area; };

virtual void gdcm::ContentEntry::SetValue std::string const &  val  )  [inline, virtual, inherited]
 

Sets the value (string) of the current Dicom entry.

Reimplemented in gdcm::ValEntry.

Definition at line 43 of file gdcmContentEntry.h.

Referenced by gdcm::Document::LoadDocEntry(), gdcm::DocEntrySet::SetBinEntry(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().

00043 { Value = val; };

void gdcm::DocEntry::SetVM TagName const &  v  )  [inline, inherited]
 

Sets the 'Value Multiplicity' of the current Dicom entry.

Definition at line 80 of file gdcmDocEntry.h.

References gdcm::TagName.

00080 { DicomDict->SetVM(v); }; 

void gdcm::BinEntry::WriteContent std::ofstream *  fp,
FileType  filetype
[virtual]
 

canonical Writer

Parameters:
fp already open file pointer
filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...)

Implements gdcm::ContentEntry.

Definition at line 74 of file gdcmBinEntry.cxx.

References GetBinArea(), gdcm::DocEntry::GetGroup(), gdcm::DocEntry::GetLength(), and gdcm::DocEntry::GetVR().

00075 { 
00076    DocEntry::WriteContent(fp, filetype);
00077    void* binArea = GetBinArea();
00078    int lgr = GetLength();
00079    if (binArea) // the binArea was *actually* loaded
00080    {
00081 
00082    // TODO FIME
00083    // Probabely, the same operation will have to be done when we want 
00084    // to write image with Big Endian Transfert Syntax, 
00085    //   and we are working on Little Endian Processor
00086 
00087 #ifdef GDCM_WORDS_BIGENDIAN
00088       const int BUFFER_SIZE = 4096;
00089       // TODO FIXME Right now, we only care of Pixels element
00090 
00091       // 8 Bits Pixels *are* OB, 16 Bits Pixels *are* OW
00092       // -value forced while Reading process-
00093       if (GetGroup() == 0x7fe0 && GetVR() == "OW")
00094       {     
00095          uint16_t *buffer = new uint16_t[BUFFER_SIZE/2];
00096 
00097          // how many BUFFER_SIZE long pieces in binArea ?
00098          int nbPieces = lgr/BUFFER_SIZE; //(16 bits = 2 Bytes)
00099          int remainingSize = lgr%BUFFER_SIZE;
00100 
00101          uint16_t *binArea16 = (uint16_t*)binArea;
00102          for (int j=0;j<nbPieces;j++)
00103          {
00104             for (int i = 0; i < BUFFER_SIZE/2; i++)
00105             {
00106                //buffer[i] =  (binArea16[i] >> 8) | (binArea16[i] << 8);
00107                uint16_t val = binArea16[i];
00108                buffer[i] = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) );
00109             }
00110             fp->write ( (char*)buffer, BUFFER_SIZE );
00111             binArea16 += BUFFER_SIZE/2;
00112          }
00113          if ( remainingSize > 0)
00114          {
00115             for (int i = 0; i < remainingSize/2; i++)
00116             {
00117                //buffer[i] =  (binArea16[i] >> 8) | (binArea16[i] << 8);
00118                uint16_t val = binArea16[i];
00119                buffer[i] = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) );
00120             }
00121             fp->write ( (char*)buffer, remainingSize );
00122          } 
00123          delete[] buffer;
00124       }
00125       else
00126       { 
00127          // For any other VR, BinEntry is re-written as-is
00128          fp->write ( (char*)binArea, lgr );
00129       }
00130 #else
00131       fp->write ( (char*)binArea, lgr ); // Elem value
00132 #endif //GDCM_WORDS_BIGENDIAN
00133 
00134    }
00135    else
00136    {
00137       // nothing was loaded, but we need to skip space on disc
00138       fp->seekp(lgr, std::ios::cur);
00139    }
00140 }


Member Data Documentation

uint8_t* gdcm::BinEntry::BinArea [private]
 

memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons)

Definition at line 63 of file gdcmBinEntry.h.

Referenced by BinEntry(), SetBinArea(), and ~BinEntry().

DictEntry* gdcm::DocEntry::DicomDict [protected, inherited]
 

pointer to the underlying Dicom dictionary element

Definition at line 134 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::DocEntry().

bool gdcm::DocEntry::ImplicitVR [protected, inherited]
 

Even when reading explicit vr files, some elements happen to be implicit. Flag them here since we can't use the entry->vr without breaking the underlying dictionary.

Definition at line 146 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::Copy(), gdcm::DocEntry::DocEntry(), and gdcm::SeqEntry::SeqEntry().

TagKey gdcm::DocEntry::Key [protected, inherited]
 

Generalized key of this DocEntry (for details on the generalized key refer to TagKey documentation).

Definition at line 153 of file gdcmDocEntry.h.

uint32_t gdcm::DocEntry::Length [protected, inherited]
 

Correspond to the real length of the data This length might always be even.

Definition at line 138 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::Copy(), and gdcm::DocEntry::DocEntry().

size_t gdcm::DocEntry::Offset [protected, inherited]
 

Offset from the beginning of file for direct user access.

Definition at line 149 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::Copy(), and gdcm::DocEntry::DocEntry().

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

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

Definition at line 53 of file gdcmBase.h.

Referenced by gdcm::Base::Base().

uint32_t gdcm::DocEntry::ReadLength [protected, inherited]
 

Length to read in the file to obtain data.

Definition at line 141 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::Copy(), and gdcm::DocEntry::DocEntry().

bool gdcm::BinEntry::SelfArea [private]
 

Whether BinEntry has its own BinArea or not.

Definition at line 65 of file gdcmBinEntry.h.

Referenced by BinEntry(), SetBinArea(), and ~BinEntry().


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