on Error/Warning/Debug and too on Progression.
So more callback types can be added
* Change the gdcm::Debug macros to have the Command call
* Change the method names in gdcm::Debug to be more correct of their
goal
-- BeNours
TestUtil.cxx
TestBug.cxx
TestHash.cxx
+ TestCommand.cxx
TestTS.cxx
TestVR.cxx
TestDictGroupName.cxx
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: TestCommand.cxx,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20: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 "gdcmCommand.h"
+#include "gdcmCallbackCommand.h"
+#include "gdcmCommandManager.h"
+
+#include <iostream>
+#include <typeinfo.h>
+
+class CommandTest : public gdcm::Command
+{
+ gdcmTypeMacro(CommandTest);
+ gdcmNewMacro(CommandTest);
+
+public:
+ virtual void Execute()
+ {
+ std::cout << "Test class command... for "
+ << typeid(GetObject()).name()
+ << " (" << GetObject() << ")" << std::endl
+ << GetText() << std::endl;
+ Executed = true;
+ }
+
+ bool IsExecuted() {return Executed;}
+
+private:
+ CommandTest() {Executed = false;}
+
+ bool Executed;
+};
+
+static bool fctExecuted = false;
+void CallbackTest(gdcm::CallbackCommand *cmd)
+{
+ std::cout << "Test class command... for "
+ << typeid(cmd->GetObject()).name()
+ << " (" << cmd->GetObject() << ")" << std::endl
+ << cmd->GetText() << std::endl;
+
+ fctExecuted = true;
+}
+
+int TestCommand(int argc, char *argv[])
+{
+ int error=0;
+
+ gdcm::CommandManager *mgr = gdcm::CommandManager::New();
+ CommandTest *cmd = CommandTest::New();
+ gdcm::CallbackCommand *cbk = gdcm::CallbackCommand::New();
+ cbk->SetCallback(CallbackTest);
+
+ mgr->SetCommand(2,cmd);
+ mgr->SetCommand(1,cbk);
+
+ cbk->Delete();
+ cmd->Delete();
+
+ std::cout << "Test on callback function execution\n";
+ mgr->ExecuteCommand(1,"Test on callback function");
+ if(!fctExecuted)
+ std::cout<<"... Failed\n";
+ error+=!fctExecuted;
+ std::cout << std::endl;
+
+ std::cout << "Test on command class execution\n";
+ mgr->ExecuteCommand(2,"Test on command class");
+ if(!cmd->IsExecuted())
+ std::cout<<"... Failed\n";
+ error+=!cmd->IsExecuted();
+ std::cout << std::endl;
+
+ std::cout << "Test on unset command execution\n";
+ mgr->ExecuteCommand(3,"Test on callback function");
+ std::cout << std::endl;
+
+ return error;
+}
Program: gdcm
Module: $RCSfile: TestMakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 14:52:31 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2005/11/28 15:20:29 $
+ 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
#include "gdcmDebug.h"
// ---
-void StartMethod(void *startMethod)
+class CommandStart : public gdcm::Command
{
- (void)startMethod;
- std::cout<<"Start parsing"<<std::endl;
-}
+ gdcmTypeMacro(CommandStart);
+ gdcmNewMacro(CommandStart);
+
+public :
+ virtual void Execute()
+ {
+ std::cerr << "Start parsing" << std::endl;
+ }
+
+protected :
+ CommandStart() {}
+};
+
+class CommandEnd : public gdcm::Command
+{
+ gdcmTypeMacro(CommandEnd);
+ gdcmNewMacro(CommandEnd);
+
+public :
+ virtual void Execute()
+ {
+ std::cerr << "End parsing" << std::endl;
+ }
+
+protected :
+ CommandEnd() {}
+};
+
+class CommandProgress : public gdcm::Command
+{
+ gdcmTypeMacro(CommandProgress);
+ gdcmNewMacro(CommandProgress);
+
+public :
+ virtual void Execute()
+ {
+ gdcm::DicomDir *dd=dynamic_cast<gdcm::DicomDir *>(GetObject());
+
+ if(dd)
+ std::cerr << "Progress parsing (" << dd->GetProgress() << ")" << std::endl;
+ else
+ std::cerr << "Progress parsing (NULL)" << std::endl;
+ }
+
+protected :
+ CommandProgress() {}
+};
void EndMethod(void *endMethod)
{
// new style (user is allowed no to load Sequences an/or Shadow Groups)
dcmdir = gdcm::DicomDir::New( );
+ gdcm::Command *cmd;
+ cmd = CommandStart::New();
+ dcmdir->SetCommand(gdcm::CMD_STARTPROGRESS,cmd);
+ cmd->Delete();
+ cmd = CommandProgress::New();
+ dcmdir->SetCommand(gdcm::CMD_PROGRESS,cmd);
+ cmd->Delete();
+ cmd = CommandEnd::New();
+ dcmdir->SetCommand(gdcm::CMD_ENDPROGRESS,cmd);
+ cmd->Delete();
+
// dcmdir->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
// some images have a wrong length for element 0x0000 of private groups
dcmdir->SetLoadMode(gdcm::LD_NOSEQ);
dcmdir->SetDirectoryName(dirName);
- dcmdir->Load( );
+ dcmdir->Load();
- dcmdir->SetStartMethod(StartMethod);
- dcmdir->SetEndMethod(EndMethod);
-
if ( !dcmdir->GetFirstPatient() )
{
std::cout << "makeDicomDir: no patient found. Exiting."
Program: gdcm
Module: $RCSfile: TestUtil.cxx,v $
Language: C++
- Date: $Date: 2005/11/17 18:01:59 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2005/11/28 15:20:29 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// ----------------------------------------------------------
// Let's test gdcm::Debug, now.
std::cout << "GetDebugFlag : " << gdcm::Debug::GetDebugFlag() <<std::endl;
- gdcm::Debug::SetDebugFilename ("DummyFileNameToWriteTo.txt");
+ gdcm::Debug::SetOutputFileName ("DummyFileNameToWriteTo.txt");
std::cout << "We set a Debug file" <<std::endl;
if ( !gdcm::Debug::GetDebugFlag() )
{
std::cout << "GetDebugFlag : " << gdcm::Debug::GetDebugFlag()<<std::endl;
gdcm::Debug::SetDebugFlag ( false );
std::cout << "GetDebugFlag : " << gdcm::Debug::GetDebugFlag()<<std::endl;
- gdcm::Debug::SetDebugFilename ("DummyFileNameToWriteTo2.txt");
+ gdcm::Debug::SetOutputFileName ("DummyFileNameToWriteTo2.txt");
return 0;
}
SET(libgdcm_la_SOURCES
gdcmArgMgr.cxx
gdcmBase.cxx
+ gdcmCallbackCommand.cxx
+ gdcmCommand.cxx
+ gdcmCommandManager.cxx
gdcmDataEntry.cxx
gdcmDebug.cxx
gdcmDicomDir.cxx
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmCallbackCommand.cxx,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20:35 $
+ 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 "gdcmCallbackCommand.h"
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \brief Constructor used when we want to generate dicom files from scratch
+ */
+CallbackCommand::CallbackCommand()
+{
+ Callback = NULL;
+ CallbackArgDelete = NULL;
+ CallbackArg = NULL;
+}
+
+
+/**
+ * \brief Canonical destructor.
+ */
+CallbackCommand::~CallbackCommand ()
+{
+// SetCallback(NULL,NULL,NULL);
+}
+
+//-----------------------------------------------------------------------------
+// Public
+/**
+ * \brief Set the callback method
+ * @param method Method to call
+ * @param arg Argument to pass to the method
+ * \warning In python : the arg parameter isn't considered
+ */
+/*void CallbackCommand::SetCallback( CallbackCommand::CbkMethod *callback,void *arg )
+{
+ SetCallback(callback,arg,NULL);
+}*/
+
+/**
+ * \brief Set the callback method to delete the argument
+ * The argument is destroyed when the callback method is changed
+ * or when the class is destroyed
+ * @param method Method to call to delete the argument
+ */
+/*void CallbackCommand::SetCallbackArgDelete( CallbackCommand::CbkMethod *callback )
+{
+ CallbackArgDelete = callback;
+}*/
+
+/**
+ * \brief Set the callback method
+ * @param method Method to call
+ * @param arg Argument to pass to the method
+ * @param argDelete Argument
+ * \warning In python : the arg parameter isn't considered
+ */
+/*void CallbackCommand::SetCallback( void(*callback)(void *),
+ void *arg,void(*argDelete)(void *) )
+{
+ if ( CallbackArg && CallbackArgDelete )
+ {
+ CallbackArgDelete( CallbackArg );
+ }
+
+ Callback = callback;
+ CallbackArg = arg;
+ CallbackArgDelete = argDelete;
+}*/
+
+void CallbackCommand::SetCallback(CallbackCommand::CbkMethod *callback)
+{
+ Callback=callback;
+}
+
+void CallbackCommand::Execute()
+{
+ if(Callback)
+ Callback(this);
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmCallbackCommand.h,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20:35 $
+ 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.
+
+=========================================================================*/
+
+#ifndef GDCMCALLBACKCOMMAND_H
+#define GDCMCALLBACKCOMMAND_H
+
+#include "gdcmDebug.h"
+#include "gdcmCommand.h"
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+/**
+ * \brief CallbackCommand base class to react on a gdcm event
+ *
+ * \remarks The execution parameter depends on the
+ */
+class GDCM_EXPORT CallbackCommand : public Command
+{
+ gdcmTypeMacro(CallbackCommand);
+ gdcmNewMacro(CallbackCommand);
+
+public:
+
+ typedef void CbkMethod(CallbackCommand *);
+
+/* // Note: the CallbackCommand:: namespace prefix is needed by Swig in the
+ // following method declarations. Refer to gdcmPython/gdcm.i
+ // for the reasons of this unnecessary notation at C++ level.
+ void SetCallback(CallbackCommand::CbkMethod *callback,void *arg = NULL );
+ void SetCallbackArgDelete(CallbackCommand::CbkMethod *callback);
+ // Note: replace CallbackCommand::Method *method to void(*method)(void *) to
+ // avoid wrapping problems with the typemap conversions
+ void SetCallback(void(*callback)(void *), // CallbackCommand::Method *method
+ void *arg,
+ void(*argDelete)(void *));
+*/
+ void SetCallback(CallbackCommand::CbkMethod *callback);
+
+ virtual void Execute();
+
+protected:
+ CallbackCommand();
+ virtual ~CallbackCommand();
+
+private:
+ /// pointer to the initialisation method for any progress bar
+ CbkMethod *Callback;
+ /// pointer to the ??? method for any progress bar
+ CbkMethod *CallbackArgDelete;
+ /// pointer to the ??? data for any progress bar
+ void *CallbackArg;
+};
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+#endif
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmCommand.cxx,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20:35 $
+ 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 "gdcmCommand.h"
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \brief Constructor used when we want to generate dicom files from scratch
+ */
+Command::Command()
+{
+ Cmd = CMD_UNKNOWN;
+ Object = NULL;
+ ConstObject = NULL;
+ Text = "";
+}
+
+
+/**
+ * \brief Canonical destructor.
+ */
+Command::~Command ()
+{
+}
+
+//-----------------------------------------------------------------------------
+// Public
+void Command::SetType(unsigned int type)
+{
+ Cmd = type;
+}
+
+unsigned int Command::GetType() const
+{
+ return Cmd;
+}
+
+void Command::SetObject(CommandManager *object)
+{
+ Object = object;
+}
+
+CommandManager *Command::GetObject() const
+{
+ return Object;
+}
+
+void Command::SetConstObject(const CommandManager *object)
+{
+ ConstObject = object;
+}
+
+const CommandManager *Command::GetConstObject() const
+{
+ if(ConstObject)
+ return ConstObject;
+ else
+ return GetObject();
+}
+
+void Command::SetText(const std::string &text)
+{
+ Text = text;
+}
+
+const std::string &Command::GetText(void) const
+{
+ return Text;
+}
+
+void Command::Execute()
+{
+}
+
+const char *Command::GetCommandAsString(unsigned int command)
+{
+ switch(command)
+ {
+ case CMD_UNKNOWN:
+ return "Unknown";
+ case CMD_DEBUG:
+ return "Debug";
+ case CMD_WARNING:
+ return "Warning";
+ case CMD_ERROR:
+ return "Error";
+ case CMD_ASSERT:
+ return "Assert";
+ case CMD_STARTPROGRESS:
+ return "StartProgress";
+ case CMD_ENDPROGRESS:
+ return "EndProgress";
+ case CMD_PROGRESS:
+ return "Progress";
+ default:
+ return "Undefined !!!";
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmCommand.h,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20:35 $
+ 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.
+
+=========================================================================*/
+
+#ifndef GDCMCOMMAND_H
+#define GDCMCOMMAND_H
+
+#include "gdcmRefCounter.h"
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+class CommandManager;
+
+//-----------------------------------------------------------------------------
+/// Command list
+enum CommandType {
+ CMD_UNKNOWN =0,
+ CMD_DEBUG,
+ CMD_WARNING,
+ CMD_ERROR,
+ CMD_ASSERT,
+ CMD_STARTPROGRESS,
+ CMD_ENDPROGRESS,
+ CMD_PROGRESS
+};
+
+//-----------------------------------------------------------------------------
+/**
+ * \brief Command base class to react on a gdcm event
+ *
+ * \remarks The execution parameter depends on the
+ */
+class GDCM_EXPORT Command : public RefCounter
+{
+ gdcmTypeMacro(Command);
+ gdcmNewMacro(Command);
+
+public:
+
+ void SetType(unsigned int type);
+ unsigned int GetType() const;
+
+ void SetObject(CommandManager *object);
+ CommandManager *GetObject() const;
+ void SetConstObject(const CommandManager *object);
+ const CommandManager *GetConstObject() const;
+
+ void SetText(const std::string &text);
+ const std::string &GetText() const;
+
+ virtual void Execute();
+
+ static const char *GetCommandAsString(unsigned int command);
+
+protected:
+ Command();
+ virtual ~Command();
+
+private:
+ std::string Text;
+ CommandManager *Object;
+ const CommandManager *ConstObject;
+ unsigned int Cmd;
+};
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+#endif
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmCommandManager.cxx,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20:35 $
+ 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 "gdcmCommandManager.h"
+#include "gdcmCommand.h"
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \brief Constructor used when we want to generate dicom files from scratch
+ */
+CommandManager::CommandManager()
+{
+}
+
+
+/**
+ * \brief Canonical destructor.
+ */
+CommandManager::~CommandManager ()
+{
+}
+
+//-----------------------------------------------------------------------------
+// Public
+void CommandManager::SetCommand(unsigned int type,Command *command)
+{
+ Command *cmd=CommandList[type];
+ if(cmd!=command)
+ {
+ if(cmd)
+ cmd->Unregister();
+ if(command)
+ {
+ CommandList[type]=command;
+ command->Register();
+ }
+ else
+ CommandList.erase(type);
+ }
+}
+
+Command *CommandManager::GetCommand(unsigned int type) const
+{
+ try
+ {
+ return CommandList[type];
+ }
+ catch(...)
+ {
+ return NULL;
+ }
+}
+
+bool CommandManager::ExecuteCommand(unsigned int type,std::string text)
+{
+ Command *cmd = GetCommand(type);
+ if(cmd)
+ {
+ cmd->SetText(text);
+ cmd->SetObject(this);
+ cmd->SetType(type);
+ cmd->Execute();
+ return true;
+ }
+ return false;
+}
+
+bool CommandManager::ConstExecuteCommand(unsigned int type,std::string text) const
+{
+ Command *cmd = GetCommand(type);
+ if(cmd)
+ {
+ cmd->SetText(text);
+ cmd->SetConstObject(this);
+ cmd->SetType(type);
+ cmd->Execute();
+ return true;
+ }
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+void CommandManager::Print(std::ostream &os, std::string const &indent)
+{
+ os<<indent<<"Command list : \n";
+ CommandHT::iterator it;
+ for(it=CommandList.begin();it!=CommandList.end();++it)
+ {
+ os<<indent<<" "<<Command::GetCommandAsString(it->first)
+ <<" : "<<typeid(it->second).name()
+ <<" ("<<it->second<<")"<<std::endl;
+ }
+}
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmCommandManager.h,v $
+ Language: C++
+ Date: $Date: 2005/11/28 15:20:35 $
+ 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.
+
+=========================================================================*/
+
+#ifndef GDCMCOMMANDMANAGER_H
+#define GDCMCOMMANDMANAGER_H
+
+#include "gdcmRefCounter.h"
+
+#include <map>
+#include <iostream>
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+class Command;
+typedef std::map<unsigned int,Command *> CommandHT;
+
+//-----------------------------------------------------------------------------
+/**
+ * \brief CommandManager base class to react on a gdcm event
+ *
+ * \remarks The execution parameter depends on the
+ */
+class GDCM_EXPORT CommandManager : public RefCounter
+{
+ gdcmTypeMacro(CommandManager);
+
+public:
+ /// \brief Contructs an empty Dict with a RefCounter
+ static CommandManager *New() {return new CommandManager();}
+ void Print(std::ostream &os = std::cout, std::string const &indent = "" );
+
+ void SetCommand(unsigned int type,Command *command);
+ Command *GetCommand(unsigned int type) const;
+
+ bool ExecuteCommand(unsigned int type,std::string text = "");
+ bool ConstExecuteCommand(unsigned int type,std::string text = "") const;
+
+protected:
+ CommandManager();
+ ~CommandManager();
+
+private:
+ mutable CommandHT CommandList;
+};
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+#endif
Program: gdcm
Module: $RCSfile: gdcmDebug.cxx,v $
Language: C++
- Date: $Date: 2005/11/05 13:21:32 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ Version: $Revision: 1.27 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
=========================================================================*/
#include "gdcmDebug.h"
+#include "gdcmCommandManager.h"
+
#include <iostream>
namespace gdcm
{
//-----------------------------------------------------------------------------
// Warning message level to be displayed
-static bool DebugFlag = false;
-static bool WarningFlag = false;
-static bool DebugToFile = false;
-static std::ofstream DebugFile;
+const int Debug::LINE_LENGTH = 79;
+
+bool Debug::DebugFlag = false;
+bool Debug::WarningFlag = false;
+bool Debug::OutputToFile = false;
+
+std::ofstream Debug::OutputFileStream;
+std::ostream &Debug::StandardStream = std::cerr;
//-----------------------------------------------------------------------------
// Constructor / Destructor
Debug::Debug()
{
-
}
Debug::~Debug()
{
- if ( DebugFile.is_open() )
- DebugFile.close();
+ if ( OutputFileStream.is_open() )
+ OutputFileStream.close();
}
//-----------------------------------------------------------------------------
WarningFlag = flag;
}
-/**
- * \brief Gets the debug flag value
- * (used to warn user when file contains some oddity)
- * @return debug flag value
- */
-bool Debug::GetDebugFlag ()
-{
- return DebugFlag;
-}
-
/**
* \brief Sets the warning flag
* @param flag Set the warning flag
WarningFlag = flag;
}
-/**
- * \brief Gets the warning flag value
- * @return warning flag value
- */
-bool Debug::GetWarningFlag ()
-{
- return WarningFlag;
-}
/**
* \brief Accessor
* @param flag whether we want to redirect to file
*/
-void Debug::SetDebugToFile (bool flag)
+void Debug::SetOutputToFile (bool flag)
{
- DebugToFile = flag;
+ OutputToFile = flag;
}
/**
* \brief Accessor to know whether debug info are redirected to file
*/
-bool Debug::GetDebugToFile ()
+bool Debug::GetOutputToFile ()
{
- return DebugToFile;
+ return OutputToFile;
}
/**
* Absolutely nothing is check. You have to pass in
* a correct filename
*/
-void Debug::SetDebugFilename (std::string const &filename)
+void Debug::SetOutputFileName (std::string const &filename)
{
- DebugToFile = true; // Just in case ...
+ OutputToFile = true; // Just in case ...
DebugFlag = true; // Just in case ...
- if ( DebugFile.is_open() )
- DebugFile.close();
- DebugFile.open( filename.c_str() );
+ if ( OutputFileStream.is_open() )
+ OutputFileStream.close();
+ OutputFileStream.open( filename.c_str() );
}
/**
* in gdcm code
* @return Debug file
*/
-std::ofstream &Debug::GetDebugFile ()
+std::ostream &Debug::GetOutput ()
{
- return DebugFile;
+ if(OutputToFile)
+ return OutputFileStream;
+ else
+ return StandardStream;
+}
+
+void Debug::SendToOutput(unsigned int type,std::string const &msg,const CommandManager *mgr)
+{
+ bool executed=false;
+ if(mgr)
+ executed=mgr->ConstExecuteCommand(type,msg);
+
+ if(!executed)
+ GetOutput() << Command::GetCommandAsString(type) << ": " << msg;
}
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDebug.h,v $
Language: C++
- Date: $Date: 2005/11/05 13:21:32 $
- Version: $Revision: 1.47 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ 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
#define GDCMDEBUG_H
#include "gdcmCommon.h"
+#include "gdcmCommand.h"
#include <iostream>
#include <sstream>
namespace gdcm
{
//-----------------------------------------------------------------------------
+class CommandManager;
+//-----------------------------------------------------------------------------
/**
* \brief Debug is an object for debugging in program.
* It has 2 debugging modes :
/// \brief This is a global flag that controls whether
/// both debug and warning messages are displayed.
+ /// (used to warn user when file contains some oddity)
static void SetDebugFlag (bool flag);
- static bool GetDebugFlag ();
+ /// \brief Gets the debug flag value
+ static bool GetDebugFlag () {return DebugFlag;}
/// \brief Sets the Debug Flag to true
static void DebugOn () { SetDebugFlag(true); }
/// \brief Sets the Debug Flag to false
/// \brief This is a global flag that controls whether
/// warning messages are displayed.
static void SetWarningFlag (bool flag);
- static bool GetWarningFlag ();
+ /// \brief Gets the warning flag value
+ static bool GetWarningFlag () {return WarningFlag;}
/// \brief Sets the Warning Flag to true
static void WarningOn () { SetWarningFlag(true); }
/// \brief Sets the Warning Flag to false
/// \brief This is a global flag that controls if debug are redirected
/// to a file or not
- static void SetDebugToFile (bool flag);
- static bool GetDebugToFile ();
+ static void SetOutputToFile (bool flag);
+ static bool GetOutputToFile ();
/// \brief Next debug messages will be sent in the debug file
- static void DebugToFileOn () { SetDebugToFile(true); }
+ static void OutputToFileOn () { SetOutputToFile(true); }
/// \brief Next debug messages will be sent in the standard output
- static void DebugToFileOff () { SetDebugToFile(false); }
+ static void OutputToFileOff () { SetOutputToFile(false); }
+
+ static void SetOutputFileName (std::string const &filename);
+
+ static std::ostream &GetOutput ();
+
+ static void SendToOutput(unsigned int type,std::string const &msg,const CommandManager *mgr = NULL);
- static void SetDebugFilename (std::string const &filename);
+private:
+ static bool DebugFlag;
+ static bool WarningFlag;
+ static bool OutputToFile;
- static std::ofstream &GetDebugFile ();
+ static std::ofstream OutputFileStream;
+ static std::ostream &StandardStream;
+
+ static const int LINE_LENGTH;
};
} // end namespace gdcm
* \brief Debug : To be used to help bug tracking developer
* @param msg message part
*/
+#define gdcmMessageBodyMacro(type,obj,msg,adds) \
+{ \
+ std::ostringstream osmacro; \
+ osmacro << "In " __FILE__ ", line " << __LINE__ \
+ << ", function " << GDCM_FUNCTION << "\n" \
+ << adds << msg << "\n\n"; \
+ gdcm::Debug::SendToOutput(type,osmacro.str(),obj); \
+}
+
+/**
+ * \brief Debug : To be used to help bug tracking developer
+ * @param msg message part
+ */
#ifdef NDEBUG
+#define gdcmDebugBodyMacro(obj,msg) {}
#define gdcmDebugMacro(msg) {}
+#define gdcmStaticDebugMacro(msg) {}
#else
-#define gdcmDebugMacro(msg) \
-{ \
- if( Debug::GetDebugFlag() ) \
- { \
- std::ostringstream osmacro; \
- osmacro << "Debug: In " __FILE__ ", line " << __LINE__ \
- << ", function " << GDCM_FUNCTION << '\n'; \
- if( errno ) \
- osmacro << "Last system error was: " << \
- strerror(errno) << '\n'; \
- osmacro << msg << "\n\n"; \
- if( Debug::GetDebugToFile() ) \
- Debug::GetDebugFile() << osmacro.str() << std::endl; \
- else \
- std::cerr << osmacro.str() << std::endl; \
- } \
+#define gdcmDebugBodyMacro(obj,msg) \
+{ \
+ if( Debug::GetDebugFlag() ) \
+ { \
+ std::string adds=""; \
+ if( errno ) \
+ { \
+ adds = "Last system error was: "; \
+ adds += strerror(errno); \
+ adds += "\n"; \
+ } \
+ gdcmMessageBodyMacro(gdcm::CMD_DEBUG,obj,msg,adds); \
+ } \
}
+#define gdcmDebugMacro(msg) \
+ gdcmDebugBodyMacro(this,msg)
+#define gdcmStaticDebugMacro(msg) \
+ gdcmDebugBodyMacro(NULL,msg)
#endif //NDEBUG
/**
- * \brief Warning : To be used to warn the user when some oddity occurs
+ * \brief Warning : To be used to warn the user when some oddity occurs
* @param msg message part
*/
-#ifdef NDEBUG
-#define gdcmWarningMacro(msg) {}
-#else
-#define gdcmWarningMacro(msg) \
-{ \
- if( Debug::GetWarningFlag() ) \
- { \
- std::ostringstream osmacro; \
- osmacro << "Warning: In " __FILE__ ", line " << __LINE__ \
- << ", function " << GDCM_FUNCTION << "\n" \
- << msg << "\n\n"; \
- if( Debug::GetDebugToFile() ) \
- Debug::GetDebugFile() << osmacro.str() << std::endl; \
- else \
- std::cerr << osmacro.str() << std::endl; \
- } \
+// No NDEBUG test to always have a return of warnings !!!
+#define gdcmWarningBodyMacro(obj,msg) \
+{ \
+ if( Debug::GetWarningFlag() ) \
+ gdcmMessageBodyMacro(gdcm::CMD_WARNING,obj,msg,""); \
}
-#endif //NDEBUG
+#define gdcmWarningMacro(msg) \
+ gdcmWarningBodyMacro(this,msg)
+#define gdcmStaticWarningMacro(msg) \
+ gdcmWarningBodyMacro(NULL,msg)
/**
* \brief Error : To be used when unecoverabale error occurs
* at a 'deep' level. (don't use it if file is not ACR/DICOM!)
* @param msg second message part
*/
-#ifdef NDEBUG
-#define gdcmErrorMacro(msg) {}
-#else
-#define gdcmErrorMacro(msg) \
-{ \
- std::ostringstream osmacro; \
- osmacro << "Error: In " __FILE__ ", line " << __LINE__ \
- << ", function " << GDCM_FUNCTION << '\n' \
- << msg << "\n\n"; \
- if( Debug::GetDebugToFile() ) \
- Debug::GetDebugFile() << osmacro.str() << std::endl; \
- else \
- std::cerr << osmacro.str() << std::endl; \
+// No NDEBUG test to always have a return of errors !!!
+#define gdcmErrorBodyMacro(obj,msg) \
+{ \
+ gdcmMessageBodyMacro(gdcm::CMD_ERROR,obj,msg,""); \
}
-#endif //NDEBUG
+#define gdcmErrorMacro(msg) \
+ gdcmErrorBodyMacro(this,msg)
+#define gdcmStaticErrorMacro(msg) \
+ gdcmErrorBodyMacro(NULL,msg)
/**
- * \brief Assert : To be used when an *absolutely* impossible error occurs
- * No function should be allowed to stop the process instead of
- * warning the caller!
+ * \brief Assert : To be used when an *absolutely* impossible error occurs
+ * No function should be allowed to stop the process instead of
+ * warning the caller!
* @param arg argument to test
* An easy solution to pass also a message is to do:
* gdcmAssertMacro( "my message" && 2 < 3 )
*/
-#ifdef NDEBUG
-#define gdcmAssertMacro(arg) {}
-#else
-#define gdcmAssertMacro(arg) \
-{ \
- if( !(arg) ) \
- { \
- std::ostringstream osmacro; \
- osmacro << "Assert: In " __FILE__ ", line " << __LINE__ \
- << ", function " << GDCM_FUNCTION \
- << "\n\n"; \
- if( Debug::GetDebugToFile() ) \
- Debug::GetDebugFile() << osmacro.str() << std::endl; \
- else \
- std::cerr << osmacro.str() << std::endl; \
- assert ( arg ); \
- } \
+// No NDEBUG test to always have a return of asserts !!!
+#define gdcmAssertBodyMacro(obj,arg) \
+{ \
+ if( !(arg) ) \
+ { \
+ gdcmMessageBodyMacro(gdcm::CMD_ASSERT,obj,"",""); \
+ assert ( arg ); \
+ } \
}
-#endif //NDEBUG
+#define gdcmAssertMacro(msg) \
+ gdcmAssertBodyMacro(this,msg)
+#define gdcmStaticAssertMacro(msg) \
+ gdcmAssertBodyMacro(NULL,msg)
//-----------------------------------------------------------------------------
-//
-// Define GDCM_LEGACY macro to mark legacy methods where they are
-// declared in their class.
-//
-// WARNING : Don't try to use it with 'inline' methods !
-//
-//Example usage:
-//
-// // @deprecated Replaced by MyOtherMethod() as of gdcm 2.0.
-// GDCM_LEGACY(void MyMethod());
-#if defined(GDCM_LEGACY_REMOVE)
- // Remove legacy methods completely.
-# define GDCM_LEGACY(method)
-#elif defined(GDCM_LEGACY_SILENT) || defined(SWIG)
- // Provide legacy methods with no warnings.
-# define GDCM_LEGACY(method) method
-#else
- // Setup compile-time warnings for uses of deprecated methods if
- // possible on this compiler.
-# if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
-#if defined(__APPLE__) && (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
-// Seems like there is a bug in APPLE gcc for deprecated attribute and ctor
-// This is fixed in g++ 4.0 (Tiger)
-# define GDCM_LEGACY(method) method
-#else
-# define GDCM_LEGACY(method) method __attribute__((deprecated))
-#endif
-# elif defined(_MSC_VER) && _MSC_VER >= 1300
-# define GDCM_LEGACY(method) __declspec(deprecated) method
-# else
-# define GDCM_LEGACY(method) method
-# endif
-#endif
-
-// Macros to create runtime deprecation warning messages in function
-// bodies. Example usage:
-//
-// void MyClass::MyOldMethod()
-// {
-// GDCM_LEGACY_BODY(MyClass::MyOldMethod, 2.0);
-// }
-//
-// void MyClass::MyMethod()
-// {
-// GDCM_LEGACY_REPLACED_BODY(MyClass::MyMethod, 5.0,
-// MyClass::MyOtherMethod);
-// }
-#if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
-# define GDCM_LEGACY_BODY(method, version)
-# define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
-#else
-# define GDCM_LEGACY_BODY(method, version) \
- gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version.")
-# define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
- gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version. Use " #replace " instead.")
-#endif
-
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:25 $
- Version: $Revision: 1.173 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ Version: $Revision: 1.174 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
DicomDir::~DicomDir()
{
- SetStartMethod(NULL,NULL,NULL);
- SetProgressMethod(NULL,NULL,NULL);
- SetEndMethod(NULL,NULL,NULL);
-
ClearPatient();
if ( MetaElems )
{
CreateDicomDir();
}
-void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg )
-{
- SetStartMethod(method,arg,NULL);
-}
-
-void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg )
-{
- SetProgressMethod(method,arg,NULL);
-}
-
-void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg )
-{
- SetEndMethod(method,arg,NULL);
-}
-
-/**
- * \brief Set the start method to call when the parsing of the
- * directory starts.
- * @param method Method to call
- * @param arg Argument to pass to the method
- * @param argDelete Argument
- * \warning In python : the arg parameter isn't considered
- */
-void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg,
- DicomDir::Method *argDelete )
-{
- if ( StartArg && StartMethodArgDelete )
- {
- StartMethodArgDelete( StartArg );
- }
-
- StartMethod = method;
- StartArg = arg;
- StartMethodArgDelete = argDelete;
-}
-
-
-/**
- * \brief Set the progress method to call when the parsing of the
- * directory progress
- * @param method Method to call
- * @param arg Argument to pass to the method
- * @param argDelete Argument
- * \warning In python : the arg parameter isn't considered
- */
-void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg,
- DicomDir::Method *argDelete )
-{
- if ( ProgressArg && ProgressMethodArgDelete )
- {
- ProgressMethodArgDelete( ProgressArg );
- }
-
- ProgressMethod = method;
- ProgressArg = arg;
- ProgressMethodArgDelete = argDelete;
-}
-
-/**
- * \brief Set the end method to call when the parsing of the directory ends
- * @param method Method to call
- * @param arg Argument to pass to the method
- * @param argDelete Argument
- * \warning In python : the arg parameter isn't considered
- */
-void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg,
- DicomDir::Method *argDelete )
-{
- if ( EndArg && EndMethodArgDelete )
- {
- EndMethodArgDelete( EndArg );
- }
-
- EndMethod = method;
- EndArg = arg;
- EndMethodArgDelete = argDelete;
-}
-
-/**
- * \brief Set the method to delete the argument
- * The argument is destroyed when the method is changed or when the
- * class is destroyed
- * @param method Method to call to delete the argument
- */
-void DicomDir::SetStartMethodArgDelete( DicomDir::Method *method )
-{
- StartMethodArgDelete = method;
-}
-
-/**
- * \brief Set the method to delete the argument
- * The argument is destroyed when the method is changed or when the
- * class is destroyed
- * @param method Method to call to delete the argument
- */
-void DicomDir::SetProgressMethodArgDelete( DicomDir::Method *method )
-{
- ProgressMethodArgDelete = method;
-}
-
-/**
- * \brief Set the method to delete the argument
- * The argument is destroyed when the method is changed or when
- * the class is destroyed
- * @param method Method to call to delete the argument
- */
-void DicomDir::SetEndMethodArgDelete( DicomDir::Method *method )
-{
- EndMethodArgDelete = method;
-}
-
/**
* \brief writes on disc a DICOMDIR
* \ warning does NOT add the missing elements in the header :
{
Progress = 0.0f;
Abort = false;
- if ( StartMethod )
- {
- StartMethod( StartArg );
- }
+ ExecuteCommand(CMD_STARTPROGRESS);
}
/**
*/
void DicomDir::CallProgressMethod()
{
- if ( ProgressMethod )
- {
- ProgressMethod( ProgressArg );
- }
+ ExecuteCommand(CMD_PROGRESS);
}
/**
void DicomDir::CallEndMethod()
{
Progress = 1.0f;
- if ( EndMethod )
- {
- EndMethod( EndArg );
- }
+ ExecuteCommand(CMD_ENDPROGRESS);
}
//-----------------------------------------------------------------------------
*/
void DicomDir::Initialize()
{
- StartMethod = NULL;
- ProgressMethod = NULL;
- EndMethod = NULL;
- StartMethodArgDelete = NULL;
- ProgressMethodArgDelete = NULL;
- EndMethodArgDelete = NULL;
- StartArg = NULL;
- ProgressArg = NULL;
- EndArg = NULL;
-
Progress = 0.0;
Abort = false;
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:25 $
- Version: $Revision: 1.70 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ Version: $Revision: 1.71 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// \brief Constructs a DicomDir with a RefCounter
static DicomDir *New() {return new DicomDir();}
- typedef void Method(void*);
-
bool Load( );
void Print(std::ostream &os = std::cout, std::string const &indent = "" );
// Parsing
void ParseDirectory();
- // Note: the DicomDir:: namespace prefix is needed by Swig in the
- // following method declarations. Refer to gdcmPython/gdcm.i
- // for the reasons of this unnecessary notation at C++ level.
- void SetStartMethod( DicomDir::Method *method,
- void *arg = NULL );
- void SetProgressMethod( DicomDir::Method *method,
- void *arg = NULL );
- void SetEndMethod( DicomDir::Method *method,
- void *arg = NULL );
- // Note: replace DicomDir::Method *method to void(*method)(void *) to
- // avoid wrapping problems with the typemap conversions
- void SetStartMethod( void(*method)(void *), // DicomDir::Method *method
- void *arg,
- void(*argDelete)(void *));
- void SetProgressMethod( void(*method)(void *), // DicomDir::Method *method
- void *arg,
- void(*argDelete)(void *));
- void SetEndMethod( void(*method)(void *), // DicomDir::Method *method
- void *arg,
- void(*argDelete)(void *));
- void SetStartMethodArgDelete ( DicomDir::Method *method );
- void SetProgressMethodArgDelete( DicomDir::Method *method );
- void SetEndMethodArgDelete ( DicomDir::Method *method );
-
/// GetProgress GetProgress
- float GetProgress() { return Progress; }
+ float GetProgress() const { return Progress; }
/// AbortProgress AbortProgress
void AbortProgress() { Abort = true; }
/// IsAborted IsAborted
ListDicomDirPatient Patients;
ListDicomDirPatient::iterator ItPatient;
- /// pointer to the initialisation method for any progress bar
- Method *StartMethod;
- /// pointer to the incrementation method for any progress bar
- Method *ProgressMethod;
- /// pointer to the termination method for any progress bar
- Method *EndMethod;
- /// pointer to the ??? method for any progress bar
- Method *StartMethodArgDelete;
- /// pointer to the ??? method for any progress bar
- Method* ProgressMethodArgDelete;
- /// pointer to the ??? method for any progress bar
- Method *EndMethodArgDelete;
- /// pointer to the ??? for any progress bar
- void *StartArg;
- /// pointer to the ??? for any progress bar
- void *ProgressArg;
- /// pointer to the ??? for any progress bar
- void *EndArg;
/// value of the ??? for any progress bar
float Progress;
/// value of the ??? for any progress bar
- bool Abort;
bool ParseDir;
+
+ mutable bool Abort;
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:25 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICOMDIRELEMENT_H
#define GDCMDICOMDIRELEMENT_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include <list>
* \brief Represents elements contained in a DicomDir class
* for the chained lists from the file 'Dicts/DicomDir.dic'
*/
-class GDCM_EXPORT DicomDirElement : public RefCounter
+class GDCM_EXPORT DicomDirElement : public CommandManager
{
gdcmTypeMacro(DicomDirElement);
Program: gdcm
Module: $RCSfile: gdcmDicomEntry.h,v $
Language: C++
- Date: $Date: 2005/10/23 15:32:30 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ 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
#define GDCMDICOMENTRY_H
#include "gdcmCommon.h"
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include "gdcmVRKey.h"
#include "gdcmTagKey.h"
* - the VM (Value Multiplicity)
* - the corresponding name in english
*/
-class GDCM_EXPORT DicomEntry : public RefCounter
+class GDCM_EXPORT DicomEntry : public CommandManager
{
gdcmTypeMacro(DicomEntry);
Program: gdcm
Module: $RCSfile: gdcmDict.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:25 $
- Version: $Revision: 1.46 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ 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
#ifndef GDCMDICT_H
#define GDCMDICT_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include "gdcmDictEntry.h"
#include <iostream>
* combined with all software versions...
* \see DictSet
*/
-class GDCM_EXPORT Dict : public RefCounter
+class GDCM_EXPORT Dict : public CommandManager
{
gdcmTypeMacro(Dict);
Program: gdcm
Module: $RCSfile: gdcmDictGroupName.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:26 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2005/11/28 15:20:32 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICTGROUPNAME_H
#define GDCMDICTGROUPNAME_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include <map>
#include <string>
* (formerly NIH defined ACR-NEMA group name)
* \note This is a singleton.
*/
-class GDCM_EXPORT DictGroupName : public RefCounter
+class GDCM_EXPORT DictGroupName : public CommandManager
{
gdcmTypeMacro(DictGroupName);
Program: gdcm
Module: $RCSfile: gdcmDictSet.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 14:52:34 $
- Version: $Revision: 1.72 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.73 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if (envPath && (strlen(envPath) != 0))
{
resultPath = envPath;
- gdcmWarningMacro( "Dictionary path set from environnement");
+ gdcmStaticWarningMacro( "Dictionary path set from environnement");
}
else
{
Program: gdcm
Module: $RCSfile: gdcmDictSet.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:26 $
- Version: $Revision: 1.50 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.51 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICTSET_H
#define GDCMDICTSET_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include "gdcmDict.h"
#include <map>
* - having many in memory representations of the same dictionary
* (saving memory).
*/
-class GDCM_EXPORT DictSet : public RefCounter
+class GDCM_EXPORT DictSet : public CommandManager
{
gdcmTypeMacro(DictSet);
Program: gdcm
Module: $RCSfile: gdcmDirList.cxx,v $
Language: C++
- Date: $Date: 2005/11/25 18:47:34 $
- Version: $Revision: 1.53 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.54 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
bool DirList::IsDirectory(std::string const &dirName)
{
- struct stat fs;
- assert( dirName[dirName.size()-1] != '/' );
- if ( stat(dirName.c_str(), &fs) == 0 )
- {
+ struct stat fs;
+ assert( dirName[dirName.size()-1] != '/' );
+ if ( stat(dirName.c_str(), &fs) == 0 )
+ {
#if _WIN32
- return ((fs.st_mode & _S_IFDIR) != 0);
+ return ((fs.st_mode & _S_IFDIR) != 0);
#else
- return S_ISDIR(fs.st_mode);
+ return S_ISDIR(fs.st_mode);
#endif
- }
- else
- {
- const char *str = strerror(errno);
- gdcmErrorMacro( str );
- return false;
- }
+ }
+ else
+ {
+ const char *str = strerror(errno);
+ gdcmStaticErrorMacro( str );
+ return false;
+ }
}
//-----------------------------------------------------------------------------
DWORD dwError = GetLastError();
if (hFile != INVALID_HANDLE_VALUE) FindClose(hFile);
if (dwError != ERROR_NO_MORE_FILES)
- {
- gdcmErrorMacro("FindNextFile error. Error is " << dwError);
- return -1;
- }
+ {
+ gdcmErrorMacro("FindNextFile error. Error is " << dwError);
+ return -1;
+ }
#else
// Real POSIX implementation: scandir is a BSD extension only, and doesn't
{
fileName = dirName + d->d_name;
if( stat(fileName.c_str(), &buf) != 0 )
- {
- const char *str = strerror(errno);
- gdcmErrorMacro( str );
- }
+ {
+ const char *str = strerror(errno);
+ gdcmErrorMacro( str );
+ }
if ( S_ISREG(buf.st_mode) ) //is it a regular file?
{
Filenames.push_back( fileName );
}
}
if( closedir(dir) != 0 )
- {
- const char *str = strerror(errno);
- gdcmErrorMacro( str );
- }
+ {
+ const char *str = strerror(errno);
+ gdcmErrorMacro( str );
+ }
#endif
return numberOfFiles;
Program: gdcm
Module: $RCSfile: gdcmDirList.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:26 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ 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
#define GDCMDIRLIST_H
#include "gdcmCommon.h"
+#include "gdcmCommandManager.h"
#include <string>
#include <vector>
* \brief List containing the file headers of all the 'gdcm readable' files
* found by exploring (possibely recursively) a root directory.
*/
-class GDCM_EXPORT DirList
+class GDCM_EXPORT DirList : public CommandManager
{
public :
DirList(std::string const &dirName, bool recursive=false);
Program: gdcm
Module: $RCSfile: gdcmDocEntry.h,v $
Language: C++
- Date: $Date: 2005/11/07 09:46:36 $
- Version: $Revision: 1.56 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.57 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDOCENTRY_H
#define GDCMDOCENTRY_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include "gdcmDictEntry.h"
#include <iostream>
* \brief The dicom header of a Dicom file contains a set of such entries
* (when successfuly parsed against a given Dicom dictionary)
*/
-class GDCM_EXPORT DocEntry : public RefCounter
+class GDCM_EXPORT DocEntry : public CommandManager
{
gdcmTypeMacro(DocEntry);
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:26 $
- Version: $Revision: 1.63 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.64 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDOCENTRYSET_H
#define GDCMDOCENTRYSET_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include "gdcmVRKey.h"
#include "gdcmTagKey.h"
* members to this class since this class is designed as an adapter
* in the form of an abstract base class.
*/
-class GDCM_EXPORT DocEntrySet : public RefCounter
+class GDCM_EXPORT DocEntrySet : public CommandManager
{
gdcmTypeMacro(DocEntrySet);
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2005/11/22 20:26:06 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ 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
#define GDCMFILEHELPER_H
#include "gdcmDebug.h"
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
namespace gdcm
* for accessing the image/volume content. One can also use it to
* write Dicom/ACR-NEMA/RAW files.
*/
-class GDCM_EXPORT FileHelper : public RefCounter
+class GDCM_EXPORT FileHelper : public CommandManager
{
gdcmTypeMacro(FileHelper);
Program: gdcm
Module: $RCSfile: gdcmGlobal.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 14:52:35 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ 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
{
if (ValRes || TranSyn || Dicts || ddElem)
{
- gdcmWarningMacro( "VR or TS or Dicts already allocated");
+ gdcmStaticWarningMacro( "VR or TS or Dicts already allocated");
return;
}
Dicts = DictSet::New();
Program: gdcm
Module: $RCSfile: gdcmJPEGFragment.cxx,v $
Language: C++
- Date: $Date: 2005/02/04 16:51:36 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ 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
// NOT the compression method
// other JPEG lossy not supported
- gdcmErrorMacro( "Unknown jpeg lossy compression ");
+ gdcmStaticErrorMacro( "Unknown jpeg lossy compression ");
}
}
Program: gdcm
Module: $RCSfile: gdcmJPEGFragmentsInfo.cxx,v $
Language: C++
- Date: $Date: 2005/02/01 10:29:55 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
JPEGFragment *JPEGFragmentsInfo::GetNextFragment()
{
- gdcmAssertMacro (ItFragments != Fragments.end());
+ gdcmStaticAssertMacro (ItFragments != Fragments.end());
++ItFragments;
if (ItFragments != Fragments.end())
Program: gdcm
Module: $RCSfile: gdcmJpeg.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 19:06:30 $
- Version: $Revision: 1.51 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ Version: $Revision: 1.52 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// If we get here, the JPEG code has signaled an error.
// We need to clean up the JPEG object, close the input file, and return.
- gdcmErrorMacro( "Serious Problem !" );
+ gdcmStaticErrorMacro( "Serious Problem !" );
jpeg_destroy_decompress(&cinfo);
return 0;
}
Program: gdcm
Module: $RCSfile: gdcmJpeg2000.cxx,v $
Language: C++
- Date: $Date: 2005/11/04 15:20:13 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2005/11/28 15:20:33 $
+ 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
// Decompression
if (!j2k_decode(src, len, &img, &cp))
{
- gdcmErrorMacro( "ERROR -> j2k_to_image: failed to decode image!" );
+ gdcmStaticErrorMacro( "ERROR -> j2k_to_image: failed to decode image!" );
return false;
}
Program: gdcm
Module: $RCSfile: gdcmMacro.h,v $
Language: C++
- Date: $Date: 2005/10/21 15:34:56 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
type(type &); /* Not implemented */ \
type &operator=(type &) /* Not implemented */
+#define gdcmNewMacro(type) \
+ public : \
+ static type *New() {return new type(); } /* Not implemented */
+
+//-----------------------------------------------------------------------------
+//
+// Define GDCM_LEGACY macro to mark legacy methods where they are
+// declared in their class.
+//
+// WARNING : Don't try to use it with 'inline' methods !
+//
+//Example usage:
+//
+// // @deprecated Replaced by MyOtherMethod() as of gdcm 2.0.
+// GDCM_LEGACY(void MyMethod());
+#if defined(GDCM_LEGACY_REMOVE)
+ // Remove legacy methods completely.
+# define GDCM_LEGACY(method)
+#elif defined(GDCM_LEGACY_SILENT) || defined(SWIG)
+ // Provide legacy methods with no warnings.
+# define GDCM_LEGACY(method) method
+#else
+ // Setup compile-time warnings for uses of deprecated methods if
+ // possible on this compiler.
+# if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+#if defined(__APPLE__) && (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
+// Seems like there is a bug in APPLE gcc for deprecated attribute and ctor
+// This is fixed in g++ 4.0 (Tiger)
+# define GDCM_LEGACY(method) method
+#else
+# define GDCM_LEGACY(method) method __attribute__((deprecated))
+#endif
+# elif defined(_MSC_VER) && _MSC_VER >= 1300
+# define GDCM_LEGACY(method) __declspec(deprecated) method
+# else
+# define GDCM_LEGACY(method) method
+# endif
+#endif
+
+// Macros to create runtime deprecation warning messages in function
+// bodies. Example usage:
+//
+// void MyClass::MyOldMethod()
+// {
+// GDCM_LEGACY_BODY(MyClass::MyOldMethod, 2.0);
+// }
+//
+// void MyClass::MyMethod()
+// {
+// GDCM_LEGACY_REPLACED_BODY(MyClass::MyMethod, 5.0,
+// MyClass::MyOtherMethod);
+// }
+#if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
+# define GDCM_LEGACY_BODY(method, version)
+# define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
+#else
+# define GDCM_LEGACY_BODY(method, version) \
+ gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version.")
+# define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
+ gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version. Use " #replace " instead.")
+#endif
+
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmOrientation.h,v $
Language: C++
- Date: $Date: 2005/11/28 11:54:51 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ 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
#ifndef GDCMORIENTATION_H
#define GDCMORIENTATION_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include <map>
namespace gdcm
* The values are given within the 'Patient referential', *not* within the 'Organ referential' ...
*/
-class GDCM_EXPORT Orientation : public RefCounter
+class GDCM_EXPORT Orientation : public CommandManager
{
gdcmTypeMacro(Orientation);
public:
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2005/11/28 10:32:05 $
- Version: $Revision: 1.102 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.103 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if( IsJPEG2000 = Global::GetTS()->IsJPEG2000(ts) ) break;
if( IsMPEG = Global::GetTS()->IsMPEG(ts) ) break;
if( IsJPEGLS = Global::GetTS()->IsJPEGLS(ts) ) break;
- gdcmWarningMacro("Unexpected Transfer Syntax :[" << ts << "]");
+ gdcmStaticWarningMacro("Unexpected Transfer Syntax :[" << ts << "]");
break;
}
}
LutRedData = (uint8_t*)file->GetEntryBinArea( 0x0028, 0x1201 );
if ( ! LutRedData )
{
- gdcmWarningMacro("Unable to read Red Palette Color Lookup Table data");
+ gdcmStaticWarningMacro("Unable to read Red Palette Color Lookup Table data");
}
// //// Green round:
LutGreenData = (uint8_t*)file->GetEntryBinArea(0x0028, 0x1202 );
if ( ! LutGreenData)
{
- gdcmWarningMacro("Unable to read Green Palette Color Lookup Table data");
+ gdcmStaticWarningMacro("Unable to read Green Palette Color Lookup Table data");
}
// //// Blue round:
LutBlueData = (uint8_t*)file->GetEntryBinArea( 0x0028, 0x1203 );
if ( ! LutBlueData )
{
- gdcmWarningMacro("Unable to read Blue Palette Color Lookup Table data");
+ gdcmStaticWarningMacro("Unable to read Blue Palette Color Lookup Table data");
}
}
FileInternal = file;
//// First stage: get our hands on the Pixel Data.
if ( !fp )
{
- gdcmWarningMacro( "Unavailable file pointer." );
+ gdcmStaticWarningMacro( "Unavailable file pointer." );
return false;
}
fp->seekg( PixelOffset, std::ios::beg );
if ( fp->fail() || fp->eof() )
{
- gdcmWarningMacro( "Unable to find PixelOffset in file." );
+ gdcmStaticWarningMacro( "Unable to find PixelOffset in file." );
return false;
}
// variable). But RawSize is the right size of the image !
if ( PixelDataLength != RawSize )
{
- gdcmWarningMacro( "Mismatch between PixelReadConvert : "
- << PixelDataLength << " and RawSize : " << RawSize );
+ gdcmStaticWarningMacro( "Mismatch between PixelReadConvert : "
+ << PixelDataLength << " and RawSize : " << RawSize );
}
if ( PixelDataLength > RawSize )
{
if ( fp->fail() || fp->eof())
{
- gdcmWarningMacro( "Reading of Raw pixel data failed." );
+ gdcmStaticWarningMacro( "Reading of Raw pixel data failed." );
return false;
}
}
if ( ! RLEInfo->DecompressRLEFile
( fp, Raw, XSize, YSize, ZSize, BitsAllocated ) )
{
- gdcmWarningMacro( "RLE decompressor failed." );
+ gdcmStaticWarningMacro( "RLE decompressor failed." );
return false;
}
}
else if ( IsMPEG )
{
- //gdcmWarningMacro( "Sorry, MPEG not yet taken into account" );
+ //gdcmStaticWarningMacro( "Sorry, MPEG not yet taken into account" );
//return false;
// fp has already been seek to start of mpeg
//ReadMPEGFile(fp, (char*)Raw, PixelDataLength);
// Default case concerns JPEG family
if ( ! ReadAndDecompressJPEGFile( fp ) )
{
- gdcmWarningMacro( "JPEG decompressor ( ReadAndDecompressJPEGFile()"
- << " method ) failed." );
+ gdcmStaticWarningMacro( "JPEG decompressor ( ReadAndDecompressJPEGFile()"
+ << " method ) failed." );
return false;
}
}
return false;
}
- gdcmDebugMacro( "--> BuildRGBImage" );
+ gdcmStaticDebugMacro( "--> BuildRGBImage" );
// Build RGB Pixels
AllocateRGB();
inputlength += jpegfrag->GetLength();
jpegfrag = JPEGInfo->GetNextFragment();
}
- gdcmAssertMacro( inputlength != 0);
+ gdcmStaticAssertMacro( inputlength != 0);
uint8_t *inputdata = new uint8_t[inputlength];
char *pinputdata = (char*)inputdata;
jpegfrag = JPEGInfo->GetFirstFragment();
return true;
}
// wow what happen, must be an error
- gdcmWarningMacro( "gdcm_read_JPEG2000_file() failed ");
+ gdcmStaticWarningMacro( "gdcm_read_JPEG2000_file() failed ");
return false;
}
else if ( IsJPEGLS )
inputlength += jpegfrag->GetLength();
jpegfrag = JPEGInfo->GetNextFragment();
}
- gdcmAssertMacro( inputlength != 0);
+ gdcmStaticAssertMacro( inputlength != 0);
uint8_t *inputdata = new uint8_t[inputlength];
char *pinputdata = (char*)inputdata;
jpegfrag = JPEGInfo->GetFirstFragment();
delete[] inputdata;
#endif
- gdcmWarningMacro( "Sorry, JPEG-LS not yet taken into account" );
+ gdcmStaticWarningMacro( "Sorry, JPEG-LS not yet taken into account" );
fp->seekg( JPEGInfo->GetFirstFragment()->GetOffset(), std::ios::beg);
// if ( ! gdcm_read_JPEGLS_file( fp,Raw ) )
return false;
|| LutGreenDescriptor == GDCM_UNFOUND
|| LutBlueDescriptor == GDCM_UNFOUND )
{
- gdcmWarningMacro( "(At least) a LUT Descriptor is missing" );
+ gdcmStaticWarningMacro( "(At least) a LUT Descriptor is missing" );
return;
}
&lengthR, &debR, &nbitsR );
if ( nbRead != 3 )
{
- gdcmWarningMacro( "Wrong Red LUT descriptor" );
+ gdcmStaticWarningMacro( "Wrong Red LUT descriptor" );
}
int lengthG; // Green LUT length in Bytes
int debG; // Subscript of the first Lut Value
&lengthG, &debG, &nbitsG );
if ( nbRead != 3 )
{
- gdcmWarningMacro( "Wrong Green LUT descriptor" );
+ gdcmStaticWarningMacro( "Wrong Green LUT descriptor" );
}
int lengthB; // Blue LUT length in Bytes
&lengthB, &debB, &nbitsB );
if ( nbRead != 3 )
{
- gdcmWarningMacro( "Wrong Blue LUT descriptor" );
+ gdcmStaticWarningMacro( "Wrong Blue LUT descriptor" );
}
- gdcmDebugMacro(" lengthR " << lengthR << " debR "
- << debR << " nbitsR " << nbitsR);
- gdcmDebugMacro(" lengthG " << lengthG << " debG "
- << debG << " nbitsG " << nbitsG);
- gdcmDebugMacro(" lengthB " << lengthB << " debB "
- << debB << " nbitsB " << nbitsB);
+ gdcmStaticDebugMacro(" lengthR " << lengthR << " debR "
+ << debR << " nbitsR " << nbitsR);
+ gdcmStaticDebugMacro(" lengthG " << lengthG << " debG "
+ << debG << " nbitsG " << nbitsG);
+ gdcmStaticDebugMacro(" lengthB " << lengthB << " debB "
+ << debB << " nbitsB " << nbitsB);
if ( !lengthR ) // if = 2^16, this shall be 0 see : CP-143
lengthR=65536;
if ( ( ! LutRedData ) || ( ! LutGreenData ) || ( ! LutBlueData ) )
{
- gdcmWarningMacro( "(At least) a LUT is missing" );
+ gdcmStaticWarningMacro( "(At least) a LUT is missing" );
return;
}
// with 65536 entries LUT ?!?
// Still looking for accurate info on the web :-(
- gdcmWarningMacro( "Sorry Palette Color Lookup Tables not yet dealt with"
+ gdcmStaticWarningMacro( "Sorry Palette Color Lookup Tables not yet dealt with"
<< " for 16 Bits Per Pixel images" );
// forge the 4 * 16 Bits Red/Green/Blue/Alpha LUT
}
break;
default:
- gdcmWarningMacro("SwapCode value (16 bits) not allowed."
+ gdcmStaticWarningMacro("SwapCode value (16 bits) not allowed."
<< tempSwapCode);
}
}
}
break;
default:
- gdcmWarningMacro("SwapCode value (32 bits) not allowed." << tempSwapCode );
+ gdcmStaticWarningMacro("SwapCode value (32 bits) not allowed." << tempSwapCode );
}
}
}
}
else
{
- gdcmWarningMacro("Weird image (BitsAllocated !=8, 12, 16, 32)");
+ gdcmStaticWarningMacro("Weird image (BitsAllocated !=8, 12, 16, 32)");
throw FormatError( "Weird image !?" );
}
}
*/
void PixelReadConvert::ConvertRGBPlanesToRGBPixels()
{
- gdcmWarningMacro("--> ConvertRGBPlanesToRGBPixels");
+ gdcmStaticWarningMacro("--> ConvertRGBPlanesToRGBPixels");
uint8_t *localRaw = Raw;
uint8_t *copyRaw = new uint8_t[ RawSize ];
// On such images, RLE achieves a compression ratio that is much better
// than the compression ratio on an equivalent RGB image.
- gdcmWarningMacro("--> ConvertYcBcRPlanesToRGBPixels");
+ gdcmStaticWarningMacro("--> ConvertYcBcRPlanesToRGBPixels");
uint8_t *localRaw = Raw;
uint8_t *copyRaw = new uint8_t[ RawSize ];
// - [Planar 1] AND [Photo C] handled with ConvertYcBcRPlanesToRGBPixels()
// - [Planar 2] OR [Photo D] requires LUT intervention.
- gdcmDebugMacro("--> ConvertHandleColor "
- << "Planar Configuration " << PlanarConfiguration );
+ gdcmStaticDebugMacro("--> ConvertHandleColor "
+ << "Planar Configuration " << PlanarConfiguration );
if ( ! IsRawRGB() )
{
// [Planar 2] OR [Photo D]: LUT intervention done outside
- gdcmDebugMacro("--> RawRGB : LUT intervention done outside");
+ gdcmStaticDebugMacro("--> RawRGB : LUT intervention done outside");
return;
}
if ( IsYBRFull )
{
// [Planar 1] AND [Photo C] (remember YBR_FULL_422 acts as RGB)
- gdcmDebugMacro("--> YBRFull");
+ gdcmStaticDebugMacro("--> YBRFull");
ConvertYcBcRPlanesToRGBPixels();
}
else
{
// [Planar 1] AND [Photo C]
- gdcmDebugMacro("--> YBRFull");
+ gdcmStaticDebugMacro("--> YBRFull");
ConvertRGBPlanesToRGBPixels();
}
return;
if (IsRLELossless)
{
- gdcmDebugMacro("--> RLE Lossless");
+ gdcmStaticDebugMacro("--> RLE Lossless");
ConvertRGBPlanesToRGBPixels();
}
}
else
{
- gdcmWarningMacro("Set as RLE file but NO RLEinfo present.");
+ gdcmStaticWarningMacro("Set as RLE file but NO RLEinfo present.");
}
}
}
else
{
- gdcmWarningMacro("Set as JPEG file but NO JPEGinfo present.");
+ gdcmStaticWarningMacro("Set as JPEG file but NO JPEGinfo present.");
}
}
}
Program: gdcm
Module: $RCSfile: gdcmRLEFrame.cxx,v $
Language: C++
- Date: $Date: 2005/11/09 10:18:44 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ 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
// Public
void RLEFrame::SetOffset(unsigned int id,long offset)
{
- gdcmAssertMacro(id<15);
+ gdcmStaticAssertMacro(id<15);
Offset[id] = offset;
}
long RLEFrame::GetOffset(unsigned int id)
{
- gdcmAssertMacro(id<15);
+ gdcmStaticAssertMacro(id<15);
return Offset[id];
}
void RLEFrame::SetLength(unsigned int id,long length)
{
- gdcmAssertMacro(id<15);
+ gdcmStaticAssertMacro(id<15);
Length[id] = length;
}
long RLEFrame::GetLength(unsigned int id)
{
- gdcmAssertMacro(id<15);
+ gdcmStaticAssertMacro(id<15);
return Length[id];
}
if ( numberOfReadBytes > fragmentSize )
{
- gdcmWarningMacro( "Read more bytes (" << numberOfReadBytes
- << " ) than the segment size. (" << fragmentSize << ")" );
+ gdcmStaticWarningMacro( "Read more bytes (" << numberOfReadBytes
+ << " ) than the segment size. ("
+ << fragmentSize << ")" );
return false;
}
}
Program: gdcm
Module: $RCSfile: gdcmRLEFramesInfo.cxx,v $
Language: C++
- Date: $Date: 2005/09/07 08:49:58 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
RLEFrame *RLEFramesInfo::GetNextFrame()
{
- gdcmAssertMacro (ItFrames != Frames.end());
+ gdcmStaticAssertMacro (ItFrames != Frames.end());
++ItFrames;
if (ItFrames != Frames.end())
Program: gdcm
Module: $RCSfile: gdcmRefCounter.h,v $
Language: C++
- Date: $Date: 2005/10/26 15:41:29 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMREFCOUNTER_H
#include "gdcmBase.h"
-#include "gdcmDebug.h"
namespace gdcm
{
Program: gdcm
Module: $RCSfile: gdcmSerieHelper.h,v $
Language: C++
- Date: $Date: 2005/11/25 13:56:32 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ 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
#include "gdcmCommon.h"
#include "gdcmTagKey.h"
#include "gdcmDebug.h" // for LEGACY
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include <vector>
#include <iostream>
* into several XCoherent Filesets
* XCoherent stands for 'Extra Coherent' (same orientation, or same position)
*/
-class GDCM_EXPORT SerieHelper : public RefCounter
+class GDCM_EXPORT SerieHelper : public CommandManager
{
gdcmTypeMacro(SerieHelper);
Program: gdcm
Module: $RCSfile: gdcmTS.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:27 $
- Version: $Revision: 1.24 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.25 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMTS_H
#define GDCMTS_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include <map>
#include <string>
* \brief Container for dicom 'Transfer Syntax' Hash Table
* \note This is a singleton
*/
-class GDCM_EXPORT TS : public RefCounter
+class GDCM_EXPORT TS : public CommandManager
{
gdcmTypeMacro(TS);
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2005/11/22 20:30:46 $
- Version: $Revision: 1.176 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.177 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmUtil.h"
#include "gdcmDebug.h"
+
#include <iostream>
#include <stdarg.h> // for va_list
std::string Util::DicomString(const char *s, size_t l)
{
std::string r(s, s+l);
- gdcmAssertMacro( !(r.size() % 2) ); // == basically 'l' is even
+ gdcmStaticAssertMacro( !(r.size() % 2) ); // == basically 'l' is even
return r;
}
l++;
}
std::string r(s, s+l);
- gdcmAssertMacro( !(r.size() % 2) );
+ gdcmStaticAssertMacro( !(r.size() % 2) );
return r;
}
case GDCM_LESSOREQUAL :
return s1_even <= s2_even;
default :
- gdcmDebugMacro(" Wrong operator : " << op);
+ gdcmStaticDebugMacro(" Wrong operator : " << op);
return false;
}
}
}
else
{
- gdcmWarningMacro("Problem in finding the MAC Address");
+ gdcmStaticWarningMacro("Problem in finding the MAC Address");
return "";
}
}
// If append is too long we need to rehash it
if ( (prefix + append).size() > 64 )
{
- gdcmErrorMacro( "Size of UID is too long." );
+ gdcmStaticErrorMacro( "Size of UID is too long." );
// we need a hash function to truncate this number
// if only md5 was cross plateform
// MD5(append);
Program: gdcm
Module: $RCSfile: gdcmVR.h,v $
Language: C++
- Date: $Date: 2005/10/26 08:04:16 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.27 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMVR_H
#define GDCMVR_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
#include "gdcmVRKey.h"
#include <map>
* \brief Container for dicom Value Representation Hash Table
* \note This is a singleton
*/
-class GDCM_EXPORT VR : public RefCounter
+class GDCM_EXPORT VR : public CommandManager
{
gdcmTypeMacro(VR);
Program: gdcm
Module: $RCSfile: gdcmValidator.h,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:27 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2005/11/28 15:20:34 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMVALIDATOR_H
#define GDCMVALIDATOR_H
-#include "gdcmRefCounter.h"
+#include "gdcmCommandManager.h"
namespace gdcm
{
* \brief Class to perform some verifications on a gdcm::Document
*/
class ElementSet;
-class GDCM_EXPORT Validator : public RefCounter
+class GDCM_EXPORT Validator : public CommandManager
{
gdcmTypeMacro(Validator);