1 /*=========================================================================
4 Module: $RCSfile: gdcmSeqEntry.cxx,v $
6 Date: $Date: 2004/06/21 04:43:02 $
7 Version: $Revision: 1.13 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmSeqEntry.h"
20 #include "gdcmSQItem.h"
22 #include "gdcmGlobal.h"
27 //-----------------------------------------------------------------------------
28 // Constructor / Destructor
30 * \ingroup gdcmSeqEntry
31 * \brief Constructor from a given gdcmSeqEntry
33 gdcmSeqEntry::gdcmSeqEntry(gdcmDictEntry* e, int depth)
36 delimitor_mode = false;
42 * \ingroup gdcmSeqEntry
43 * \brief Canonical destructor.
45 gdcmSeqEntry::~gdcmSeqEntry() {
46 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
54 //-----------------------------------------------------------------------------
57 * \ingroup gdcmSeqEntry
58 * \brief canonical Printer
60 void gdcmSeqEntry::Print(std::ostream &os){
62 std::ostringstream s,s2;
64 //unsigned short int g, e; //not used
65 //long lgth; //not used
66 //size_t o; //not used
67 //char greltag[10]; //group element tag //not used
68 //char st[20]; //not used
70 // First, Print the Dicom Element itself.
76 // Then, Print each SQ Item
77 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
81 // at end, print the sequence terminator item, if any
85 for (int i=0;i<SQDepthLevel;i++)
89 if (seq_term != NULL) {
94 << " -------------- should have a sequence terminator item"
99 //-----------------------------------------------------------------------------
102 /// \brief adds the passed ITEM to the ITEM chained List for this SeQuence.
103 void gdcmSeqEntry::AddEntry(gdcmSQItem *sqItem, int itemNumber) {
104 sqItem->SetSQItemNumber(itemNumber);
105 items.push_back(sqItem);
108 /// \brief Sets the depth level of a Sequence Entry embedded in a SeQuence
109 void gdcmSeqEntry::SetDepthLevel(int depth) {
110 SQDepthLevel = depth;
113 /// \brief return a pointer to th SQItem referenced by its ordinal number
114 /// (returns the first one if ordinal number is <0
115 /// returns the last one if ordinal number is > item number
117 gdcmSQItem *gdcmSeqEntry::GetSQItemByOrdinalNumber(int nb) {
119 return (*(items.begin()));
121 for(ListSQItem::iterator cc = items.begin();
127 return (*(items.end()));
129 //-----------------------------------------------------------------------------
133 //-----------------------------------------------------------------------------
136 //-----------------------------------------------------------------------------