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

gdcm::SeqEntry Class Reference

a SeqEntry (as opposed to a DataEntry) is a non elementary DocEntry. It is composed by a set of SQItems. Each SQItem is composed by a set of DocEntry A DocEntry may be a SeqEntry ... and so forth More...

#include <gdcmSeqEntry.h>

Inheritance diagram for gdcm::SeqEntry:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

void Print (std::ostream &os=std::cout, std::string const &indent="")
 canonical Printer
void WriteContent (std::ofstream *fp, FileType filetype)
 Writes the common part of any DataEntry, SeqEntry.
uint32_t ComputeFullLength ()
 Compute the full length of the SeqEntry (not only value length) depending on the VR.
void AddSQItem (SQItem *it, int itemNumber)
 adds the passed ITEM to the ITEM chained List for this SeQuence.
void ClearSQItem ()
 Remove all SQItem.
SQItemGetFirstSQItem ()
 Get the first entry while visiting the SeqEntry.
SQItemGetNextSQItem ()
 Get the next SQItem while visiting the SeqEntry.
SQItemGetSQItem (int itemNumber)
 return a pointer to the SQItem referenced by its ordinal number. Returns the first item when argument is negative. Returns the last item when argument is bigger than the total item number.
unsigned int GetNumberOfSQItems ()
 returns the number of SQItems within the current Sequence
void SetDelimitorMode (bool dm)
 Sets the delimitor mode.
void SetDelimitationItem (DocEntry *e)
 Sets the Sequence Delimitation Item.
DocEntryGetDelimitationItem ()
 Gets the Sequence Delimitation Item.
int GetDepthLevel () const
 Gets the depth level.
void SetDepthLevel (int depth)
 Sets the depth level of a Sequence Entry embedded in a SeQuence.
virtual void Copy (DocEntry *doc)
 Copies all the attributes from an other DocEntry.
DictEntryGetDictEntry ()
 Gets the DicEntry of the current Dicom entry.
const uint16_t & GetGroup () const
 Returns the Dicom Group number of the current Dicom entry.
const uint16_t & GetElement () const
 Returns the Dicom Element number of the current Dicom entry.
TagKey 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.
VRKey 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", 6", "1-n", "3-n"), 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.
const size_t & GetOffset () const
 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.
const uint32_t & GetReadLength () const
 Returns the 'read length' of the current Dicom entry.
virtual void SetLength (uint32_t l)
 Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.
const uint32_t & GetLength () const
 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 () const
 Tells us if the current Dicom entry was checked as ImplicitVr.
bool IsVRUnknown () const
 Tells us if the VR of the current Dicom entry is Unknown.
bool IsVMUnknown () const
 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 IsItemStarter ()
 tells us if entry is the first one of an Item (fffe,e000)
bool IsSequenceDelimitor ()
 tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
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 SeqEntryNew (DictEntry *e)
 Contructs a SeqEntry with a RefCounter from DictEntry.
static SeqEntryNew (DocEntry *d, int depth)
 Contructs a SeqEntry with a RefCounter from DocEntry.

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.
int PrintLevel
 Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Private Member Functions

 gdcmTypeMacro (SeqEntry)
 SeqEntry (DictEntry *e)
 Constructor from a given SeqEntry.
 SeqEntry (DocEntry *d, int depth)
 Constructor from a given DocEntry.
 ~SeqEntry ()
 Canonical destructor.

Private Attributes

bool DelimitorMode
 If this Sequence is in delimitor mode (length =0xffffffff) or not.
ListSQItem Items
 Chained list of SQ Items.
ListSQItem::iterator ItSQItem
 iterator on the SQItems of the current SeqEntry
DocEntrySeqTerm
 sequence terminator item
int SQDepthLevel
 Defines the depth level of this SeqEntry inside the (optionaly) nested sequences. SQDepthLevel and its SQItem::SQDepthLevel counterpart are only defined on printing purposes (see Print).

Detailed Description

a SeqEntry (as opposed to a DataEntry) is a non elementary DocEntry. It is composed by a set of SQItems. Each SQItem is composed by a set of DocEntry A DocEntry may be a SeqEntry ... and so forth

