table.
* src/gdcmElementSet.[h|cxx] : rename Initialize into InitTraversal
* src/gdcmDict.[h|cxx] : add InitTraversal/getNextEntry methods to parse
all the dict content.
* src/gdcmDictEntry.cxx : add a carriage return at the end of the DictEntry
print
* Test/TestDict.cxx : add a new test for the dict classes
-- BeNours
+2005-01-14 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmDocument.[h|cxx] : comment all methods concerning a flat hash
+ table.
+ * src/gdcmElementSet.[h|cxx] : rename Initialize into InitTraversal
+ * src/gdcmDict.[h|cxx] : add InitTraversal/getNextEntry methods to parse
+ all the dict content.
+ * src/gdcmDictEntry.cxx : add a carriage return at the end of the DictEntry
+ print
+ * Test/TestDict.cxx : add a new test for the dict classes
+
2005-01-13 Mathieu Malaterre <Mathieu.Malaterre@creatis.insa-lyon.fr>
* src/gdcmDebug.h : Adding an option to redirect debug stream to a
file. Debug is yanked if compiled with NDEBUG
Program: gdcm
Module: $RCSfile: FlatHashTablePrint.cxx,v $
Language: C++
- Date: $Date: 2004/12/03 20:16:55 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2005/01/14 11:28:28 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
int main(int argc, char* argv[])
{
- if (argc < 2)
+/* if (argc < 2)
{
std::cerr << "Usage :" << std::endl <<
argv[0] << " input_dicom " << std::endl;
{
tag->second->Print();
std::cout << std::endl;
- }
+ }*/
+ std::cout<<"Usefull example ???\n";
return 0;
}
Program: gdcm
Module: $RCSfile: TestCopyDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:57 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2005/01/14 11:28:28 $
+ Version: $Revision: 1.16 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcm::File *copy = new gdcm::File( output );
- const gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetTagHT();
-
size_t dataSize = original->GetImageDataSize();
uint8_t* imageData = original->GetImageData();
(void)imageData;
// (the user does NOT have to know the way we implemented the Header !)
// Waiting for a 'clean' solution, I keep the method ...JPRx
- gdcm::DocEntry* d;
-
- for (gdcm::TagDocEntryHT::const_iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
+ original->GetHeader()->InitTraversal();
+ gdcm::DocEntry* d=original->GetHeader()->GetNextEntry();
+ while(d)
{
- d = tag->second;
- d->Print(); std::cout << std::endl;
if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
{
copy->GetHeader()->ReplaceOrCreate(
// << d->GetGroup() << " " << d->GetElement()
// << std::endl;
}
- }
-
-
-
+ d=original->GetHeader()->GetNextEntry();
+ }
//copy->GetImageData();
//copy->SetImageData(imageData, dataSize);
Program: gdcm
Module: $RCSfile: TestFromScratch.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:57 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/01/14 11:28:28 $
+ 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
// Hopefully default to something
gdcm::Header *h2 = new gdcm::Header();
- h1->Initialize();
- gdcm::DocEntry* d = h1->GetNextEntry();
-
// Copy of the header content
+ h1->InitTraversal();
+ gdcm::DocEntry* d = h1->GetNextEntry();
while(d)
{
if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
TestVR.cxx
TestUtil.cxx
TestDicomString.cxx
+ TestDict.cxx
)
# add tests that require data
TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h
TestAllEntryVerify.cxx # includes generated gdcmDataImages.h
#TestChangeHeader.cxx
- TestDicomDir.cxx # require DICOMDIR
- BuildUpDicomDir.cxx # writes a file named "NewDICOMDIR"
- makeDicomDir.cxx # writes a file named "NewDICOMDIR"
TestCopyDicom.cxx
TestCopyRescaleDicom.cxx
TestWriteSimple.cxx
+ TestDicomDir.cxx # require DICOMDIR
+ BuildUpDicomDir.cxx # writes a file named "NewDICOMDIR"
+ makeDicomDir.cxx # writes a file named "NewDICOMDIR"
)
# add test that require VTK:
IF(GDCM_VTK)
Program: gdcm
Module: $RCSfile: TestCopyDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:58 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2005/01/14 11:28:29 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//////////////// Step 2:
std::cout << "2...";
- originalH->Initialize();
+ originalH->InitTraversal();
gdcm::DocEntry* d=originalH->GetNextEntry();
-
while(d)
{
if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
Program: gdcm
Module: $RCSfile: TestCopyRescaleDicom.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:58 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2005/01/14 11:28:29 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//////////////// Step 2:
std::cout << "2...";
- originalH->Initialize();
- gdcm::DocEntry* d = originalH->GetNextEntry();
-
// Copy of the header content
+ originalH->InitTraversal();
+ gdcm::DocEntry* d = originalH->GetNextEntry();
while(d)
{
if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: TestDict.cxx,v $
+ Language: C++
+ Date: $Date: 2005/01/14 11:28:29 $
+ Version: $Revision: 1.1 $
+
+ 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.html 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 "gdcmGlobal.h"
+#include "gdcmDictSet.h"
+#include "gdcmDict.h"
+#include "gdcmDictEntry.h"
+
+#include <iostream>
+#include <iomanip>
+
+int TestDict(int argc, char* argv[])
+{
+ // Print the DictSet
+ std::cout<<"#######################################################\n";
+ gdcm::DictSet *dicts=gdcm::Global::GetDicts();
+ if(!dicts)
+ {
+ std::cout<<"The DictSet hasn't be found... Failed\n";
+ return(1);
+ }
+ std::cout<<"DictSet content :\n";
+// dicts->Print(std::cout);
+
+ // Print the Dict (public)
+ std::cout<<"#######################################################\n";
+ gdcm::Dict *pubDict=dicts->GetDefaultPubDict();
+ if(!pubDict)
+ {
+ std::cout<<"The public Dict hasn't be found... Failed\n";
+ return(1);
+ }
+ std::cout<<"Public Dict content :\n";
+// pubDict->Print(std::cout);
+
+ // Print the DictEntry (0x10,0x20)
+ std::cout<<"#######################################################\n";
+ const int ENTRY_GR = 0x10;
+ const int ENTRY_EL = 0x20;
+ std::string key=gdcm::DictEntry::TranslateToKey(ENTRY_GR,ENTRY_EL);
+ gdcm::DictEntry *entry=pubDict->GetDictEntry(ENTRY_GR,ENTRY_EL);
+ if(!entry)
+ {
+ std::cout<<"The DictEntry hasn't be found... Failed\n";
+ return(1);
+ }
+ std::cout<<"Entry "<<key<<" content :\n";
+ entry->Print(std::cout);
+
+ // Print all the DictEntry
+ std::cout<<"#######################################################\n";
+ pubDict->InitTraversal();
+ entry=pubDict->GetNextEntry();
+ while(entry)
+ {
+ entry->Print(std::cout);
+ entry=pubDict->GetNextEntry();
+ }
+
+ return(0);
+}
print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL)
entry.Print()
-# Print the DictEntry (0010|0010)
-ENTRY_GR = 0x10
-ENTRY_EL = 0x10
-entry=pubDict.GetDictEntry(ENTRY_GR,ENTRY_EL)
-if(not isinstance(entry,gdcm.DictEntry)):
- raise RuntimeError,"The entry (%04x|%04x) hasn't the good type (%s)" % \
- (ENTRY_GR,ENTRY_EL,type(entry))
-print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL)
-entry.Print()
+print "#####################################################################"
+# Print the public Dict content
+print "dict content :"
+pubDict.InitTraversal()
+entry=pubDict.GetNextEntry()
+while(entry):
+ entry.Print()
+ entry=pubDict.GetNextEntry()
Program: gdcm
Module: $RCSfile: gdcmDict.cxx,v $
Language: C++
- Date: $Date: 2005/01/12 15:23:44 $
- Version: $Revision: 1.62 $
+ Date: $Date: 2005/01/14 11:28:30 $
+ Version: $Revision: 1.63 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void FillDefaultDataDict(Dict *d);
//-----------------------------------------------------------------------------
// Constructor / Destructor
+/**
+ * \brief Constructor
+ */
+Dict::Dict(void)
+{
+ Filename="";
+}
+
/**
* \brief Constructor
* @param filename from which to build the dictionary.
*/
Dict::~Dict()
{
- // we assume all the pointed DictEntries are already cleaned-up
- // when we clean KeyHt.
- KeyHt.clear();
+ ClearEntry();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Public
+/**
+ * \ingroup Dict
+ * \brief Remove all Dicom Dictionary Entries
+ */
+void Dict::ClearEntry()
+{
+ // we assume all the pointed DictEntries are already cleaned-up
+ // when we clean KeyHt.
+ KeyHt.clear();
+}
+
/**
* \ingroup Dict
* \brief adds a new Dicom Dictionary Entry
// return result;
//}
+/**
+ * \brief Initialise the visit of the Hash table (KeyHt)
+ */
+void Dict::InitTraversal()
+{
+ ItKeyHt = KeyHt.begin();
+}
+
+/**
+ * \brief Get the next entry whil visiting the Hash table (KeyHt)
+ * \return The next DictEntry if found, otherwhise NULL
+ */
+DictEntry *Dict::GetNextEntry()
+{
+ if (ItKeyHt != KeyHt.end())
+ {
+ DictEntry *tmp = &(ItKeyHt->second);
+ ++ItKeyHt;
+
+ return tmp;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
//-----------------------------------------------------------------------------
// Protected
Program: gdcm
Module: $RCSfile: gdcmDict.h,v $
Language: C++
- Date: $Date: 2005/01/11 15:15:38 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2005/01/14 11:28:30 $
+ Version: $Revision: 1.31 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class GDCM_EXPORT Dict : public Base
{
public:
+ Dict(void);
Dict(std::string const & filename);
~Dict();
void Print(std::ostream &os = std::cout);
// Entries
+ void ClearEntry ();
bool AddNewEntry (DictEntry const &newEntry);
bool ReplaceEntry(DictEntry const &newEntry);
bool RemoveEntry (TagKey const &key);
/// \brief Returns a ref to the Dicom Dictionary H table (map)
/// @return the Dicom Dictionary H table
- const TagKeyHT & GetEntriesByKey() const { return KeyHt; }
+ //const TagKeyHT & GetEntries() const { return KeyHt; }
+
+ void InitTraversal();
+ DictEntry *GetNextEntry();
- /// \brief Returns a ref to the Dicom Dictionary H table (map)
- /// @return the Dicom Dictionary H table
-
private:
/// ASCII file holding the Dictionnary
std::string Filename;
/// Access through TagKey
- TagKeyHT KeyHt;
-
+ TagKeyHT KeyHt;
+ TagKeyHT::iterator ItKeyHt;
};
} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDictEntry.cxx,v $
Language: C++
- Date: $Date: 2005/01/13 16:35:37 $
- Version: $Revision: 1.39 $
+ Date: $Date: 2005/01/14 11:28:30 $
+ Version: $Revision: 1.40 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
s << "[" << GetName()<< "]";
- os << s.str();
+ os << s.str() << std::endl;
}
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/01/13 12:19:58 $
- Version: $Revision: 1.189 $
+ Date: $Date: 2005/01/14 11:28:30 $
+ Version: $Revision: 1.190 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* when recursively walking the given set.
* @param set The structure to be traversed (recursively).
*/
-void Document::BuildFlatHashTableRecurse( TagDocEntryHT &builtHT,
+/*void Document::BuildFlatHashTableRecurse( TagDocEntryHT &builtHT,
DocEntrySet *set )
{
if (ElementSet *elementSet = dynamic_cast< ElementSet* > ( set ) )
}
}
-}
+}*/
/**
* \brief Build a \ref TagDocEntryHT (i.e. a std::map<>) from the current
* \ref BuildFlatHashTable again...
* @return The flat std::map<> we juste build.
*/
-TagDocEntryHT *Document::BuildFlatHashTable()
+/*TagDocEntryHT *Document::BuildFlatHashTable()
{
TagDocEntryHT *FlatHT = new TagDocEntryHT;
BuildFlatHashTableRecurse( *FlatHT, this );
return FlatHT;
-}
+}*/
// for each zero-level Tag in the DCM Header
DocEntry *entry;
- Initialize();
+ InitTraversal();
entry = GetNextEntry();
while(entry)
{
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2005/01/13 09:23:27 $
- Version: $Revision: 1.86 $
+ Date: $Date: 2005/01/14 11:28:30 $
+ Version: $Revision: 1.87 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
virtual void LoadEntryBinArea(BinEntry *entry);
void LoadDocEntrySafe(DocEntry *entry);
- TagDocEntryHT *BuildFlatHashTable();
+ /*TagDocEntryHT *BuildFlatHashTable();*/
/// Return the Transfer Syntax as a string
std::string GetTransferSyntaxName();
DocEntry *ReadNextDocEntry();
uint32_t GenerateFreeTagKeyInGroup(uint16_t group);
- void BuildFlatHashTableRecurse( TagDocEntryHT &builtHT,
- DocEntrySet* set );
+/* void BuildFlatHashTableRecurse( TagDocEntryHT &builtHT,
+ DocEntrySet* set );*/
void HandleBrokenEndian(uint16_t &group, uint16_t &elem);
void HandleOutOfGroup0002(uint16_t &group, uint16_t &elem);
Program: gdcm
Module: $RCSfile: gdcmElementSet.cxx,v $
Language: C++
- Date: $Date: 2005/01/11 00:21:48 $
- Version: $Revision: 1.40 $
+ Date: $Date: 2005/01/14 11:28:30 $
+ Version: $Revision: 1.41 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \brief Initialise the visit of the Hash table (TagHT)
*/
-void ElementSet::Initialize()
+void ElementSet::InitTraversal()
{
ItTagHT = TagHT.begin();
}
Program: gdcm
Module: $RCSfile: gdcmElementSet.h,v $
Language: C++
- Date: $Date: 2005/01/11 15:15:38 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2005/01/14 11:28:31 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// Accessor to \ref TagHT
// Do not expose this to user (public API) !
// A test is using it thus put it in public (matt)
- TagDocEntryHT const &GetTagHT() const { return TagHT; };
+ //TagDocEntryHT const &GetTagHT() const { return TagHT; };
- void Initialize();
+ void InitTraversal();
DocEntry *GetNextEntry();
protected: