1 /*=========================================================================
4 Module: $RCSfile: gdcmSeqEntry.cxx,v $
6 Date: $Date: 2004/06/22 13:59:48 $
7 Version: $Revision: 1.15 $
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)
49 std::cout << "delete SQItem" <<std:: endl;
55 //-----------------------------------------------------------------------------
58 * \ingroup gdcmSeqEntry
59 * \brief canonical Printer
61 void gdcmSeqEntry::Print(std::ostream &os){
63 std::ostringstream s,s2;
65 // First, Print the Dicom Element itself.
71 if (GetReadLength() == 0)
74 // Then, Print each SQ Item
75 for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
80 // at end, print the sequence terminator item, if any
82 for (int i=0;i<SQDepthLevel+1;i++)
85 if (seq_term != NULL) {
90 << " -------------- should have a sequence terminator item"
97 * \brief canonical Writer
99 void gdcmSeqEntry::Write(FILE *fp, FileType filetype) {
100 for(ListSQItem::iterator cc = GetSQItems().begin();
101 cc != GetSQItems().end();
103 std::cout << "Et un SQItem !" << std::endl;
104 (*cc)->Write(fp, filetype);
107 //-----------------------------------------------------------------------------
110 /// \brief adds the passed ITEM to the ITEM chained List for this SeQuence.
111 void gdcmSeqEntry::AddEntry(gdcmSQItem *sqItem, int itemNumber) {
112 sqItem->SetSQItemNumber(itemNumber);
113 items.push_back(sqItem);
116 /// \brief Sets the depth level of a Sequence Entry embedded in a SeQuence
117 void gdcmSeqEntry::SetDepthLevel(int depth) {
118 SQDepthLevel = depth;
121 /// \brief return a pointer to th SQItem referenced by its ordinal number
122 /// (returns the first one if ordinal number is <0
123 /// returns the last one if ordinal number is > item number
125 gdcmSQItem *gdcmSeqEntry::GetSQItemByOrdinalNumber(int nb) {
127 return (*(items.begin()));
129 for(ListSQItem::iterator cc = items.begin();
135 return (*(items.end()));
137 //-----------------------------------------------------------------------------
141 //-----------------------------------------------------------------------------
144 //-----------------------------------------------------------------------------