+2004-06-20 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+ * In order to fix memory leaks:
+ - Test/TestWriteSimple.cxx: added cleaning of free store through
+ some delete calls.
+ - src/gdcmBinEntry.cxx: fix to avoid SegFault.
+ - src/gdcmDicomDir.[cxx|h]: fixed initialisation in constructor
+ gdcmDicomDir::gdcmDicomDir(bool) [either the constructor itself
+ (through the call to ::AddDicomDirMeta()) or the destructor
+ would crash when deleting uninitialized ::metaElems].
+ - src/gdcmDictEntry.cxx: annotation of ununderstood memory leak.
+ - src/gdcmDocument.cxx:
+ -- ::~gdcmDocument() destructor now cleans up all dictionary entries
+ from dynamic stores.
+ -- ::ParseDES() misplaced deletion of temporary NewDocEntry
+ was causing memory leaks.
+ - src/gdcmSQItem.cxx:
+ -- ::~gdcmSQItem() dummy code cleaned (learned that deletion is
+ cleanly handled with polymophism: sorry but my milage is low).
+ -- ::SetEntryByNumber(string, guint16, guint16) now cleanly allocates
+ a gdcmValENtry, and makes no assumption on type (gdcmDocEntry,
+ gdcmSeqEntry vs gdcmValEntry) of existing entry (when present).
+ This avoids SegFaulting.
+ - src/gdcmSQItem.h: coding style.
+ * Conclusion:
+ - Test/TestWriteSimple still severely sucks. The output image content
+ (when $(GDCMDATA_HOME)/012345.002.050.dcm in input) is brain
+ damaged when displayed with vtkgdcmViewer.
+ - on memory leaks: TestWriteSimple leaks really less (see entry
+ of 2004-06-18 in Changelog file for the call to valgrind).
+ - on segfaults: ctest now passes all the tests but one (no more
+ segfaults).
+
2004-06-18 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
* In order to fix writing of dicom files:
- Test/TestWriteSimple.cxx: a simpler example of writing.
const char *header = argv[1];
const char *output = argv[2];
- dbg.SetDebug(4);
gdcmHeader *f1 = new gdcmHeader( header );
gdcmFile *f2 = new gdcmFile( f1 );
- f2->GetImageData(); //EXTREMELY IMPORTANT
+ // If the following call is important, then the API sucks. Why is it
+ // required to allocate PixelData when we are not using it !?
+ void* PixelData = f2->GetImageData(); //EXTREMELY IMPORTANT
//Otherwise ReadPixel == -1 -> the dicom writing fails completely
int dataSize = f2->GetImageDataSize();
f2->WriteDcmExplVR( output );
delete[] imageData;
+ delete f1;
+ delete f2;
+ delete PixelData;
return 0;
}
Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2004/06/18 12:26:54 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2004/06/19 23:51:03 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief Constructor from a given gdcmBinEntry
*/
gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e) {
-
+ this->voidArea = NULL;
}
/**
* \brief Canonical destructor.
*/
gdcmBinEntry::~gdcmBinEntry(){
- free (voidArea);
+ if (voidArea)
+ free (voidArea);
}
-// gdcmDicomDir.cxx
-//-----------------------------------------------------------------------------
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmDicomDir.cxx,v $
+ Language: C++
+ Date: $Date: 2004/06/19 23:51:03 $
+ Version: $Revision: 1.48 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
#include <string>
#include <algorithm>
#include <sys/types.h>
// For full DICOMDIR description, see:
// PS 3.3-2003, pages 731-750
//-----------------------------------------------------------------------------
+// Constructor / Destructor
+void gdcmDicomDir::Initialize(void)
+{
+ startMethod = NULL;
+ progressMethod = NULL;
+ endMethod = NULL;
+ startMethodArgDelete = NULL;
+ progressMethodArgDelete = NULL;
+ endMethodArgDelete = NULL;
+ startArg = NULL;
+ progressArg = NULL;
+ endArg = NULL;
+
+ progress = 0.0;
+ abort = false;
+
+ metaElems = (gdcmDicomDirMeta *)0;
+}
-// Constructor / Destructor
/**
* \brief Constructor Parses recursively the directory and creates the DicomDir
bool exception_on_error):
gdcmDocument(FileName,exception_on_error,true) // true : enable SeQuences
{
- // que l'on ai passe un root directory ou un DICOMDIR
- // et quelle que soit la valeur de parseDir,
- // on a lance gdcmDocument
-
- startMethod= NULL;
- progressMethod= NULL;
- endMethod= NULL;
- startMethodArgDelete= NULL;
- progressMethodArgDelete=NULL;
- endMethodArgDelete= NULL;
- startArg= NULL;
- progressArg= NULL;
- endArg= NULL;
-
- progress=0.0;
- abort=false;
-
- metaElems=NULL;
+ // que l'on ai passe un root directory ou un DICOMDIR
+ // et quelle que soit la valeur de parseDir,
+ // on a lance gdcmDocument
+ Initialize();
// gdcmDocument already executed
// if user passed a root directory, sure we didn't get anything
gdcmDicomDir::gdcmDicomDir(bool exception_on_error):
gdcmDocument(exception_on_error)
{
- startMethod= NULL;
- progressMethod= NULL;
- endMethod= NULL;
- startMethodArgDelete= NULL;
- progressMethodArgDelete=NULL;
- endMethodArgDelete= NULL;
- startArg= NULL;
- progressArg= NULL;
- endArg= NULL;
- progress=0.0;
- abort=false;
+ Initialize();
std::string pathBidon = "Bidon"; // Sorry, NULL not allowed ...
SetElement(pathBidon, GDCM_DICOMDIR_META, NULL); // Set the META elements
AddDicomDirMeta();
}
-
/**
- * \ingroup gdcmDicomDir
* \brief Canonical destructor
*/
gdcmDicomDir::~gdcmDicomDir()
if(metaElems)
delete metaElems;
- for(ListDicomDirPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
+ for(ListDicomDirPatient::iterator cc = patients.begin();
+ cc!= patients.end();
+ ++cc)
{
delete *cc;
}
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDicomDir
* \brief Canonical Printer
*/
void gdcmDicomDir::Print(std::ostream &os)
metaElems->SetPrintLevel(printLevel);
metaElems->Print(os);
}
- for(ListDicomDirPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
+ for(ListDicomDirPatient::iterator cc = patients.begin();
+ cc != patients.end();
+ ++cc)
{
(*cc)->SetPrintLevel(printLevel);
(*cc)->Print(os);
//-----------------------------------------------------------------------------
// Public
/**
- * \ingroup gdcmDicomDir
* \brief This predicate, based on hopefully reasonable heuristics,
* decides whether or not the current header was properly parsed
* and contains the mandatory information for being considered as
-// gdcmDicomDir.h
-//-----------------------------------------------------------------------------
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmDicomDir.h,v $
+ Language: C++
+ Date: $Date: 2004/06/19 23:51:03 $
+ Version: $Revision: 1.22 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
#ifndef GDCMDICOMDIR_H
#define GDCMDICOMDIR_H
-//#include "gdcmHeader.h"
#include "gdcmCommon.h"
#include "gdcmDocument.h"
#include "gdcmDicomDirPatient.h"
void CallEndMethod(void);
private:
+ void Initialize(void);
void CreateDicomDir(void);
// void AddObjectToEnd(gdcmDicomDirType type, gdcmSQItem *s);
void AddDicomDirMeta ();
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmDictEntry
* \brief Constructor
* @param InGroup DICOM-Group Number
* @param InElement DICOM-Element Number
gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement,
std::string InVr, std::string InFourth,
- std::string InName) {
- group = InGroup;
- element = InElement;
- vr = InVr;
- fourth = InFourth;
- name = InName;
- key = TranslateToKey(group, element);
+ std::string InName)
+{
+ group = InGroup;
+ element = InElement;
+ vr = InVr;
+ fourth = InFourth;
+ name = InName;
+ key = TranslateToKey(group, element); /// \todo Frog MEMORY LEAK.
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Public
/**
- * \ingroup gdcmDictEntry
* \brief concatenates 2 guint16 (supposed to be a Dicom group number
* and a Dicom element number)
* @param group the Dicom group number used to build the tag
* @param element the Dicom element number used to build the tag
* @return the built tag
*/
-
-TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) {
+TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element)
+{
char trash[10];
TagKey key;
// CLEANME: better call the iostream<< with the hex manipulator on.
}
/**
- * \ingroup gdcmDictEntry
* \brief If-and only if-the V(alue) R(epresentation)
* \ is unset then overwrite it.
* @param NewVr New V(alue) R(epresentation) to be set.
/// \brief adds any type of entry to the entry set (pure vitual)
virtual bool AddEntry(gdcmDocEntry *Entry) = 0; // pure virtual
- //FIXME bool CheckEntryVR(gdcmDocEntry *Entry, std::string vr);
/// \brief prints any type of entry to the entry set (pure vitual)
virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
- /// \brief Gets the depth level of a Dicom Header Entry embedded in a SeQuence
- inline int GetDepthLevel(void)
- {return(SQDepthLevel);}
+ /// \brief Gets the depth level of a Dicom Header Entry embedded in a
+ /// SeQuence
+ inline int GetDepthLevel(void) {return(SQDepthLevel);}
- /// \brief Sets the depth level of a Dicom Header Entry embedded in a SeQuence
- inline void SetDepthLevel(int depth)
- {SQDepthLevel = depth;}
+ /// \brief Sets the depth level of a Dicom Header Entry embedded in a
+ /// SeQuence
+ inline void SetDepthLevel(int depth) {SQDepthLevel = depth;}
protected:
-
-// void gdcmDocEntrySet::FindDocEntryLength (gdcmDocEntry *Entry);
-
- // DocEntry related utilities
-
- /// \brief Build a new Element Value from all the low level arguments.
- /// Check for existence of dictionary entry, and build
- /// a default one when absent (pure virtual)
+ /// \brief Build a new Element Value from all the low level arguments.
+ /// Check for existence of dictionary entry, and build
+ /// a default one when absent (pure virtual)
virtual gdcmDocEntry *NewDocEntryByNumber(guint16 group,
guint16 element)=0; // pure virtual
- /// \brief Build a new Element Value from all the low level arguments.
- /// Check for existence of dictionary entry, and build
- /// a default one when absent (pure virtual)
- virtual gdcmDocEntry *NewDocEntryByName (std::string Name)=0;// pure virtual
-
+ /// \brief Build a new Element Value from all the low level arguments.
+ /// Check for existence of dictionary entry, and build
+ /// a default one when absent (pure virtual)
+ virtual gdcmDocEntry *NewDocEntryByName (std::string Name)=0;// pure virtual
/// Gives the depth level of the element set inside SeQuences
int SQDepthLevel;
// Recursive clean up of sequences
for (TagDocEntryHT::iterator it = tagHT.begin(); it != tagHT.end(); ++it )
{
- gdcmDocEntry * entry = it->second;
- if ( gdcmSeqEntry* SeqEntry = dynamic_cast<gdcmSeqEntry*>(entry) )
- {
- delete SeqEntry;
- RemoveEntry(SeqEntry);
- }
- else
- {
- RemoveEntry(entry);
- }
+ delete (it->second);
}
tagHT.clear();
}
* \return pointer to the modified/created Header Entry (NULL when creation
* failed).
*/
-
-
gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
void *voidArea,
int lgth,
guint16 Group,
- guint16 Elem ){
+ guint16 Elem)
+{
gdcmDocEntry* a;
gdcmBinEntry* b;
a = GetDocEntryByNumber( Group, Elem);
long gdcmDocument::ParseDES(gdcmDocEntrySet *set, long offset, long l_max, bool delim_mode) {
gdcmDocEntry *NewDocEntry = (gdcmDocEntry *)0;
- gdcmValEntry *vl;
+ gdcmValEntry *NewValEntry = (gdcmValEntry *)0;
gdcmBinEntry *bn;
gdcmSeqEntry *sq;
VRKey vr;
break;
vr = NewDocEntry->GetVR();
- if (vr!="SQ") {
+ if (vr!="SQ")
+ {
if ( gdcmGlobal::GetVR()->IsVROfGdcmStringRepresentable(vr) )
{
/////// ValEntry
- vl= new gdcmValEntry(NewDocEntry->GetDictEntry());
- vl->Copy(NewDocEntry);
- vl->SetDepthLevel(depth);
- set->AddEntry(vl);
- LoadDocEntry(vl);
- if (/*!delim_mode && */vl->isItemDelimitor())
+ NewValEntry = new gdcmValEntry(NewDocEntry->GetDictEntry());
+ NewValEntry->Copy(NewDocEntry);
+ NewValEntry->SetDepthLevel(depth);
+ set->AddEntry(NewValEntry);
+ LoadDocEntry(NewValEntry);
+ if (/*!delim_mode && */NewValEntry->isItemDelimitor())
break;
if ( !delim_mode && ftell(fp)-offset >= l_max)
{
SkipToNextDocEntry(NewDocEntry);
l = NewDocEntry->GetFullLength();
}
- } else { // VR = "SQ"
+ }
+ else
+ { // VR = "SQ"
l=NewDocEntry->GetReadLength();
if (l != 0) // don't mess the delim_mode for zero-length sequence
break;
}
}
+ delete NewDocEntry;
}
- delete NewDocEntry;
return l; // ??
}
* the value specified with gdcmDocument::SetMaxSizeLoadEntry()
* @param Entry Header Entry (Dicom Element) to be dealt with
*/
-void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) {
+void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry)
+{
size_t item_read;
guint16 group = Entry->GetGroup();
std::string vr= Entry->GetVR();
// header parsing has to be considered as finished.
return (gdcmDocEntry *)0;
-// Pb : how to propagate the element length (used in SkipDocEntry)
-// direct call to SkipBytes ?
-
-// if (ignoreShadow == 1 && g%2 ==1)
- // if user wants to skip shadow groups
- // and current element *is* a shadow element
- // we don't create anything
-// return (gdcmDocEntry *)1; // to tell caller it's NOT finished
-
NewEntry = NewDocEntryByNumber(g, n);
FindDocEntryVR(NewEntry);
FindDocEntryLength(NewEntry);
* @param Group group number of the underlying DictEntry
* @param Elem element number of the underlying DictEntry
*/
-gdcmDocEntry *gdcmDocument::NewDocEntryByNumber(guint16 Group, guint16 Elem)
+gdcmDocEntry* gdcmDocument::NewDocEntryByNumber(guint16 Group, guint16 Elem)
{
// Find out if the tag we encountered is in the dictionaries:
gdcmDictEntry *DictEntry = GetDictEntryByNumber(Group, Elem);
{
dbg.Verbose(1, "gdcmDocument::NewDocEntryByNumber",
"failed to allocate gdcmDocEntry");
- return NULL;
+ return (gdcmDocEntry*)0;
}
return NewEntry;
}
if(tagHT.count(key) == 1)
{
tagHT.erase(key);
- dbg.Verbose(1, "gdcmElementSet::RemoveEntry: one element erased.");
+ dbg.Verbose(0, "gdcmElementSet::RemoveEntry: one element erased.");
return true;
}
-// gdcmSQItem.cxx
-//-----------------------------------------------------------------------------
-//
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmSQItem.cxx,v $
+ Language: C++
+ Date: $Date: 2004/06/19 23:51:04 $
+ Version: $Revision: 1.10 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
#include "gdcmSQItem.h"
#include "gdcmSeqEntry.h"
+#include "gdcmValEntry.h"
+#include "gdcmBinEntry.h"
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
-#include "gdcmValEntry.h"
-
+#include "gdcmDebug.h"
//-----------------------------------------------------------------------------
// Constructor / Destructor
cc != docEntries.end();
++cc)
{
- gdcmDocEntry* DocEntry = *cc;
- if ( gdcmSeqEntry* SeqEntry = dynamic_cast<gdcmSeqEntry*>(DocEntry) )
- {
- delete SeqEntry;
- }
- else
- {
- delete DocEntry;
- }
+ delete (*cc);
}
docEntries.clear();
}
-
//-----------------------------------------------------------------------------
// Print
/*
- * \ingroup gdcmSQItem
* \brief canonical Printer
*/
void gdcmSQItem::Print(std::ostream & os) {
/**
* \brief adds any Entry (Dicom Element) to the Sequence Item
*/
-bool gdcmSQItem::AddEntry(gdcmDocEntry *entry) {
+bool gdcmSQItem::AddEntry(gdcmDocEntry *entry)
+{
docEntries.push_back(entry);
//TODO : check if it worked
return true;
}
-
/**
* \brief Sets Entry (Dicom Element) value of an element,
* specified by it's tag (Group, Number)
* @param element Element of the searched tag.
* @return true if element was found or created successfully
*/
- bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group,
- guint16 element) {
-
- for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
+bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group,
+ guint16 element)
+{
+ for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
+ {
if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0xe000 )
continue;
- if ( group < (*i)->GetGroup() ||
- (group == (*i)->GetGroup() && element < (*i)->GetElement()) ){
- // instead of ReplaceOrCreateByNumber
- // that is a method of gdcmDocument :-(
- gdcmDocEntry *Entry;
+ if ( ( group < (*i)->GetGroup() )
+ ||( group == (*i)->GetGroup() && element < (*i)->GetElement()) )
+ {
+ // instead of ReplaceOrCreateByNumber
+ // that is a method of gdcmDocument :-(
+ gdcmValEntry* Entry = (gdcmValEntry*)0;
TagKey key = gdcmDictEntry::TranslateToKey(group, element);
- if ( ! ptagHT->count(key)) {
- // we assume a Public Dictionnary *is* loaded
- gdcmDict *PubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- // if the invoked (group,elem) doesn't exist inside the Dictionary
- // we create a VirtualDictEntry
- gdcmDictEntry *DictEntry = PubDict->GetDictEntryByNumber(group, element);
- if (DictEntry == NULL) {
- DictEntry=gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,"UN","??","??");
- }
- // we assume the constructor didn't fail
- Entry = new gdcmDocEntry(DictEntry);
- /// \todo
- /// ----
- /// better we don't assume too much !
- /// gdcmSQItem is now used to describe any DICOMDIR related object
- ///
+ if ( ! ptagHT->count(key))
+ {
+ // we assume a Public Dictionnary *is* loaded
+ gdcmDict *PubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+ // if the invoked (group,elem) doesn't exist inside the Dictionary
+ // we create a VirtualDictEntry
+ gdcmDictEntry *DictEntry = PubDict->GetDictEntryByNumber(group,
+ element);
+ if (DictEntry == NULL)
+ {
+ DictEntry=gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,
+ element,
+ "UN",
+ "??","??");
+ }
+ // we assume the constructor didn't fail
+ Entry = new gdcmValEntry(DictEntry);
+ /// \todo
+ /// ----
+ /// better we don't assume too much !
+ /// gdcmSQItem is now used to describe any DICOMDIR related object
} else {
- Entry = ptagHT->find(key)->second;
+ gdcmDocEntry* FoundEntry = ptagHT->find(key)->second;
+ Entry = dynamic_cast<gdcmValEntry*>(FoundEntry);
+ if (!Entry)
+ dbg.Verbose(0, "gdcmSQItem::SetEntryByNumber: docEntries"
+ " contains non gdcmValEntry occurences");
}
- ((gdcmValEntry*)Entry)->SetValue(val);
+ if (Entry)
+ Entry->SetValue(val);
Entry->SetLength(val.length());
docEntries.insert(i,Entry);
- return true;
- }
- if (group == (*i)->GetGroup() && element == (*i)->GetElement() ) {
- ((gdcmValEntry*)(*i))->SetValue(val);
+ return true;
+ }
+ if (group == (*i)->GetGroup() && element == (*i)->GetElement() )
+ {
+ if ( gdcmValEntry* Entry = dynamic_cast<gdcmValEntry*>(*i) )
+ Entry->SetValue(val);
(*i)->SetLength(val.length());
return true;
- }
- }
-}
+ }
+ }
+}
//-----------------------------------------------------------------------------
// Protected
/// \brief to be written if really usefull
gdcmDocEntry *gdcmSQItem::NewDocEntryByNumber(guint16 group,
guint16 element) {
-// TODO
+/// \todo TODO
gdcmDocEntry *a;
std::cout << " gdcmSQItem::NewDocEntryByNumber : TODO" <<std::endl;
return a;
/// \brief to be written if really usefull
gdcmDocEntry *gdcmSQItem::NewDocEntryByName (std::string Name) {
-// TODO
+/// \todo TODO
gdcmDocEntry *a;
std::cout << " gdcmSQItem::NewDocEntryByName : TODO" <<std::endl;
return a;
}
/**
- * \ingroup gdcmSQItem
* \brief Gets a Dicom Element inside a SQ Item Entry, by name
* @return
*/
-// gdcmSQItem.h
-//-----------------------------------------------------------------------------
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmSQItem.h,v $
+ Language: C++
+ Date: $Date: 2004/06/19 23:51:04 $
+ Version: $Revision: 1.8 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
#ifndef GDCMSQITEM_H
#define GDCMSQITEM_H
#include <list>
-
#include "gdcmDocEntry.h"
#include "gdcmDocEntrySet.h"
#include "gdcmDocument.h"
+
//-----------------------------------------------------------------------------
typedef std::list<gdcmDocEntry *> ListDocEntry;
//-----------------------------------------------------------------------------
virtual void Print(std::ostream &os = std::cout);
- /// \brief returns the DocEntry chained List for this SQ Item.
- inline ListDocEntry &GetDocEntries()
- {return docEntries;};
+ /// \brief returns the DocEntry chained List for this SQ Item.
+ inline ListDocEntry &GetDocEntries() {return docEntries;};
- /// \brief adds the passed DocEntry to the DocEntry chained List for this SQ Item.
- inline void AddDocEntry(gdcmDocEntry *e)
- {docEntries.push_back(e);};
+ /// \brief adds the passed DocEntry to the DocEntry chained List for
+ /// this SQ Item.
+ inline void AddDocEntry(gdcmDocEntry *e) {docEntries.push_back(e);};
virtual bool AddEntry(gdcmDocEntry *Entry); // add to the List
- gdcmDocEntry *GetDocEntryByNumber(guint16 group,
- guint16 element);
+ gdcmDocEntry *GetDocEntryByNumber(guint16 group, guint16 element);
gdcmDocEntry *GetDocEntryByName (std::string Name);
- bool SetEntryByNumber(std::string val,guint16 group,
- guint16 element);
+ bool SetEntryByNumber(std::string val,guint16 group, guint16 element);
std::string GetEntryByNumber(guint16 group, guint16 element);
std::string GetEntryByName(TagName name);
- inline int GetSQItemNumber()
- { return SQItemNumber;};
+ inline int GetSQItemNumber() { return SQItemNumber;};
- inline void SetSQItemNumber(int itemNumber)
- { SQItemNumber=itemNumber;};
+ inline void SetSQItemNumber(int itemNumber) { SQItemNumber=itemNumber;};
protected:
- // DocEntry related utilities
+// DocEntry related utilities
virtual gdcmDocEntry *NewDocEntryByNumber(guint16 group,
guint16 element); // TODO
// Variables
-/// \brief chained list of (Elementary) Doc Entries
- ListDocEntry docEntries;
+ /// \brief chained list of (Elementary) Doc Entries
+ ListDocEntry docEntries;
-/// \brief SQ Item ordinal number
- int SQItemNumber;
+ /// \brief SQ Item ordinal number
+ int SQItemNumber;
-
-///\brief pointer to the HTable of the gdcmDocument,
-/// (because we don't know it within any gdcmObject nor any gdcmSQItem)
- TagDocEntryHT *ptagHT;
+ ///\brief pointer to the HTable of the gdcmDocument,
+ /// (because we don't know it within any gdcmObject nor any gdcmSQItem)
+ TagDocEntryHT *ptagHT;
private:
};
-
//-----------------------------------------------------------------------------
#endif
-