Definition at line 40 of file gdcmSeqEntry.h.


Constructor & Destructor Documentation

gdcm::SeqEntry::SeqEntry DictEntry e  )  [private]
 

Constructor from a given SeqEntry.

Definition at line 37 of file gdcmSeqEntry.cxx.

References DelimitorMode, gdcm::DocEntry::Length, gdcm::DocEntry::ReadLength, SeqTerm, and SQDepthLevel.

00038              : DocEntry(e)
00039 {
00040    Length       = 0;
00041    ReadLength   = 0xffffffff;
00042    SQDepthLevel = -1;
00043 
00044    DelimitorMode = false;
00045    SeqTerm  = NULL;
00046 }

gdcm::SeqEntry::SeqEntry DocEntry e,
int  depth
[private]
 

Constructor from a given DocEntry.

Parameters:
e Pointer to existing Doc entry
depth depth level of the current Seq entry

Definition at line 53 of file gdcmSeqEntry.cxx.

References gdcm::DocEntry::GetOffset(), gdcm::DocEntry::ImplicitVR, gdcm::DocEntry::IsImplicitVR(), gdcm::DocEntry::Length, gdcm::DocEntry::Offset, gdcm::DocEntry::ReadLength, SeqTerm, and SQDepthLevel.

00054              : DocEntry( e->GetDictEntry() )
00055 {
00056    Length       = 0;
00057    ReadLength   = 0xffffffff;
00058    SQDepthLevel = depth;
00059 
00060    ImplicitVR   = e->IsImplicitVR();
00061    Offset       = e->GetOffset();
00062    SeqTerm = NULL;
00063 }

gdcm::SeqEntry::~SeqEntry  )  [private]
 

Canonical destructor.

Definition at line 68 of file gdcmSeqEntry.cxx.

References ClearSQItem().

00069 {
00070    ClearSQItem();
00071 }


Member Function Documentation

void gdcm::SeqEntry::AddSQItem SQItem sqItem,
int  itemNumber
 

adds the passed ITEM to the ITEM chained List for this SeQuence.

Parameters:
sqItem SQItem to be pushed back in the SeqEntry
itemNumber ordinal number of the SQItem
Note:
NOT end-user intendend method !

Definition at line 128 of file gdcmSeqEntry.cxx.

References Items, gdcm::RefCounter::Register(), and gdcm::SQItem::SetSQItemNumber().

Referenced by gdcm::FileHelper::CheckMandatoryElements(), and gdcm::Document::ParseSQ().

00129 {
00130 // FIXME : SQItemNumber is supposed to be the ordinal number of the SQItem
00131 //         within the Sequence.
00132 //         Either only 'push_back' is allowed, 
00133 //                and we just have to do something like SeqEntry::lastNb++
00134 //         Or we can add (or remove) anywhere, and SQItemNumber will be broken
00135    sqItem->SetSQItemNumber(itemNumber);
00136    Items.push_back(sqItem);
00137    sqItem->Register();
00138 }

void gdcm::SeqEntry::ClearSQItem  ) 
 

Remove all SQItem.

Definition at line 143 of file gdcmSeqEntry.cxx.

References Items, SeqTerm, and gdcm::RefCounter::Unregister().

Referenced by Copy(), and ~SeqEntry().

00144 {
00145    for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc)
00146    {
00147       (*cc)->Unregister();
00148    }
00149    if (SeqTerm)
00150    {
00151       SeqTerm->Unregister();
00152    }
00153 }

uint32_t gdcm::SeqEntry::ComputeFullLength  )  [virtual]
 

Compute the full length of the SeqEntry (not only value length) depending on the VR.

Implements gdcm::DocEntry.

Definition at line 109 of file gdcmSeqEntry.cxx.

References Items.

