From 7589d23967892c94462e22a49ec50fcd225c5c38 Mon Sep 17 00:00:00 2001 From: frog Date: Tue, 1 Jul 2003 10:04:35 +0000 Subject: [PATCH] * gdcmPython/Makefile.am now avoids calling the wrappers for the clean target. * src/gdcm*.[cxx|h] : - to allow compilation with gcc 3.x -- clean up of STL usage (added explicit usage of std::) -- small fixes on exceptions. Note: linking not tested ! - clean of doxygen comments to avoid warnings at documentation building stage. * vtk/vtkGdcmReader.cxx: g++ warning message clean up (platform dependent convertion). --- ChangeLog | 13 +++++++++++ gdcmPython/Makefile.am | 2 +- src/gdcmDict.cxx | 16 ++++++------- src/gdcmElValSet.cxx | 51 +++++++++++++++++++++--------------------- src/gdcmException.h | 18 ++------------- src/gdcmFile.cxx | 10 ++++----- src/gdcmHeader.cxx | 37 ++++++++++++------------------ src/gdcmTS.cxx | 2 +- src/gdcmTS.h | 2 +- src/gdcmUtil.cxx | 14 +++--------- src/gdcmUtil.h | 4 ++-- src/iddcmjpeg.h | 4 ++-- vtk/vtkGdcmReader.cxx | 7 +++--- 13 files changed, 80 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index f80be7a1..f020c6d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-07-01 Eric Boix + * gdcmPython/Makefile.am now avoids calling the wrappers for the + clean target. + * src/gdcm*.[cxx|h] : + - to allow compilation with gcc 3.x + -- clean up of STL usage (added explicit usage of std::) + -- small fixes on exceptions. + Note: linking not tested ! + - clean of doxygen comments to avoid warnings at documentation + building stage. + * vtk/vtkGdcmReader.cxx: g++ warning message clean up (platform + dependent convertion). + 2003-06-20 Eric Boix * Clean up of previous JPR garbage commit (not even commented in the Changelog): diff --git a/gdcmPython/Makefile.am b/gdcmPython/Makefile.am index 326c9ef8..b2a47f35 100644 --- a/gdcmPython/Makefile.am +++ b/gdcmPython/Makefile.am @@ -68,7 +68,7 @@ endif### BUILD_PYTHON ####################################### ############ Automake general usage classics: MOSTLYCLEANFILES = $(pygdcm_la_SOURCES) $(vtkgdcmPython_la_SOURCES) BUILT_SOURCES = $(pygdcm_la_SOURCES) $(vtkgdcmPython_la_SOURCES) -CLEANFILES = gdcm_wrap.cxx gdcm.py gdcm.pyc vtkWrapPythonInit +CLEANFILES = gdcm_wrap.cxx gdcm.py gdcm.pyc $(PYTHON_WRAPPER_INIT) dist-hook: rm -f $(distdir)/gdcm_wrap.cxx diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index 0ac31dad..acd88f89 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -43,10 +43,8 @@ gdcmDict::gdcmDict(std::string & FileName) { /** * \ingroup gdcmDict * \brief - * @param - * @return */ - gdcmDict::~gdcmDict() { +gdcmDict::~gdcmDict() { for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) { gdcmDictEntry* EntryToDelete = tag->second; if ( EntryToDelete ) @@ -62,8 +60,7 @@ gdcmDict::gdcmDict(std::string & FileName) { /** * \ingroup gdcmDict * \brief - * @param - * @return + * @param os */ void gdcmDict::Print(std::ostream& os) { PrintByKey(os); @@ -132,7 +129,7 @@ gdcmDictEntry * gdcmDict::GetTagByName(TagName name) { /** * \ingroup gdcmDict * \brief - * @param + * @param NewEntry * @return */ int gdcmDict::ReplaceEntry(gdcmDictEntry* NewEntry) { @@ -146,7 +143,7 @@ int gdcmDict::ReplaceEntry(gdcmDictEntry* NewEntry) { /** * \ingroup gdcmDict * \brief - * @param + * @param NewEntry * @return */ int gdcmDict::AddNewEntry(gdcmDictEntry* NewEntry) { @@ -165,7 +162,7 @@ int gdcmDict::ReplaceEntry(gdcmDictEntry* NewEntry) { /** * \ingroup gdcmDict * \brief - * @param + * @param key * @return */ int gdcmDict::RemoveEntry(TagKey key) { @@ -184,7 +181,8 @@ int gdcmDict::RemoveEntry(TagKey key) { /** * \ingroup gdcmDict * \brief - * @param + * @param group + * @param element * @return */ int gdcmDict::RemoveEntry (guint16 group, guint16 element) { diff --git a/src/gdcmElValSet.cxx b/src/gdcmElValSet.cxx index db65110c..1d6e42b3 100644 --- a/src/gdcmElValSet.cxx +++ b/src/gdcmElValSet.cxx @@ -26,7 +26,7 @@ TagElValueHT & gdcmElValSet::GetTagHt(void) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param newElValue * @return */ void gdcmElValSet::Add(gdcmElValue * newElValue) { @@ -39,7 +39,8 @@ void gdcmElValSet::Add(gdcmElValue * newElValue) { * \ingroup gdcmElValSet * \brief Checks if a given Dicom element exists * \ within a ElValSet - * @param + * @param Group + * @param Elem * @return */ int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem ) { @@ -50,10 +51,8 @@ int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem ) { /** * \ingroup gdcmElValSet * \brief - * @param - * @return */ - void gdcmElValSet::Print(ostream & os) { +void gdcmElValSet::Print(ostream & os) { size_t o; short int g, e; @@ -94,10 +93,8 @@ int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem ) { /** * \ingroup gdcmElValSet * \brief - * @param - * @return */ - void gdcmElValSet::PrintByName(ostream & os) { +void gdcmElValSet::PrintByName(ostream & os) { for (TagElValueNameHT::iterator tag = NameHt.begin(); tag != NameHt.end(); ++tag){ @@ -111,7 +108,8 @@ int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem ) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param group + * @param element * @return */ gdcmElValue* gdcmElValSet::GetElementByNumber(guint16 group, guint16 element) { @@ -124,7 +122,6 @@ gdcmElValue* gdcmElValSet::GetElementByNumber(guint16 group, guint16 element) { /** * \ingroup gdcmElValSet * \brief - * @param * @return */ gdcmElValue* gdcmElValSet::GetElementByName(string TagName) { @@ -136,7 +133,8 @@ gdcmElValue* gdcmElValSet::GetElementByName(string TagName) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param group + * @param element * @return */ string gdcmElValSet::GetElValueByNumber(guint16 group, guint16 element) { @@ -149,7 +147,6 @@ string gdcmElValSet::GetElValueByNumber(guint16 group, guint16 element) { /** * \ingroup gdcmElValSet * \brief - * @param * @return */ string gdcmElValSet::GetElValueByName(string TagName) { @@ -161,7 +158,9 @@ string gdcmElValSet::GetElValueByName(string TagName) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param content + * @param group + * @param element * @return */ int gdcmElValSet::SetElValueByNumber(string content, @@ -186,7 +185,8 @@ int gdcmElValSet::SetElValueByNumber(string content, /** * \ingroup gdcmElValSet * \brief - * @param + * @param content + * @param TagName * @return */ int gdcmElValSet::SetElValueByName(string content, string TagName) { @@ -230,7 +230,9 @@ guint32 gdcmElValSet::GenerateFreeTagKeyInGroup(guint16 group) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param length + * @param group + * @param element * @return */ int gdcmElValSet::SetElValueLengthByNumber(guint32 length, @@ -246,7 +248,8 @@ int gdcmElValSet::SetElValueLengthByNumber(guint32 length, /** * \ingroup gdcmElValSet * \brief - * @param + * @param length + * @param TagName * @return */ int gdcmElValSet::SetElValueLengthByName(guint32 length, string TagName) { @@ -256,15 +259,11 @@ int gdcmElValSet::SetElValueLengthByName(guint32 length, string TagName) { return 1 ; } - -// re-computes the length of a ACR-NEMA/Dicom group -// from a DcmHeader - /** * \ingroup gdcmElValSet - * \brief - * @param - * @return + * \brief Re-computes the length of a ACR-NEMA/Dicom group from a DcmHeader + * @param SkipSequence + * @param type */ void gdcmElValSet::UpdateGroupLength(bool SkipSequence, FileType type) { guint16 gr, el; @@ -358,7 +357,8 @@ void gdcmElValSet::UpdateGroupLength(bool SkipSequence, FileType type) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param type + * @param _fp * @return */ void gdcmElValSet::WriteElements(FileType type, FILE * _fp) { @@ -443,7 +443,8 @@ void gdcmElValSet::WriteElements(FileType type, FILE * _fp) { /** * \ingroup gdcmElValSet * \brief - * @param + * @param _fp + * @param type * @return */ int gdcmElValSet::Write(FILE * _fp, FileType type) { diff --git a/src/gdcmException.h b/src/gdcmException.h index 73710ae0..03d74fb9 100644 --- a/src/gdcmException.h +++ b/src/gdcmException.h @@ -1,17 +1,3 @@ -// gdcmExeption.h - -// gdcmlib Intro: -// * gdcmlib is a library dedicated to reading and writing dicom files. -// * LGPL for the license -// * lightweigth as opposed to CTN or DCMTK which come bundled which try -// to implement the full DICOM standard (networking...). gdcmlib concentrates -// on reading and writing -// * Formats: this lib should be able to read ACR-NEMA v1 and v2, Dicom v3 (as -// stated in part10). [cf dcmtk/dcmdata/docs/datadict.txt] -// * Targeted plateforms: Un*xes and Win32/VC++6.0 -// -// - #ifndef GDCM_EXCEPTION_H #define GDCM_EXCEPTION_H @@ -23,7 +9,7 @@ /** * Any exception thrown in the gdcm library */ -class GDCM_EXPORT gdcmException : public exception { +class GDCM_EXPORT gdcmException : public std::exception { protected: /// error message std::string from; @@ -45,7 +31,7 @@ class GDCM_EXPORT gdcmException : public exception { /** * virtual destructor makes this class dynamic */ - virtual ~gdcmException() { + virtual ~gdcmException() throw() { } /// returns error message diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 1e2ca155..b4741892 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -183,7 +183,7 @@ bool gdcmFile::ReadPixelData(void* destination) { // la ligne commentee ci-dessous fait passer l'exec de 0.15 sec a 5.5 sec // pour la meme image 512*512 ... // optimiseur pas mis en oeuvre (?) - //for (int i=0; i #include @@ -26,10 +26,8 @@ using namespace std; /** * \ingroup gdcmHeader * \brief - * @param none - * @return */ - void gdcmHeader::Initialise(void) { +void gdcmHeader::Initialise(void) { dicom_vr = gdcmGlobal::GetVR(); dicom_ts = gdcmGlobal::GetTS(); Dicts = gdcmGlobal::GetDicts(); @@ -40,8 +38,8 @@ using namespace std; /** * \ingroup gdcmHeader * \brief - * @param - * @return + * @param InFilename + * @param exception_on_error */ gdcmHeader::gdcmHeader(const char *InFilename, bool exception_on_error) { SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_); @@ -57,10 +55,9 @@ using namespace std; /** * \ingroup gdcmHeader * \brief - * @param - * @return + * @param exception_on_error */ - gdcmHeader::gdcmHeader(bool exception_on_error) { +gdcmHeader::gdcmHeader(bool exception_on_error) { SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_); Initialise(); } @@ -68,7 +65,7 @@ using namespace std; /** * \ingroup gdcmHeader * \brief - * @param + * @param exception_on_error * @return */ bool gdcmHeader::OpenFile(bool exception_on_error) @@ -87,10 +84,9 @@ using namespace std; /** * \ingroup gdcmHeader * \brief - * @param * @return */ - bool gdcmHeader::CloseFile(void) { +bool gdcmHeader::CloseFile(void) { int closed = fclose(fp); fp = (FILE *)0; if (! closed) @@ -100,11 +96,9 @@ using namespace std; /** * \ingroup gdcmHeader - * \brief - * @param - * @return + * \brief Canonical destructor. */ - gdcmHeader::~gdcmHeader (void) { +gdcmHeader::~gdcmHeader (void) { dicom_vr = (gdcmVR*)0; Dicts = (gdcmDictSet*)0; RefPubDict = (gdcmDict*)0; @@ -281,10 +275,8 @@ void gdcmHeader::CheckSwap() /** * \ingroup gdcmHeader * \brief - * @param - * @return */ - void gdcmHeader::SwitchSwapToBigEndian(void) { +void gdcmHeader::SwitchSwapToBigEndian(void) { dbg.Verbose(1, "gdcmHeader::SwitchSwapToBigEndian", "Switching to BigEndian mode."); if ( sw == 0 ) { @@ -1541,10 +1533,10 @@ int gdcmHeader::SetShaElValByNumber(string content, * \brief Accesses an existing gdcmElValue in the ShaElValSet of this instance * through tag name and modifies it's content with the given value. * @param content new value to substitute with - * @param TagName name of the tag to be modified + * @param ShadowTagName name of the tag to be modified */ -int gdcmHeader::SetShaElValByName(string content, string TagName) { - return ( ShaElValSet.SetElValueByName (content, TagName) ); +int gdcmHeader::SetShaElValByName(string content, string ShadowTagName) { + return ( ShaElValSet.SetElValueByName (content, ShadowTagName) ); } /** @@ -1958,7 +1950,6 @@ float gdcmHeader::GetYImagePosition(void) { if( sscanf( StrImPos.c_str(), "%f\\%f\\%f", &xImPos, &yImPos, &zImPos) != 3) // How to tell the caller a wrong number of values was found? return 0.; - //else return yImPos; } diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index ebcd65a6..7f504385 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -38,6 +38,6 @@ int gdcmTS::Count(TSKey key) { return ts.count(key); } -string gdcmTS::GetValue(TSKey key) { +std::string gdcmTS::GetValue(TSKey key) { return ts[key]; } diff --git a/src/gdcmTS.h b/src/gdcmTS.h index 0aa14c3d..14d4909c 100644 --- a/src/gdcmTS.h +++ b/src/gdcmTS.h @@ -21,7 +21,7 @@ public: gdcmTS(void); ~gdcmTS(); int Count(TSKey key); - string GetValue(TSKey key); + std::string GetValue(TSKey key); }; #endif diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index f8d5144f..82b0e570 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -1,4 +1,4 @@ -// $Header: /cvs/public/gdcm/src/gdcmUtil.cxx,v 1.13 2003/06/26 13:07:01 jpr Exp $ +// $Header: /cvs/public/gdcm/src/gdcmUtil.cxx,v 1.14 2003/07/01 10:04:36 frog Exp $ #include #include // For isspace @@ -16,23 +16,15 @@ gdcmDebug::gdcmDebug(int level) { void gdcmDebug::Verbose(int Level, const char * Msg1, const char * Msg2) { if (Level > DebugLevel) return ; - cerr << Msg1 << ' ' << Msg2 << '\n'; -} - -/* -void gdcmDebug::Verbose(int Level, char * Msg1, char * Msg2) { - if (Level > DebugLevel) - return ; - cerr << Msg1 << ' ' << Msg2 << '\n'; + std::cerr << Msg1 << ' ' << Msg2 << '\n'; } -*/ void gdcmDebug::Assert(int Level, bool Test, const char * Msg1, const char * Msg2) { if (Level > DebugLevel) return ; if (!Test) - cerr << Msg1 << ' ' << Msg2 << '\n'; + std::cerr << Msg1 << ' ' << Msg2 << '\n'; } void gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2) { diff --git a/src/gdcmUtil.h b/src/gdcmUtil.h index d50b1e41..ea5eb165 100644 --- a/src/gdcmUtil.h +++ b/src/gdcmUtil.h @@ -1,4 +1,4 @@ -// $Header: /cvs/public/gdcm/src/gdcmUtil.h,v 1.12 2003/06/26 13:07:01 jpr Exp $ +// $Header: /cvs/public/gdcm/src/gdcmUtil.h,v 1.13 2003/07/01 10:04:36 frog Exp $ #ifndef GDCMUTIL_H #define GDCMUTIL_H @@ -46,7 +46,7 @@ void Tokenize (const std::string& str, extern gdcmDebug dbg; char * _cleanString(char *v); -char * _CreateCleanString(string s); +char * _CreateCleanString(std::string s); std::string TranslateToKey(guint16 group, guint16 element); diff --git a/src/iddcmjpeg.h b/src/iddcmjpeg.h index 7844354c..d41cacfb 100644 --- a/src/iddcmjpeg.h +++ b/src/iddcmjpeg.h @@ -1,5 +1,5 @@ -#include -#include +#include // for FILE +#include #define BOOL int diff --git a/vtk/vtkGdcmReader.cxx b/vtk/vtkGdcmReader.cxx index 0b54a4cd..a3e871f7 100644 --- a/vtk/vtkGdcmReader.cxx +++ b/vtk/vtkGdcmReader.cxx @@ -1,5 +1,4 @@ -// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.12 2003/06/17 08:07:23 regrain Exp $ -//CLEANME#include +// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.13 2003/07/01 10:04:37 frog Exp $ #include #include #include @@ -411,9 +410,9 @@ void vtkGdcmReader::ExecuteData(vtkDataObject *output) // Variables for the UpdateProgress. We shall use 50 steps to signify // the advance of the process: - unsigned long UpdateProgressTarget = (unsigned long) this->NumLines + unsigned long UpdateProgressTarget = (unsigned long) ceil (this->NumLines * this->TotalNumberOfPlanes - / 50.0; + / 50.0); // The actual advance measure: unsigned long UpdateProgressCount = 0; -- 2.48.1