From 70b9dde9da207191fa6d799fdf03c2aff7941273 Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 7 Jan 2005 16:26:11 +0000 Subject: [PATCH] ENH: Change the gdcmDebug approach. Remov the global static debug 'dbg'. And now use a static function call instead, with a global variable. This is much closer to the VTK approach. Hopefully should be bulletproof and easier to use...hopefully --- Example/TestFromScratch.cxx | 6 +-- src/gdcmDebug.cxx | 30 ++++-------- src/gdcmDebug.h | 27 +++++------ src/gdcmDicomDir.cxx | 34 ++++++------- src/gdcmDicomDirElement.cxx | 6 +-- src/gdcmDict.cxx | 10 ++-- src/gdcmDictEntry.cxx | 6 +-- src/gdcmDictSet.cxx | 6 +-- src/gdcmDocEntrySet.cxx | 12 ++--- src/gdcmDocument.cxx | 94 ++++++++++++++++++------------------ src/gdcmElementSet.cxx | 14 +++--- src/gdcmFile.cxx | 16 +++--- src/gdcmGlobal.cxx | 6 +-- src/gdcmHeader.cxx | 66 ++++++++++++------------- src/gdcmPixelReadConvert.cxx | 58 +++++++++++----------- src/gdcmSQItem.cxx | 12 ++--- src/gdcmTS.cxx | 6 +-- src/gdcmVR.cxx | 6 +-- 18 files changed, 199 insertions(+), 216 deletions(-) diff --git a/Example/TestFromScratch.cxx b/Example/TestFromScratch.cxx index 35851cde..f7293996 100644 --- a/Example/TestFromScratch.cxx +++ b/Example/TestFromScratch.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestFromScratch.cxx,v $ Language: C++ - Date: $Date: 2005/01/05 15:38:28 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/01/07 16:26:11 $ + 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 @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) } // Doesn't seems to do anything: - dbg.SetDebug(-1); + gdcm::Debug::SetDebugLevel(-1); // Doesn't link properly: //gdcm::Debug::GetReference().SetDebug(1); diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx index d301a9bf..5eadc164 100644 --- a/src/gdcmDebug.cxx +++ b/src/gdcmDebug.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:26 $ - Version: $Revision: 1.13 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,21 +22,14 @@ namespace gdcm { +/// warning message level to be displayed +static int DebugLevel = -1; //----------------------------------------------------------------------------- -/** - * \brief constructor - * @param level debug level - */ -Debug::Debug(int level) -{ - DebugLevel = level; -} - /** * \brief Accessor * @param level Set the debug level */ -void Debug::SetDebug(int level) +void Debug::SetDebugLevel (int level) { DebugLevel = level; } @@ -53,7 +46,7 @@ void Debug::Verbose(int level, const char *msg1, const char *msg2) { return ; } - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush; + std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl; } /** @@ -68,7 +61,7 @@ void Debug::Error(bool test, const char *msg1, const char *msg2) { return; } - std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl << std::flush; + std::cerr << "gdcm::" << msg1 << ' ' << msg2 << std::endl; Exit(1); } @@ -82,7 +75,7 @@ void Debug::Error(const char *msg1, const char *msg2, const char *msg3) { std::cerr << "gdcm::" << msg1 << ' ' << msg2 << ' ' << msg3 - << std::endl << std::flush; + << std::endl; Exit(1); } @@ -103,7 +96,7 @@ void Debug::Assert(int level, bool test, const char *msg1, if (!test) { std::cerr << "gdcm::" << msg1 << ' ' << msg2 - << std::endl << std::flush; + << std::endl; } } @@ -113,12 +106,7 @@ void Debug::Assert(int level, bool test, const char *msg1, */ void Debug::Exit(int a) { -#ifdef __GNUC__ - std::exit(a); -#endif -#if defined(_MSC_VER) || defined(__BORLANDC__) exit(a); // Found in #include -#endif } } // end namespace gdcm diff --git a/src/gdcmDebug.h b/src/gdcmDebug.h index 4b6d6824..1b193986 100644 --- a/src/gdcmDebug.h +++ b/src/gdcmDebug.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.h,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:26 $ - Version: $Revision: 1.10 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -41,24 +41,19 @@ class GDCM_EXPORT Debug public: Debug(int level = -1); - void SetDebug (int level); - void Verbose(int level, const char *msg1, const char *msg2 = "") ; - void Error (bool test, const char *msg1, const char *msg2 = ""); - void Error (const char *msg1, const char *msg2 = "", const char *msg3 = ""); + /// This is a global flag that controls whether any debug, warning + /// messages are displayed. + static void SetDebugLevel (int level); + static int GetDebugLevel (); - void Assert(int level, bool test, const char *msg1, const char *msg2); - void Exit(int a); - - static Debug &GetReference(); - -private: -/// warning message level to be displayed - int DebugLevel; + static void Verbose(int level, const char *msg1, const char *msg2 = "") ; + static void Error (bool test, const char *msg1, const char *msg2 = ""); + static void Error (const char *msg1, const char *msg2 = "", const char *msg3 = ""); + static void Assert(int level, bool test, const char *msg1, const char *msg2); + static void Exit (int a); }; } // end namespace gdcm -/// Instance of debugging utility. -static gdcm::Debug dbg; #endif diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index d8ca6287..cfeec8cc 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:26 $ - Version: $Revision: 1.92 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.93 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -90,7 +90,7 @@ DicomDir::DicomDir(std::string const &fileName, bool parseDir ): // if user passed a root directory, sure we didn't get anything if ( TagHT.begin() == TagHT.end() ) // when user passed a Directory to parse { - dbg.Verbose(0, "DicomDir::DicomDir : entry HT empty"); + Debug::Verbose(0, "DicomDir::DicomDir : entry HT empty"); if ( fileName.size() == 1 && fileName[0] == '.' ) { @@ -105,7 +105,7 @@ DicomDir::DicomDir(std::string const &fileName, bool parseDir ): { MetaElems = NewMeta(); - dbg.Verbose(0, "DicomDir::DicomDir : Parse directory" + Debug::Verbose(0, "DicomDir::DicomDir : Parse directory" " and create the DicomDir"); ParseDirectory(); } @@ -122,7 +122,7 @@ DicomDir::DicomDir(std::string const &fileName, bool parseDir ): DocEntry *e = GetDocEntryByNumber(0x0004, 0x1220); if ( !e ) { - dbg.Verbose(0, "DicomDir::DicomDir : NO Directory record" + Debug::Verbose(0, "DicomDir::DicomDir : NO Directory record" " sequence (0x0004,0x1220)"); /// \todo FIXME : what do we do when the parsed file IS NOT a /// DICOMDIR file ? @@ -358,7 +358,7 @@ bool DicomDir::WriteDicomDir(std::string const &fileName) std::ios::out | std::ios::binary); if( !fp ) { - dbg.Verbose(2, "Failed to open(write) File: ", fileName.c_str()); + Debug::Verbose(2, "Failed to open(write) File: ", fileName.c_str()); return false; } @@ -425,7 +425,7 @@ void DicomDir::CreateDicomDirChainedList(std::string const & path) header = new Header( it->c_str() ); if( !header ) { - dbg.Verbose( 1, + Debug::Verbose( 1, "DicomDir::CreateDicomDirChainedList: " "failure in new Header ", it->c_str() ); @@ -436,7 +436,7 @@ void DicomDir::CreateDicomDirChainedList(std::string const & path) { // Add the file header to the chained list: list.push_back(header); - dbg.Verbose( 1, + Debug::Verbose( 1, "DicomDir::CreateDicomDirChainedList: readable ", it->c_str() ); } @@ -552,7 +552,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, si = new DicomDirImage(); if( !AddDicomDirImageToEnd(static_cast(si)) ) { - dbg.Verbose(0,"DicomDir::SetElement:", + Debug::Verbose(0,"DicomDir::SetElement:", "Add DicomDirImageToEnd failed"); } break; @@ -561,7 +561,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, si = new DicomDirSerie(); if( !AddDicomDirSerieToEnd(static_cast(si)) ) { - dbg.Verbose(0,"DicomDir::SetElement:", + Debug::Verbose(0,"DicomDir::SetElement:", "Add DicomDirSerieToEnd failed"); } break; @@ -570,7 +570,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, si = new DicomDirStudy(); if( !AddDicomDirStudyToEnd(static_cast(si)) ) { - dbg.Verbose(0,"DicomDir::SetElement:", + Debug::Verbose(0,"DicomDir::SetElement:", "Add DicomDirStudyToEnd failed"); } break; @@ -579,7 +579,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, si = new DicomDirPatient(); if( !AddDicomDirPatientToEnd(static_cast(si)) ) { - dbg.Verbose(0,"DicomDir::SetElement:", + Debug::Verbose(0,"DicomDir::SetElement:", "Add DicomDirPatientToEnd failed"); } break; @@ -588,7 +588,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, si = new DicomDirMeta(); if( MetaElems ) { - dbg.Verbose(0,"DicomDir::SetElement:", + Debug::Verbose(0,"DicomDir::SetElement:", "MetaElements already exist, they will be destroyed"); delete MetaElems; } @@ -639,7 +639,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, { if( header->GetFileName().substr(0, path.length()) != path ) { - dbg.Verbose(0, "DicomDir::SetElement : the base path" + Debug::Verbose(0, "DicomDir::SetElement : the base path" " of file name is incorrect"); val = header->GetFileName(); } @@ -731,7 +731,7 @@ void DicomDir::CreateDicomDir() DocEntry *e = GetDocEntryByNumber(0x0004, 0x1220); if ( !e ) { - dbg.Verbose(0, "DicomDir::DicomDir : NO Directory record" + Debug::Verbose(0, "DicomDir::DicomDir : NO Directory record" " sequence (0x0004,0x1220)"); /// \todo FIXME: what to do when the parsed file IS NOT a DICOMDIR file ? return; @@ -740,7 +740,7 @@ void DicomDir::CreateDicomDir() SeqEntry *s = dynamic_cast(e); if ( !s ) { - dbg.Verbose(0, "DicomDir::CreateDicomDir: no SeqEntry present"); + Debug::Verbose(0, "DicomDir::CreateDicomDir: no SeqEntry present"); // useless : (0x0004,0x1220) IS a Sequence ! return; } @@ -763,7 +763,7 @@ void DicomDir::CreateDicomDir() } else { - dbg.Verbose(0, "DicomDir::CreateDicomDir: not a ValEntry."); + Debug::Verbose(0, "DicomDir::CreateDicomDir: not a ValEntry."); continue; } diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx index f719d3c8..1baebc1c 100644 --- a/src/gdcmDicomDirElement.cxx +++ b/src/gdcmDicomDirElement.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirElement.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:26 $ - Version: $Revision: 1.23 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,7 +40,7 @@ DicomDirElement::DicomDirElement() std::ifstream from(filename.c_str()); if(!from) { - dbg.Verbose(2, + Debug::Verbose(2, "DicomDirElement::DicomDirElement: can't open dictionary", filename.c_str()); FillDefaultDIRDict( this ); diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index bec8f774..1985e4e3 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 15:58:19 $ - Version: $Revision: 1.57 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.58 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -44,7 +44,7 @@ Dict::Dict(std::string const &filename) std::ifstream from( filename.c_str() ); if( !from ) { - dbg.Verbose(2,"Dict::Dict: can't open dictionary", filename.c_str()); + Debug::Verbose(2,"Dict::Dict: can't open dictionary", filename.c_str()); // Using default embeded one: FillDefaultDataDict( this ); } @@ -128,7 +128,7 @@ bool Dict::AddNewEntry(DictEntry const &newEntry) if(KeyHt.count(key) == 1) { - dbg.Verbose(1, "Dict::AddNewEntry already present", key.c_str()); + Debug::Verbose(1, "Dict::AddNewEntry already present", key.c_str()); return false; } else @@ -172,7 +172,7 @@ bool Dict::RemoveEntry (TagKey const &key) } else { - dbg.Verbose(1, "Dict::RemoveEntry unfound entry", key.c_str()); + Debug::Verbose(1, "Dict::RemoveEntry unfound entry", key.c_str()); return false; } } diff --git a/src/gdcmDictEntry.cxx b/src/gdcmDictEntry.cxx index 54c802b6..7baa9d1d 100644 --- a/src/gdcmDictEntry.cxx +++ b/src/gdcmDictEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictEntry.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 16:14:58 $ - Version: $Revision: 1.33 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.34 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -78,7 +78,7 @@ void DictEntry::SetVR(TagName const &vr) } else { - dbg.Error(true, "DictEntry::SetVR", + Debug::Error(true, "DictEntry::SetVR", "Overwriting VR might compromise a dictionary"); } } diff --git a/src/gdcmDictSet.cxx b/src/gdcmDictSet.cxx index 2e18040c..13ed5510 100644 --- a/src/gdcmDictSet.cxx +++ b/src/gdcmDictSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictSet.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 12:29:17 $ - Version: $Revision: 1.46 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.47 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -220,7 +220,7 @@ std::string DictSet::BuildDictPath() { resultPath += '/'; } - dbg.Verbose(1, "DictSet::BuildDictPath:", + Debug::Verbose(1, "DictSet::BuildDictPath:", "Dictionary path set from environnement"); } else diff --git a/src/gdcmDocEntrySet.cxx b/src/gdcmDocEntrySet.cxx index 0c751dd2..c0deb983 100644 --- a/src/gdcmDocEntrySet.cxx +++ b/src/gdcmDocEntrySet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 12:29:17 $ - Version: $Revision: 1.34 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.35 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -71,7 +71,7 @@ ValEntry *DocEntrySet::NewValEntryByNumber(uint16_t group,uint16_t elem, ValEntry *newEntry = new ValEntry(dictEntry); if (!newEntry) { - dbg.Verbose(1, "Document::NewValEntryByNumber", + Debug::Verbose(1, "Document::NewValEntryByNumber", "failed to allocate ValEntry"); return 0; } @@ -96,7 +96,7 @@ BinEntry *DocEntrySet::NewBinEntryByNumber(uint16_t group,uint16_t elem, BinEntry *newEntry = new BinEntry(dictEntry); if (!newEntry) { - dbg.Verbose(1, "Document::NewBinEntryByNumber", + Debug::Verbose(1, "Document::NewBinEntryByNumber", "failed to allocate BinEntry"); return 0; } @@ -118,7 +118,7 @@ SeqEntry* DocEntrySet::NewSeqEntryByNumber(uint16_t group,uint16_t elem) SeqEntry *newEntry = new SeqEntry( dictEntry ); if (!newEntry) { - dbg.Verbose(1, "Document::NewSeqEntryByNumber", + Debug::Verbose(1, "Document::NewSeqEntryByNumber", "failed to allocate SeqEntry"); return 0; } @@ -140,7 +140,7 @@ DictEntry *DocEntrySet::GetDictEntryByNumber(uint16_t group,uint16_t elem) Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); if (!pubDict) { - dbg.Verbose(0, "Document::GetDictEntry", + Debug::Verbose(0, "Document::GetDictEntry", "we SHOULD have a default dictionary"); } else diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index d10b2228..45b8fb97 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2005/01/07 08:46:18 $ - Version: $Revision: 1.162 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.163 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -106,7 +106,7 @@ Document::Document( std::string const &filename ) : ElementSet(-1) return; } - dbg.Verbose(0, "Document::Document: starting parsing of file: ", + Debug::Verbose(0, "Document::Document: starting parsing of file: ", Filename.c_str()); Fp->seekg( 0, std::ios::beg); @@ -283,13 +283,13 @@ bool Document::IsReadable() { if( Filetype == Unknown) { - dbg.Verbose(0, "Document::IsReadable: wrong filetype"); + Debug::Verbose(0, "Document::IsReadable: wrong filetype"); return false; } if( TagHT.empty() ) { - dbg.Verbose(0, "Document::IsReadable: no tags in internal" + Debug::Verbose(0, "Document::IsReadable: no tags in internal" " hash table."); return false; } @@ -424,7 +424,7 @@ std::ifstream *Document::OpenFile() if(Fp) { - dbg.Verbose( 0, + Debug::Verbose( 0, "Document::OpenFile is already opened when opening: ", Filename.c_str()); } @@ -432,7 +432,7 @@ std::ifstream *Document::OpenFile() Fp = new std::ifstream(Filename.c_str(), std::ios::in | std::ios::binary); if( ! *Fp ) { - dbg.Verbose( 0, + Debug::Verbose( 0, "Document::OpenFile cannot open file: ", Filename.c_str()); delete Fp; @@ -473,7 +473,7 @@ std::ifstream *Document::OpenFile() } CloseFile(); - dbg.Verbose( 0, + Debug::Verbose( 0, "Document::OpenFile not DICOM/ACR (missing preamble)", Filename.c_str()); @@ -566,7 +566,7 @@ ValEntry *Document::ReplaceOrCreateByNumber(std::string const &value, { if (!RemoveEntry(currentEntry)) { - dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: removal" + Debug::Verbose(0, "Document::ReplaceOrCreateByNumber: removal" " of previous DocEntry failed."); return NULL; @@ -581,7 +581,7 @@ ValEntry *Document::ReplaceOrCreateByNumber(std::string const &value, if ( !AddEntry(valEntry)) { - dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry" + Debug::Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry" " failed allthough this is a creation."); delete valEntry; @@ -629,7 +629,7 @@ BinEntry *Document::ReplaceOrCreateByNumber(uint8_t *binArea, { if (!RemoveEntry(currentEntry)) { - dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: removal" + Debug::Verbose(0, "Document::ReplaceOrCreateByNumber: removal" " of previous DocEntry failed."); return NULL; @@ -644,7 +644,7 @@ BinEntry *Document::ReplaceOrCreateByNumber(uint8_t *binArea, if ( !AddEntry(binEntry)) { - dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry" + Debug::Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry" " failed allthough this is a creation."); delete binEntry; @@ -702,7 +702,7 @@ SeqEntry *Document::ReplaceOrCreateByNumber( uint16_t group, uint16_t elem) { if (!RemoveEntry(currentEntry)) { - dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: removal" + Debug::Verbose(0, "Document::ReplaceOrCreateByNumber: removal" " of previous DocEntry failed."); return NULL; @@ -717,7 +717,7 @@ SeqEntry *Document::ReplaceOrCreateByNumber( uint16_t group, uint16_t elem) if ( !AddEntry(seqEntry)) { - dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry" + Debug::Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry" " failed allthough this is a creation."); delete seqEntry; @@ -841,7 +841,7 @@ bool Document::SetEntryByNumber(std::string const& content, ValEntry *entry = GetValEntryByNumber(group, element); if (!entry ) { - dbg.Verbose(0, "Document::SetEntryByNumber: no corresponding", + Debug::Verbose(0, "Document::SetEntryByNumber: no corresponding", " ValEntry (try promotion first)."); return false; } @@ -863,7 +863,7 @@ bool Document::SetEntryByNumber(uint8_t*content, int lgth, BinEntry *entry = GetBinEntryByNumber(group, element); if (!entry ) { - dbg.Verbose(0, "Document::SetEntryByNumber: no corresponding", + Debug::Verbose(0, "Document::SetEntryByNumber: no corresponding", " ValEntry (try promotion first)."); return false; } @@ -925,7 +925,7 @@ void *Document::GetEntryBinAreaByNumber(uint16_t group, uint16_t elem) DocEntry *entry = GetDocEntryByNumber(group, elem); if (!entry) { - dbg.Verbose(1, "Document::GetDocEntryByNumber: no entry"); + Debug::Verbose(1, "Document::GetDocEntryByNumber: no entry"); return 0; } if ( BinEntry *binEntry = dynamic_cast(entry) ) @@ -977,7 +977,7 @@ void Document::LoadEntryBinArea(BinEntry *element) uint8_t *a = new uint8_t[l]; if( !a ) { - dbg.Verbose(0, "Document::LoadEntryBinArea cannot allocate a"); + Debug::Verbose(0, "Document::LoadEntryBinArea cannot allocate a"); return; } @@ -1057,7 +1057,7 @@ ValEntry *Document::GetValEntryByNumber(uint16_t group, uint16_t element) { return entry; } - dbg.Verbose(0, "Document::GetValEntryByNumber: unfound ValEntry."); + Debug::Verbose(0, "Document::GetValEntryByNumber: unfound ValEntry."); return 0; } @@ -1079,7 +1079,7 @@ BinEntry *Document::GetBinEntryByNumber(uint16_t group, uint16_t element) { return entry; } - dbg.Verbose(0, "Document::GetBinEntryByNumber: unfound BinEntry."); + Debug::Verbose(0, "Document::GetBinEntryByNumber: unfound BinEntry."); return 0; } @@ -1126,7 +1126,7 @@ uint32_t Document::SwapLong(uint32_t a) break; default : //std::cout << "swapCode= " << SwapCode << std::endl; - dbg.Error(" Document::SwapLong : unset swap code"); + Debug::Error(" Document::SwapLong : unset swap code"); a = 0; } return a; @@ -1211,7 +1211,7 @@ void Document::ParseDES(DocEntrySet *set, long offset, if ( ! Global::GetVR()->IsVROfBinaryRepresentable(vr) ) { ////// Neither ValEntry NOR BinEntry: should mean UNKOWN VR - dbg.Verbose(0, "Document::ParseDES: neither Valentry, " + Debug::Verbose(0, "Document::ParseDES: neither Valentry, " "nor BinEntry. Probably unknown VR."); } @@ -1559,8 +1559,8 @@ void Document::LoadDocEntry(DocEntry *entry) if( length % 2 ) { newValue = Util::DicomString(str, length+1); - //dbg.Verbose(0, "Warning: bad length: ", length ); - dbg.Verbose(0, "For string :", newValue.c_str()); + //Debug::Verbose(0, "Warning: bad length: ", length ); + Debug::Verbose(0, "For string :", newValue.c_str()); // Since we change the length of string update it length entry->SetReadLength(length+1); } @@ -1574,7 +1574,7 @@ void Document::LoadDocEntry(DocEntry *entry) { if ( Fp->fail() || Fp->eof())//Fp->gcount() == 1 { - dbg.Verbose(1, "Document::LoadDocEntry", + Debug::Verbose(1, "Document::LoadDocEntry", "unread element value"); valEntry->SetValue(GDCM_UNREAD); return; @@ -1592,7 +1592,7 @@ void Document::LoadDocEntry(DocEntry *entry) } else { - dbg.Error(true, "Document::LoadDocEntry" + Debug::Error(true, "Document::LoadDocEntry" "Should have a ValEntry, here !"); } } @@ -1957,7 +1957,7 @@ void Document::FixDocEntryFoundLength(DocEntry *entry, s << "Warning : Tag with uneven length " << foundLength << " in x(" << std::hex << gr << "," << el <<")" << std::dec; - dbg.Verbose(0, s.str().c_str()); + Debug::Verbose(0, s.str().c_str()); } //////// Fix for some naughty General Electric images. @@ -2049,7 +2049,7 @@ bool Document::IsDocEntryAnInteger(DocEntry *entry) << std::hex << group << " , " << element << ") -before- position x(" << filePosition << ")" << "lgt : " << length; - dbg.Verbose(0, "Document::IsDocEntryAnInteger", s.str().c_str() ); + Debug::Verbose(0, "Document::IsDocEntryAnInteger", s.str().c_str() ); } } @@ -2094,7 +2094,7 @@ uint32_t Document::FindDocEntryLengthOB() if ( group != 0xfffe || ( ( elem != 0xe0dd ) && ( elem != 0xe000 ) ) ) { - dbg.Verbose(1, "Document::FindDocEntryLengthOB: neither an Item " + Debug::Verbose(1, "Document::FindDocEntryLengthOB: neither an Item " "tag nor a Sequence delimiter tag."); Fp->seekg(positionOnEntry, std::ios::beg); throw FormatUnexpected("Document::FindDocEntryLengthOB()", @@ -2229,7 +2229,7 @@ bool Document::CheckSwap() char *entCur = deb + 128; if( memcmp(entCur, "DICM", (size_t)4) == 0 ) { - dbg.Verbose(1, "Document::CheckSwap:", "looks like DICOM Version3"); + Debug::Verbose(1, "Document::CheckSwap:", "looks like DICOM Version3"); // Next, determine the value representation (VR). Let's skip to the // first element (0002, 0000) and check there if we find "UL" @@ -2263,26 +2263,26 @@ bool Document::CheckSwap() // instead of just checking for UL, OB and UI !? group 0000 { Filetype = ExplicitVR; - dbg.Verbose(1, "Document::CheckSwap:", + Debug::Verbose(1, "Document::CheckSwap:", "explicit Value Representation"); } else { Filetype = ImplicitVR; - dbg.Verbose(1, "Document::CheckSwap:", + Debug::Verbose(1, "Document::CheckSwap:", "not an explicit Value Representation"); } if ( net2host ) { SwapCode = 4321; - dbg.Verbose(1, "Document::CheckSwap:", + Debug::Verbose(1, "Document::CheckSwap:", "HostByteOrder != NetworkByteOrder"); } else { SwapCode = 0; - dbg.Verbose(1, "Document::CheckSwap:", + Debug::Verbose(1, "Document::CheckSwap:", "HostByteOrder = NetworkByteOrder"); } @@ -2296,7 +2296,7 @@ bool Document::CheckSwap() // Alas, this is not a DicomV3 file and whatever happens there is no file // preamble. We can reset the file position indicator to where the data // is (i.e. the beginning of the file). - dbg.Verbose(1, "Document::CheckSwap:", "not a DICOM Version3 file"); + Debug::Verbose(1, "Document::CheckSwap:", "not a DICOM Version3 file"); Fp->seekg(0, std::ios::beg); // Our next best chance would be to be considering a 'clean' ACR/NEMA file. @@ -2371,7 +2371,7 @@ bool Document::CheckSwap() Filetype = ACR; return true; default : - dbg.Verbose(0, "Document::CheckSwap:", + Debug::Verbose(0, "Document::CheckSwap:", "ACR/NEMA unfound swap info (Really hopeless !)"); Filetype = Unknown; return false; @@ -2393,7 +2393,7 @@ bool Document::CheckSwap() */ void Document::SwitchSwapToBigEndian() { - dbg.Verbose(1, "Document::SwitchSwapToBigEndian", + Debug::Verbose(1, "Document::SwitchSwapToBigEndian", "Switching to BigEndian mode."); if ( SwapCode == 0 ) { @@ -2535,7 +2535,7 @@ DocEntry *Document::ReadNextDocEntry() std::string msg; msg = Util::Format("Falsely explicit vr file (%04x,%04x)\n", newEntry->GetGroup(), newEntry->GetElement()); - dbg.Verbose(1, "Document::FindVR: ", msg.c_str()); + Debug::Verbose(1, "Document::FindVR: ", msg.c_str()); } newEntry->SetImplicitVR(); } @@ -2618,8 +2618,8 @@ bool Document::ReadTag(uint16_t testGroup, uint16_t testElement) s << std::hex << itemTagGroup << "," << itemTagElement << ")" << std::endl; s << " at address: " << (unsigned)currentPosition << std::endl; - dbg.Verbose(0, "Document::ReadItemTagLength: wrong Item Tag found:"); - dbg.Verbose(0, s.str().c_str()); + Debug::Verbose(0, "Document::ReadItemTagLength: wrong Item Tag found:"); + Debug::Verbose(0, s.str().c_str()); Fp->seekg(positionOnEntry, std::ios::beg); return false; @@ -2659,7 +2659,7 @@ uint32_t Document::ReadTagLength(uint16_t testGroup, uint16_t testElement) s << "Basic Item Length is: " << itemLength << std::endl; s << " at address: " << (unsigned)currentPosition << std::endl; - dbg.Verbose(0, "Document::ReadItemTagLength: ", s.str().c_str()); + Debug::Verbose(0, "Document::ReadItemTagLength: ", s.str().c_str()); } return itemLength; } @@ -2692,7 +2692,7 @@ void Document::ReadAndSkipEncapsulatedBasicOffsetTable() std::ostringstream s; s << " Read one length: "; s << std::hex << individualLength << std::endl; - dbg.Verbose(0, + Debug::Verbose(0, "Document::ReadAndSkipEncapsulatedBasicOffsetTable: ", s.str().c_str()); } @@ -2751,7 +2751,7 @@ void Document::ComputeRLEInfo() if ( nbRleSegments > 16 ) { // There should be at most 15 segments (refer to RLEFrame class) - dbg.Verbose(0, "Document::ComputeRLEInfo: too many segments."); + Debug::Verbose(0, "Document::ComputeRLEInfo: too many segments."); } uint32_t rleSegmentOffsetTable[16]; @@ -2794,8 +2794,8 @@ void Document::ComputeRLEInfo() // Delimiter Item': if ( !ReadTag(0xfffe, 0xe0dd) ) { - dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter "); - dbg.Verbose(0, " item at end of RLE item sequence"); + Debug::Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter "); + Debug::Verbose(0, " item at end of RLE item sequence"); } } @@ -2835,8 +2835,8 @@ void Document::ComputeJPEGFragmentInfo() // Delimiter Item': if ( !ReadTag(0xfffe, 0xe0dd) ) { - dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter "); - dbg.Verbose(0, " item at end of JPEG item sequence"); + Debug::Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter "); + Debug::Verbose(0, " item at end of JPEG item sequence"); } } diff --git a/src/gdcmElementSet.cxx b/src/gdcmElementSet.cxx index ef76254b..f30da69b 100644 --- a/src/gdcmElementSet.cxx +++ b/src/gdcmElementSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:27 $ - Version: $Revision: 1.36 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.37 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -113,7 +113,7 @@ bool ElementSet::AddEntry(DocEntry *newEntry) if( TagHT.count(key) == 1 ) { - dbg.Verbose(1, "ElementSet::AddEntry key already present: ", + Debug::Verbose(1, "ElementSet::AddEntry key already present: ", key.c_str()); return false; } @@ -136,12 +136,12 @@ bool ElementSet::RemoveEntry( DocEntry *entryToRemove) if( TagHT.count(key) == 1 ) { TagHT.erase(key); - dbg.Verbose(0, "ElementSet::RemoveEntry: one element erased."); + Debug::Verbose(0, "ElementSet::RemoveEntry: one element erased."); delete entryToRemove; return true; } - dbg.Verbose(0, "ElementSet::RemoveEntry: key not present"); + Debug::Verbose(0, "ElementSet::RemoveEntry: key not present"); return false ; } @@ -155,11 +155,11 @@ bool ElementSet::RemoveEntryNoDestroy(DocEntry *entryToRemove) if( TagHT.count(key) == 1 ) { TagHT.erase(key); - dbg.Verbose(0, "ElementSet::RemoveEntry: one element erased."); + Debug::Verbose(0, "ElementSet::RemoveEntry: one element erased."); return true; } - dbg.Verbose(0, "ElementSet::RemoveEntry: key not present"); + Debug::Verbose(0, "ElementSet::RemoveEntry: key not present"); return false ; } diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index cd6ec36b..52ef22ee 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:27 $ - Version: $Revision: 1.183 $ + Date: $Date: 2005/01/07 16:26:12 $ + Version: $Revision: 1.184 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -255,7 +255,7 @@ size_t File::GetImageDataIntoVector (void *destination, size_t maxSize) { if ( PixelReadConverter->GetRGBSize() > maxSize ) { - dbg.Verbose(0, "File::GetImageDataIntoVector: pixel data bigger" + Debug::Verbose(0, "File::GetImageDataIntoVector: pixel data bigger" "than caller's expected MaxSize"); return 0; } @@ -268,7 +268,7 @@ size_t File::GetImageDataIntoVector (void *destination, size_t maxSize) // Either no LUT conversion necessary or LUT conversion failed if ( PixelReadConverter->GetRawSize() > maxSize ) { - dbg.Verbose(0, "File::GetImageDataIntoVector: pixel data bigger" + Debug::Verbose(0, "File::GetImageDataIntoVector: pixel data bigger" "than caller's expected MaxSize"); return 0; } @@ -373,7 +373,7 @@ bool File::WriteRawData(std::string const &fileName) std::ofstream fp1(fileName.c_str(), std::ios::out | std::ios::binary ); if (!fp1) { - dbg.Verbose(2, "Fail to open (write) file:", fileName.c_str()); + Debug::Verbose(2, "Fail to open (write) file:", fileName.c_str()); return false; } @@ -615,7 +615,7 @@ bool File::CheckWriteIntegrity() case WMODE_RAW : if( decSize!=PixelWriteConverter->GetUserDataSize() ) { - dbg.Verbose(0, "File::CheckWriteIntegrity: Data size is incorrect (Raw)"); + Debug::Verbose(0, "File::CheckWriteIntegrity: Data size is incorrect (Raw)"); //std::cerr << "File::CheckWriteIntegrity: Data size is incorrect (Raw)\n" // << decSize << " / " << PixelWriteConverter->GetUserDataSize() << "\n"; return false; @@ -624,7 +624,7 @@ bool File::CheckWriteIntegrity() case WMODE_RGB : if( rgbSize!=PixelWriteConverter->GetUserDataSize() ) { - dbg.Verbose(0, "File::CheckWriteIntegrity: Data size is incorrect (RGB)"); + Debug::Verbose(0, "File::CheckWriteIntegrity: Data size is incorrect (RGB)"); //std::cerr << "File::CheckWriteIntegrity: Data size is incorrect (RGB)\n" // << decSize << " / " << PixelWriteConverter->GetUserDataSize() << "\n"; return false; @@ -910,7 +910,7 @@ uint8_t *File::GetRaw() raw = PixelReadConverter->GetRaw(); if ( ! raw ) { - dbg.Verbose(0, "File::GetRaw: read/decompress of " + Debug::Verbose(0, "File::GetRaw: read/decompress of " "pixel data apparently went wrong."); return 0; } diff --git a/src/gdcmGlobal.cxx b/src/gdcmGlobal.cxx index 8df156b5..9fb2c8ec 100644 --- a/src/gdcmGlobal.cxx +++ b/src/gdcmGlobal.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmGlobal.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 20:16:58 $ - Version: $Revision: 1.7 $ + Date: $Date: 2005/01/07 16:26:12 $ + 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 @@ -67,7 +67,7 @@ Global::Global() { if (ValRes || TranSyn || Dicts || ddElem) { - dbg.Verbose(0, "Global::Global : VR or TS or Dicts already allocated"); + Debug::Verbose(0, "Global::Global : VR or TS or Dicts already allocated"); return; } Dicts = new DictSet(); diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 31263819..945f2885 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeader.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:28 $ - Version: $Revision: 1.222 $ + Date: $Date: 2005/01/07 16:26:13 $ + Version: $Revision: 1.223 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -131,7 +131,7 @@ bool Header::Write(std::string fileName, FileType filetype) std::ios::out | std::ios::binary); if (*fp == NULL) { - dbg.Verbose(2, "Failed to open (write) File: " , fileName.c_str()); + Debug::Verbose(2, "Failed to open (write) File: " , fileName.c_str()); return false; } @@ -328,7 +328,7 @@ float Header::GetXSpacing() if ( strSpacing == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetXSpacing: unfound Pixel Spacing (0028,0030)"); + Debug::Verbose(0, "Header::GetXSpacing: unfound Pixel Spacing (0028,0030)"); return 1.; } @@ -355,7 +355,7 @@ float Header::GetXSpacing() if ( xspacing == 0.) { - dbg.Verbose(0, "Header::GetXSpacing: gdcmData/CT-MONO2-8-abdo.dcm problem"); + Debug::Verbose(0, "Header::GetXSpacing: gdcmData/CT-MONO2-8-abdo.dcm problem"); // seems to be a bug in the header ... nbValues = sscanf( strSpacing.c_str(), "%f\\0\\%f", &yspacing, &xspacing); assert( nbValues == 2 ); @@ -376,7 +376,7 @@ float Header::GetYSpacing() if ( strSpacing == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetYSpacing: unfound Pixel Spacing (0028,0030)"); + Debug::Verbose(0, "Header::GetYSpacing: unfound Pixel Spacing (0028,0030)"); return 1.; } @@ -411,7 +411,7 @@ float Header::GetZSpacing() if ( strSpacingBSlices == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetZSpacing: unfound StrSpacingBSlices"); + Debug::Verbose(0, "Header::GetZSpacing: unfound StrSpacingBSlices"); const std::string &strSliceThickness = GetEntryByNumber(0x0018,0x0050); if ( strSliceThickness == GDCM_UNFOUND ) { @@ -444,7 +444,7 @@ float Header::GetRescaleIntercept() if( sscanf( strRescInter.c_str(), "%f", &resInter) != 1 ) { // bug in the element 0x0028,0x1052 - dbg.Verbose(0, "Header::GetRescaleIntercept: Rescale Slope " + Debug::Verbose(0, "Header::GetRescaleIntercept: Rescale Slope " "is empty"); } } @@ -466,7 +466,7 @@ float Header::GetRescaleSlope() if( sscanf( strRescSlope.c_str(), "%f", &resSlope) != 1) { // bug in the element 0x0028,0x1053 - dbg.Verbose(0, "Header::GetRescaleSlope: Rescale Slope is empty"); + Debug::Verbose(0, "Header::GetRescaleSlope: Rescale Slope is empty"); } } @@ -572,12 +572,12 @@ float Header::GetXOrigin() if ( strImPos == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetXImagePosition: unfound Image " + Debug::Verbose(0, "Header::GetXImagePosition: unfound Image " "Position Patient (0020,0032)"); strImPos = GetEntryByNumber(0x0020,0x0030); // For ACR-NEMA images if ( strImPos == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetXImagePosition: unfound Image " + Debug::Verbose(0, "Header::GetXImagePosition: unfound Image " "Position (RET) (0020,0030)"); /// \todo How to tell the caller nothing was found ? return 0.; @@ -605,12 +605,12 @@ float Header::GetYOrigin() if ( strImPos == GDCM_UNFOUND) { - dbg.Verbose(0, "Header::GetYImagePosition: unfound Image " + Debug::Verbose(0, "Header::GetYImagePosition: unfound Image " "Position Patient (0020,0032)"); strImPos = GetEntryByNumber(0x0020,0x0030); // For ACR-NEMA images if ( strImPos == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetYImagePosition: unfound Image " + Debug::Verbose(0, "Header::GetYImagePosition: unfound Image " "Position (RET) (0020,0030)"); /// \todo How to tell the caller nothing was found ? return 0.; @@ -642,7 +642,7 @@ float Header::GetZOrigin() { if( sscanf( strImPos.c_str(), "%f\\%f\\%f", &xImPos, &yImPos, &zImPos) != 3) { - dbg.Verbose(0, "Header::GetZImagePosition: wrong Image " + Debug::Verbose(0, "Header::GetZImagePosition: wrong Image " "Position Patient (0020,0032)"); return 0.; // bug in the element 0x0020,0x0032 } @@ -658,7 +658,7 @@ float Header::GetZOrigin() if( sscanf( strImPos.c_str(), "%f\\%f\\%f", &xImPos, &yImPos, &zImPos ) != 3 ) { - dbg.Verbose(0, "Header::GetZImagePosition: wrong Image Position (RET) (0020,0030)"); + Debug::Verbose(0, "Header::GetZImagePosition: wrong Image Position (RET) (0020,0030)"); return 0.; // bug in the element 0x0020,0x0032 } else @@ -672,7 +672,7 @@ float Header::GetZOrigin() { if( sscanf( strSliceLocation.c_str(), "%f", &zImPos) != 1) { - dbg.Verbose(0, "Header::GetZImagePosition: wrong Slice Location (0020,1041)"); + Debug::Verbose(0, "Header::GetZImagePosition: wrong Slice Location (0020,1041)"); return 0.; // bug in the element 0x0020,0x1041 } else @@ -680,14 +680,14 @@ float Header::GetZOrigin() return zImPos; } } - dbg.Verbose(0, "Header::GetZImagePosition: unfound Slice Location (0020,1041)"); + Debug::Verbose(0, "Header::GetZImagePosition: unfound Slice Location (0020,1041)"); std::string strLocation = GetEntryByNumber(0x0020,0x0050); if ( strLocation != GDCM_UNFOUND ) { if( sscanf( strLocation.c_str(), "%f", &zImPos) != 1) { - dbg.Verbose(0, "Header::GetZImagePosition: wrong Location (0020,0050)"); + Debug::Verbose(0, "Header::GetZImagePosition: wrong Location (0020,0050)"); return 0.; // bug in the element 0x0020,0x0050 } else @@ -695,7 +695,7 @@ float Header::GetZOrigin() return zImPos; } } - dbg.Verbose(0, "Header::GetYImagePosition: unfound Location (0020,0050)"); + Debug::Verbose(0, "Header::GetYImagePosition: unfound Location (0020,0050)"); return 0.; // Hopeless } @@ -794,7 +794,7 @@ int Header::GetBitsStored() std::string strSize = GetEntryByNumber( 0x0028, 0x0101 ); if ( strSize == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetBitsStored: this is supposed to " + Debug::Verbose(0, "Header::GetBitsStored: this is supposed to " "be mandatory"); return 0; // It's supposed to be mandatory // the caller will have to check @@ -813,7 +813,7 @@ int Header::GetHighBitPosition() std::string strSize = GetEntryByNumber( 0x0028, 0x0102 ); if ( strSize == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetHighBitPosition: this is supposed " + Debug::Verbose(0, "Header::GetHighBitPosition: this is supposed " "to be mandatory"); return 0; } @@ -831,7 +831,7 @@ bool Header::IsSignedPixelData() std::string strSize = GetEntryByNumber( 0x0028, 0x0103 ); if ( strSize == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::IsSignedPixelData: this is supposed " + Debug::Verbose(0, "Header::IsSignedPixelData: this is supposed " "to be mandatory"); return false; } @@ -854,7 +854,7 @@ int Header::GetBitsAllocated() std::string strSize = GetEntryByNumber(0x0028,0x0100); if ( strSize == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetBitsStored: this is supposed to " + Debug::Verbose(0, "Header::GetBitsStored: this is supposed to " "be mandatory"); return 0; // It's supposed to be mandatory // the caller will have to check @@ -873,7 +873,7 @@ int Header::GetSamplesPerPixel() const std::string& strSize = GetEntryByNumber(0x0028,0x0002); if ( strSize == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetBitsStored: this is supposed to " + Debug::Verbose(0, "Header::GetBitsStored: this is supposed to " "be mandatory"); return 1; // Well, it's supposed to be mandatory ... // but sometimes it's missing : *we* assume Gray pixels @@ -896,7 +896,7 @@ bool Header::IsMonochrome() } if ( PhotometricInterp == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::IsMonochrome: absent Photometric " + Debug::Verbose(0, "Header::IsMonochrome: absent Photometric " "Interpretation"); } return false; @@ -916,7 +916,7 @@ bool Header::IsPaletteColor() } if ( PhotometricInterp == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::IsPaletteColor: absent Photometric " + Debug::Verbose(0, "Header::IsPaletteColor: absent Photometric " "Interpretation"); } return false; @@ -936,7 +936,7 @@ bool Header::IsYBRFull() } if ( PhotometricInterp == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::IsYBRFull: absent Photometric " + Debug::Verbose(0, "Header::IsYBRFull: absent Photometric " "Interpretation"); } return false; @@ -986,7 +986,7 @@ int Header::GetPixelSize() { return 8; } - dbg.Verbose(0, "Header::GetPixelSize: Unknown pixel type"); + Debug::Verbose(0, "Header::GetPixelSize: Unknown pixel type"); return 0; } @@ -1009,7 +1009,7 @@ std::string Header::GetPixelType() std::string bitsAlloc = GetEntryByNumber(0x0028, 0x0100); // Bits Allocated if ( bitsAlloc == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetPixelType: unfound Bits Allocated"); + Debug::Verbose(0, "Header::GetPixelType: unfound Bits Allocated"); bitsAlloc = "16"; } @@ -1032,7 +1032,7 @@ std::string Header::GetPixelType() if (sign == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetPixelType: unfound Pixel Representation"); + Debug::Verbose(0, "Header::GetPixelType: unfound Pixel Representation"); bitsAlloc = "0"; } else if ( sign == "0" ) @@ -1194,7 +1194,7 @@ std::string Header::GetTransfertSyntaxName() } if ( transfertSyntax == GDCM_UNFOUND ) { - dbg.Verbose(0, "Header::GetTransfertSyntaxName:" + Debug::Verbose(0, "Header::GetTransfertSyntaxName:" " unfound Transfert Syntax (0002,0010)"); return "Uncompressed ACR-NEMA"; } @@ -1312,7 +1312,7 @@ void Header::GetImageOrientationPatient( float iop[6] ) if( sscanf( strImOriPat.c_str(), "%f\\%f\\%f\\%f\\%f\\%f", &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 ) { - dbg.Verbose(0, "Header::GetImageOrientationPatient: " + Debug::Verbose(0, "Header::GetImageOrientationPatient: " "wrong Image Orientation Patient (0020,0037)"); } } @@ -1323,7 +1323,7 @@ void Header::GetImageOrientationPatient( float iop[6] ) if( sscanf( strImOriPat.c_str(), "%f\\%f\\%f\\%f\\%f\\%f", &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 ) { - dbg.Verbose(0, "Header::GetImageOrientationPatient: " + Debug::Verbose(0, "Header::GetImageOrientationPatient: " "wrong Image Orientation Patient (0020,0035)"); } } diff --git a/src/gdcmPixelReadConvert.cxx b/src/gdcmPixelReadConvert.cxx index 07c2fd94..112adc08 100644 --- a/src/gdcmPixelReadConvert.cxx +++ b/src/gdcmPixelReadConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelReadConvert.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:28 $ - Version: $Revision: 1.14 $ + Date: $Date: 2005/01/07 16:26:13 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -259,7 +259,7 @@ bool PixelReadConvert::ReadAndDecompressRLEFragment( uint8_t *subRaw, if ( numberOfReadBytes > fragmentSize ) { - dbg.Verbose(0, "PixelReadConvert::ReadAndDecompressRLEFragment: we " + Debug::Verbose(0, "PixelReadConvert::ReadAndDecompressRLEFragment: we " "read more bytes than the segment size."); return false; } @@ -332,7 +332,7 @@ void PixelReadConvert::ConvertSwapZone() } break; default: - dbg.Verbose( 0, "PixelReadConvert::ConvertSwapZone: SwapCode value " + Debug::Verbose( 0, "PixelReadConvert::ConvertSwapZone: SwapCode value " "(16 bits) not allowed." ); } } @@ -379,7 +379,7 @@ void PixelReadConvert::ConvertSwapZone() } break; default: - dbg.Verbose( 0, "PixelReadConvert::ConvertSwapZone: SwapCode value " + Debug::Verbose( 0, "PixelReadConvert::ConvertSwapZone: SwapCode value " "(32 bits) not allowed." ); } } @@ -460,7 +460,7 @@ bool PixelReadConvert::ReadAndDecompressJPEGFramesFromFile( std::ifstream *fp ) else { // other JPEG lossy not supported - dbg.Error("PixelReadConvert::ReadAndDecompressJPEGFile: unknown " + Debug::Error("PixelReadConvert::ReadAndDecompressJPEGFile: unknown " "jpeg lossy compression "); return false; } @@ -520,7 +520,7 @@ ReadAndDecompressJPEGSingleFrameFragmentsFromFile( std::ifstream *fp ) if ( ! gdcm_read_JPEG_memory8( buffer, totalLength, Raw, &howManyRead, &howManyWritten ) ) { - dbg.Error( + Debug::Error( "PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg8 " ); delete [] buffer; @@ -532,7 +532,7 @@ ReadAndDecompressJPEGSingleFrameFragmentsFromFile( std::ifstream *fp ) if ( ! gdcm_read_JPEG_memory12( buffer, totalLength, Raw, &howManyRead, &howManyWritten ) ) { - dbg.Error( + Debug::Error( "PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg12 " ); delete [] buffer; @@ -545,7 +545,7 @@ ReadAndDecompressJPEGSingleFrameFragmentsFromFile( std::ifstream *fp ) if ( ! gdcm_read_JPEG_memory16( buffer, totalLength, Raw, &howManyRead, &howManyWritten ) ) { - dbg.Error( + Debug::Error( "PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg16 " ); delete [] buffer; @@ -555,7 +555,7 @@ ReadAndDecompressJPEGSingleFrameFragmentsFromFile( std::ifstream *fp ) else { // other JPEG lossy not supported - dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: unknown " + Debug::Error("PixelConvert::ReadAndDecompressJPEGFile: unknown " "jpeg lossy compression "); delete [] buffer; return false; @@ -622,7 +622,7 @@ ReadAndDecompressJPEGFragmentedFramesFromFile( std::ifstream *fp ) Raw+howManyWritten, &howManyRead, &howManyWritten ) ) { - dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg8 "); + Debug::Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg8 "); delete [] buffer; return false; } @@ -634,7 +634,7 @@ ReadAndDecompressJPEGFragmentedFramesFromFile( std::ifstream *fp ) Raw+howManyWritten, &howManyRead, &howManyWritten ) ) { - dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg12 "); + Debug::Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg12 "); delete [] buffer; return false; } @@ -646,7 +646,7 @@ ReadAndDecompressJPEGFragmentedFramesFromFile( std::ifstream *fp ) Raw+howManyWritten, &howManyRead, &howManyWritten ) ) { - dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg16 "); + Debug::Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg16 "); delete [] buffer; return false; } @@ -654,7 +654,7 @@ ReadAndDecompressJPEGFragmentedFramesFromFile( std::ifstream *fp ) else { // other JPEG lossy not supported - dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: unknown " + Debug::Error("PixelConvert::ReadAndDecompressJPEGFile: unknown " "jpeg lossy compression "); delete [] buffer; return false; @@ -738,7 +738,7 @@ bool PixelReadConvert::ConvertReArrangeBits() throw ( FormatError ) } else { - dbg.Verbose(0, "PixelReadConvert::ConvertReArrangeBits: weird image"); + Debug::Verbose(0, "PixelReadConvert::ConvertReArrangeBits: weird image"); throw FormatError( "PixelReadConvert::ConvertReArrangeBits()", "weird image !?" ); } @@ -836,7 +836,7 @@ bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp ) //// First stage: get our hands on the Pixel Data. if ( !fp ) { - dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " + Debug::Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " "unavailable file pointer." ); return false; } @@ -844,7 +844,7 @@ bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp ) fp->seekg( PixelOffset, std::ios::beg ); if( fp->fail() || fp->eof()) //Fp->gcount() == 1 { - dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " + Debug::Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " "unable to find PixelOffset in file." ); return false; } @@ -865,7 +865,7 @@ bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp ) // variable). But RawSize is the right size of the image ! if( PixelDataLength != RawSize) { - dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " + Debug::Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " "Mismatch between PixelReadConvert and RawSize." ); } if( PixelDataLength > RawSize) @@ -879,7 +879,7 @@ bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp ) if ( fp->fail() || fp->eof())//Fp->gcount() == 1 { - dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " + Debug::Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " "reading of Raw pixel data failed." ); return false; } @@ -888,7 +888,7 @@ bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp ) { if ( ! ReadAndDecompressRLEFile( fp ) ) { - dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " + Debug::Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " "RLE decompressor failed." ); return false; } @@ -898,7 +898,7 @@ bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp ) // Default case concerns JPEG family if ( ! ReadAndDecompressJPEGFile( fp ) ) { - dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " + Debug::Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: " "JPEG decompressor failed." ); return false; } @@ -1104,7 +1104,7 @@ void PixelReadConvert::GrabInformationsFromHeader( Header *header ) LutRedData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1201 ); if ( ! LutRedData ) { - dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: " + Debug::Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: " "unable to read red LUT data" ); } @@ -1113,7 +1113,7 @@ void PixelReadConvert::GrabInformationsFromHeader( Header *header ) LutGreenData = (uint8_t*)header->GetEntryBinAreaByNumber(0x0028, 0x1202 ); if ( ! LutGreenData) { - dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: " + Debug::Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: " "unable to read green LUT data" ); } @@ -1122,7 +1122,7 @@ void PixelReadConvert::GrabInformationsFromHeader( Header *header ) LutBlueData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1203 ); if ( ! LutBlueData ) { - dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: " + Debug::Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: " "unable to read blue LUT data" ); } } @@ -1176,7 +1176,7 @@ void PixelReadConvert::BuildLUTRGBA() &lengthR, &debR, &nbitsR ); if( nbRead != 3 ) { - dbg.Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong red LUT descriptor"); + Debug::Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong red LUT descriptor"); } int lengthG; // Green LUT length in Bytes @@ -1187,7 +1187,7 @@ void PixelReadConvert::BuildLUTRGBA() &lengthG, &debG, &nbitsG ); if( nbRead != 3 ) { - dbg.Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong green LUT descriptor"); + Debug::Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong green LUT descriptor"); } int lengthB; // Blue LUT length in Bytes @@ -1198,7 +1198,7 @@ void PixelReadConvert::BuildLUTRGBA() &lengthB, &debB, &nbitsB ); if( nbRead != 3 ) { - dbg.Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong blue LUT descriptor"); + Debug::Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong blue LUT descriptor"); } //////////////////////////////////////////////////////// @@ -1336,7 +1336,7 @@ void PixelReadConvert::Print( std::string indent, std::ostream &os ) } else { - dbg.Verbose(0, "PixelReadConvert::Print: set as RLE file " + Debug::Verbose(0, "PixelReadConvert::Print: set as RLE file " "but NO RLEinfo present."); } } @@ -1349,7 +1349,7 @@ void PixelReadConvert::Print( std::string indent, std::ostream &os ) } else { - dbg.Verbose(0, "PixelReadConvert::Print: set as JPEG file " + Debug::Verbose(0, "PixelReadConvert::Print: set as JPEG file " "but NO JPEGinfo present."); } } diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index 9babd77f..841832db 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:28 $ - Version: $Revision: 1.45 $ + Date: $Date: 2005/01/07 16:26:13 $ + Version: $Revision: 1.46 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -235,13 +235,13 @@ bool SQItem::RemoveEntry( DocEntry* entryToRemove) if( *it == entryToRemove) { DocEntries.erase(it); - dbg.Verbose(0, "SQItem::RemoveEntry: one element erased."); + Debug::Verbose(0, "SQItem::RemoveEntry: one element erased."); delete entryToRemove; return true; } } - dbg.Verbose(0, "SQItem::RemoveEntry: value not present "); + Debug::Verbose(0, "SQItem::RemoveEntry: value not present "); return false ; } @@ -258,12 +258,12 @@ bool SQItem::RemoveEntryNoDestroy(DocEntry* entryToRemove) if( *it == entryToRemove) { DocEntries.erase(it); - dbg.Verbose(0, "SQItem::RemoveEntry: one element erased."); + Debug::Verbose(0, "SQItem::RemoveEntry: one element erased."); return true; } } - dbg.Verbose(0, "SQItem::RemoveEntry: value not present "); + Debug::Verbose(0, "SQItem::RemoveEntry: value not present "); return false ; } diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index 4d335126..8bd86a57 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmTS.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:28 $ - Version: $Revision: 1.30 $ + Date: $Date: 2005/01/07 16:26:13 $ + 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 @@ -42,7 +42,7 @@ TS::TS() std::ifstream from(filename.c_str()); if( !from ) { - dbg.Verbose(2, "TS::TS: can't open dictionary", filename.c_str()); + Debug::Verbose(2, "TS::TS: can't open dictionary", filename.c_str()); FillDefaultTSDict( TsMap ); } else diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index 8a716da7..4dd664c8 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmVR.cxx,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:28 $ - Version: $Revision: 1.27 $ + Date: $Date: 2005/01/07 16:26:13 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -37,7 +37,7 @@ VR::VR() std::ifstream from(filename.c_str()); if(!from) { - dbg.Verbose(2, "VR::VR: can't open dictionary", filename.c_str()); + Debug::Verbose(2, "VR::VR: can't open dictionary", filename.c_str()); FillDefaultVRDict(vr); } else -- 2.48.1