00110 {
00111    uint32_t l = 12; // Tag (4) + VR (explicit) 4 + 4 (length);   
00112    for(ListSQItem::iterator cc  = Items.begin();
00113                             cc != Items.end();
00114                           ++cc)
00115    {        
00116       l += (*cc)->ComputeFullLength();
00117    }   
00118    l += 8; // seq_term Tag (4) +  seq_term_lg (4)
00119    return l;
00120 }

void gdcm::SeqEntry::Copy DocEntry doc  )  [virtual]
 

Copies all the attributes from an other DocEntry.

Parameters:
doc entry to copy from
Remarks:
The contained SQItems a not copied, only referenced

Reimplemented from gdcm::DocEntry.

Definition at line 238 of file gdcmSeqEntry.cxx.

References ClearSQItem(), gdcm::DocEntry::Copy(), DelimitorMode, Items, ItSQItem, gdcm::RefCounter::Register(), SeqTerm, and SQDepthLevel.

00239 {
00240    // Delete previous SQ items
00241    ClearSQItem();
00242 
00243    DocEntry::Copy(doc);
00244    SeqEntry *entry = dynamic_cast<SeqEntry *>(doc);
00245    if ( entry )
00246    {
00247       DelimitorMode = entry->DelimitorMode;
00248       SQDepthLevel = entry->SQDepthLevel;
00249 
00250       SeqTerm = entry->SeqTerm;
00251       if(SeqTerm)
00252          SeqTerm->Register();
00253       Items = entry->Items;
00254       for(ItSQItem = Items.begin();ItSQItem != Items.end(); ++ItSQItem)
00255       {
00256          (*ItSQItem)->Register();
00257       }
00258    }
00259 }

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::SeqEntry::gdcmTypeMacro SeqEntry   )  [private]
 

DocEntry* gdcm::SeqEntry::GetDelimitationItem  )  [inline]
 

Gets the Sequence Delimitation Item.

Definition at line 65 of file gdcmSeqEntry.h.

00065 { return SeqTerm;}

int gdcm::SeqEntry::GetDepthLevel  )  const [inline]
 

Gets the depth level.

Definition at line 68 of file gdcmSeqEntry.h.

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

00068 { return SQDepthLevel; }

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 48 of file gdcmDocEntry.h.

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

00048 { return DicomDict; } 

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

Returns the Dicom Element number of the current Dicom entry.

Definition at line 54 of file gdcmDocEntry.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsItemStarter(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), gdcm::DataEntry::Print(), gdcm::Document::ReadNextDocEntry(), and gdcm::DocEntry::WriteContent().

00054 { return DicomDict->GetElement();}

SQItem * gdcm::SeqEntry::GetFirstSQItem  ) 
 

Get the first entry while visiting the SeqEntry.

Returns:
The first SQItem if found, otherwhise NULL

Definition at line 159 of file gdcmSeqEntry.cxx.

References Items, and ItSQItem.

Referenced by gdcm::DicomDir::CreateDicomDir(), and gdcm::Document::DoTheLoadingDocumentJob().

00160 {
00161    ItSQItem = Items.begin();
00162    if (ItSQItem != Items.end())
00163       return *ItSQItem;
00164    return NULL;
00165 } 

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 178 of file gdcmDocEntry.cxx.

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

Referenced by gdcm::DataEntry::ComputeFullLength().

00179 {
00180    uint32_t l = GetReadLength();
00181    if ( IsImplicitVR() )
00182    {
00183       l = l + 8;  // 2 (gr) + 2 (el) + 4 (lgth) 
00184    }
00185    else
00186    {
00187       if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" )
00188       {
00189          l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth)
00190       }
00191       else
00192       {
00193          l = l + 8;  // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth)
00194       }
00195    }
00196    return l;
00197 }

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

Returns the Dicom Group number of the current Dicom entry.

Definition at line 51 of file gdcmDocEntry.h.

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

00051 { return DicomDict->GetGroup();  }

TagKey gdcm::DocEntry::GetKey  )  const [inline, inherited]
 

Returns the 'key' of the current Dicom entry.

Definition at line 57 of file gdcmDocEntry.h.

Referenced by gdcm::ElementSet::AddEntry(), gdcm::Document::ParseDES(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::Validator::SetInput(), and gdcm::DataEntry::WriteContent().

00057 { return DicomDict->GetKey(); }

const uint32_t& gdcm::DocEntry::GetLength  )  const [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 known bugs

Definition at line 96 of file gdcmDocEntry.h.

Referenced by gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::DataEntry::Copy(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::DocEntrySet::GetEntryLength(), gdcm::File::GetPixelAreaLength(), gdcm::DataEntry::GetString(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::DataEntry::NewBinArea(), gdcm::DataEntry::Print(), gdcm::Document::SkipDocEntry(), gdcm::DocEntry::WriteContent(), and gdcm::DataEntry::WriteContent().

00096 { 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 61 of file gdcmDocEntry.h.

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

00061 { return DicomDict->GetName(); }

SQItem * gdcm::SeqEntry::GetNextSQItem  ) 
 

Get the next SQItem while visiting the SeqEntry.

Note:
: meaningfull only if GetFirstEntry already called
Returns:
The next SQItem if found, otherwhise NULL

Definition at line 173 of file gdcmSeqEntry.cxx.

References gdcmAssertMacro, Items, and ItSQItem.

Referenced by gdcm::DicomDir::CreateDicomDir().

00174 {
00175    gdcmAssertMacro (ItSQItem != Items.end())
00176    {
00177       ++ItSQItem;
00178       if (ItSQItem != Items.end())
00179          return *ItSQItem;
00180    }
00181    return NULL;
00182 }

unsigned int gdcm::SeqEntry::GetNumberOfSQItems  ) 
 

returns the number of SQItems within the current Sequence

Definition at line 212 of file gdcmSeqEntry.cxx.

References Items.

00213 {
00214    return Items.size();
00215 }

const size_t& gdcm::DocEntry::GetOffset  )  const [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 79 of file gdcmDocEntry.h.

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

00079 { return Offset; }

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 uint32_t& gdcm::DocEntry::GetReadLength  )  const [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 88 of file gdcmDocEntry.h.

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

00088 { return ReadLength; }

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    }

SQItem * gdcm::SeqEntry::GetSQItem int  itemNumber  ) 
 

return a pointer to the SQItem referenced by its ordinal number. Returns the first item when argument is negative. Returns the last item when argument is bigger than the total item number.

Definition at line 190 of file gdcmSeqEntry.cxx.

References Items.

00191 {
00192    if (nb<0)
00193    {
00194       return *(Items.begin());
00195    }
00196    int count = 0 ;
00197    for(ListSQItem::iterator cc = Items.begin();
00198                            cc != Items.end();
00199                            count ++, ++cc)
00200    {
00201       if (count == nb)
00202       {
00203          return *cc;
00204       }
00205    }
00206    return *(Items.end());
00207 }

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

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

Definition at line 71 of file gdcmDocEntry.h.

Referenced by gdcm::CheckVM(), and gdcm::DataEntry::IsValueCountValid().

00071 { return DicomDict->GetVM(); }

VRKey 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 66 of file gdcmDocEntry.h.

Referenced by gdcm::CheckVM(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::FileHelper::CopyDataEntry(), gdcm::File::DoTheLoadingJob(), gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntry::GetFullLength(), gdcm::DataEntry::GetString(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), gdcm::DataEntry::Print(), gdcm::DataEntry::SetString(), gdcm::DataEntry::SetValue(), and gdcm::DocEntry::WriteContent().

00066 { return DicomDict->GetVR(); }

bool gdcm::DocEntry::IsImplicitVR  )  const [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 112 of file gdcmDocEntry.h.

References gdcm::ImplicitVR.

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

00112 { 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 203 of file gdcmDocEntry.cxx.

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

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

00204 {
00205    return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
00206 }

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

tells us if entry is the first one of an Item (fffe,e000)

Definition at line 212 of file gdcmDocEntry.cxx.

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

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

00213 {
00214    return (GetGroup() == 0xfffe && GetElement() == 0xe000);
00215 }

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

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

Definition at line 221 of file gdcmDocEntry.cxx.

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

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

00222 {
00223    return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
00224 }

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

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

Returns:
true if the VM is unknown

Definition at line 120 of file gdcmDocEntry.h.

00120 { return DicomDict->IsVMUnknown(); }

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

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

Returns:
true if the VR is unknown

Definition at line 116 of file gdcmDocEntry.h.

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

00116 { return DicomDict->IsVRUnknown(); }

static SeqEntry* gdcm::SeqEntry::New DocEntry d,
int  depth
[inline, static]
 

Contructs a SeqEntry with a RefCounter from DocEntry.

Definition at line 48 of file gdcmSeqEntry.h.

00048 {return new SeqEntry(d,depth);}

static SeqEntry* gdcm::SeqEntry::New DictEntry e  )  [inline, static]
 

Contructs a SeqEntry with a RefCounter from DictEntry.

Definition at line 46 of file gdcmSeqEntry.h.

Referenced by gdcm::FileHelper::CheckMandatoryElements(), and gdcm::DocEntrySet::NewSeqEntry().

00046 {return new SeqEntry(e);}

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

canonical Printer

Reimplemented from gdcm::DocEntry.

Definition at line 272 of file gdcmSeqEntry.cxx.

References DelimitorMode, gdcmWarningMacro, gdcm::DocEntry::GetReadLength(), Items, gdcm::DocEntry::Print(), gdcm::Base::PrintLevel, SeqTerm, gdcm::Base::SetPrintLevel(), and SQDepthLevel.

00273 {
00274    // First, Print the Dicom Element itself.
00275    os << "S ";
00276    DocEntry::Print(os);
00277    os << std::endl;
00278 
00279    if (GetReadLength() == 0)
00280       return;
00281 
00282    // Then, Print each SQ Item   
00283    for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc)
00284    {
00285       (*cc)->SetPrintLevel(PrintLevel);
00286       (*cc)->Print(os);   
00287    }
00288 
00289    // at end, print the sequence terminator item, if any
00290    if (DelimitorMode)
00291    {
00292       int i;
00293       for ( i = 0; i < SQDepthLevel; i++ )
00294          os << "   | " ;
00295       os << " --- "  << std::endl;
00296       for ( i = 0; i < SQDepthLevel; i++ )
00297          os << "   | " ;
00298       if (SeqTerm != NULL)
00299       {
00300          SeqTerm->SetPrintLevel(PrintLevel);
00301          SeqTerm->Print(os);
00302          os << std::endl;
00303       } 
00304       else 
00305       {
00306          // fuse
00307          gdcmWarningMacro("  -------- should have a sequence terminator item");
00308       }
00309    }
00310 }

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(), AddSQItem(), Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and SetDelimitationItem().

00044 { RefCount++; }

void gdcm::SeqEntry::SetDelimitationItem DocEntry e  ) 
 

Sets the Sequence Delimitation Item.

Parameters:
e Delimitation item

Definition at line 221 of file gdcmSeqEntry.cxx.

References gdcm::RefCounter::Register(), SeqTerm, and gdcm::RefCounter::Unregister().

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

00222 {
00223    if( SeqTerm != e )
00224    {
00225       if( SeqTerm )
00226          SeqTerm->Unregister();
00227       SeqTerm = e;
00228       if( SeqTerm )
00229          SeqTerm->Register();
00230    }
00231 }

void gdcm::SeqEntry::SetDelimitorMode bool  dm  )  [inline]
 

Sets the delimitor mode.

Definition at line 62 of file gdcmSeqEntry.h.

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

00062 { DelimitorMode = dm; }

void gdcm::SeqEntry::SetDepthLevel int  depth  )  [inline]
 

Sets the depth level of a Sequence Entry embedded in a SeQuence.

Definition at line 70 of file gdcmSeqEntry.h.

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

00070 { SQDepthLevel = depth; }

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

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

Definition at line 108 of file gdcmDocEntry.h.

References gdcm::ImplicitVR.

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

00108 { ImplicitVR = true; }

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

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

Definition at line 92 of file gdcmDocEntry.h.

Referenced by gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::DataEntry::CopyBinArea(), gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntrySet::SetEntryBinArea(), gdcm::DataEntry::SetString(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().

00092 { 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 105 of file gdcmDocEntry.h.

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

00105 { 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 Print

Definition at line 47 of file gdcmBase.h.

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

00047 { 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 83 of file gdcmDocEntry.h.

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

00083 { ReadLength = l; }

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

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

Definition at line 74 of file gdcmDocEntry.h.

00074 { DicomDict->SetVM(v); } 

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 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(), SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().

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

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

Writes the common part of any DataEntry, SeqEntry.

Parameters:
fp already open ofstream pointer
filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...)
Todo:
allow skipping Shadow groups

Reimplemented from gdcm::DocEntry.

Definition at line 80 of file gdcmSeqEntry.cxx.

References gdcm::binary_write(), gdcm::DocEntry::GetReadLength(), Items, and gdcm::DocEntry::WriteContent().

00081 {
00082    uint16_t seq_term_gr = 0xfffe;
00083    uint16_t seq_term_el = 0xe0dd;
00084    uint32_t seq_term_lg = 0x00000000;
00085  
00086    // ignore 'Zero length' Sequences
00087    if ( GetReadLength() == 0 )
00088       return;
00089        
00090    DocEntry::WriteContent(fp, filetype);
00091    for(ListSQItem::iterator cc  = Items.begin();
00092                             cc != Items.end();
00093                           ++cc)
00094    {        
00095       (*cc)->WriteContent(fp, filetype);
00096    }
00097    
00098    // we force the writting of a Sequence Delimitation item
00099    // because we wrote the Sequence as a 'no Length' sequence
00100    binary_write(*fp, seq_term_gr);
00101    binary_write(*fp, seq_term_el);
00102    binary_write(*fp, seq_term_lg);
00103 }


Member Data Documentation

bool gdcm::SeqEntry::DelimitorMode [private]
 

If this Sequence is in delimitor mode (length =0xffffffff) or not.

Definition at line 83 of file gdcmSeqEntry.h.

Referenced by Copy(), Print(), and SeqEntry().

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

pointer to the underlying Dicom dictionary element

Definition at line 133 of file gdcmDocEntry.h.

Referenced by gdcm::DocEntry::DocEntry(), and 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 145 of file gdcmDocEntry.h.

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

ListSQItem gdcm::SeqEntry::Items [private]
 

Chained list of SQ Items.

Definition at line 86 of file gdcmSeqEntry.h.

Referenced by AddSQItem(), ClearSQItem(), ComputeFullLength(), Copy(), GetFirstSQItem(), GetNextSQItem(), GetNumberOfSQItems(), GetSQItem(), Print(), and WriteContent().

ListSQItem::iterator gdcm::SeqEntry::ItSQItem [private]
 

iterator on the SQItems of the current SeqEntry

Definition at line 88 of file gdcmSeqEntry.h.

Referenced by Copy(), GetFirstSQItem(), and GetNextSQItem().

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

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

Definition at line 137 of file gdcmDocEntry.h.

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

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

Offset from the beginning of file for direct user access.

Definition at line 148 of file gdcmDocEntry.h.

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

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(), 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().

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

Length to read in the file to obtain data.

Definition at line 140 of file gdcmDocEntry.h.

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

DocEntry* gdcm::SeqEntry::SeqTerm [private]
 

sequence terminator item

Definition at line 91 of file gdcmSeqEntry.h.

Referenced by ClearSQItem(), Copy(), Print(), SeqEntry(), and SetDelimitationItem().

int gdcm::SeqEntry::SQDepthLevel [private]
 

Defines the depth level of this SeqEntry inside the (optionaly) nested sequences. SQDepthLevel and its SQItem::SQDepthLevel counterpart are only defined on printing purposes (see Print).

Definition at line 97 of file gdcmSeqEntry.h.

Referenced by Copy(), Print(), and SeqEntry().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 10:15:08 2006 for gdcm by  doxygen 1.4.4