From 0350f04002063f12dcf10ee765f5389590f352e7 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Wed, 3 Feb 2010 10:54:07 +0000 Subject: [PATCH] remove MACRO for vvTool and others minors stuffs --- common/clitkCommon.cxx | 2 +- common/clitkCommon.h | 26 +++++----- common/clitkListOfPair.cxx | 24 +++++----- common/clitkListOfPair.h | 18 +++---- common/clitkTimer.h | 1 + common/clitkVfImageIO.h | 3 ++ common/clitkVoxImageIO.h | 3 ++ common/clitkVoxImageIOFactory.cxx | 2 + vv/qt_ui/vvToolBinarize.ui | 79 +++++++++++++++++++++++++++---- vv/vv.cxx | 4 -- vv/vvToolBinarize.cxx | 16 +++++-- vv/vvToolManager.cxx | 16 ++++--- vv/vvToolManager.h | 14 ++---- 13 files changed, 139 insertions(+), 69 deletions(-) diff --git a/common/clitkCommon.cxx b/common/clitkCommon.cxx index d7ca47a..c80c095 100644 --- a/common/clitkCommon.cxx +++ b/common/clitkCommon.cxx @@ -25,7 +25,7 @@ -------------------------------------------------*/ #include "clitkCommon.h" -#include "itkMacro.h" +#include //------------------------------------------------------------------ // skip line which begin with a sharp '#' diff --git a/common/clitkCommon.h b/common/clitkCommon.h index ce70757..00a32cf 100644 --- a/common/clitkCommon.h +++ b/common/clitkCommon.h @@ -12,18 +12,22 @@ -------------------------------------------------------------------*/ // std include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "itkMacro.h" +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include + +// itk include (include std) #include +#include #include #include diff --git a/common/clitkListOfPair.cxx b/common/clitkListOfPair.cxx index 09cc04b..25b254d 100644 --- a/common/clitkListOfPair.cxx +++ b/common/clitkListOfPair.cxx @@ -7,11 +7,11 @@ 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. + 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 CLITKLISTOFPAIR_CXX @@ -32,13 +32,13 @@ //-------------------------------------------------------------------- double clitk::convertValue(double v, - const std::multimap & conversionTable, - bool linear) { + const std::multimap & conversionTable, + bool linear) { std::map::const_iterator i; i = conversionTable.lower_bound(v); if (i == conversionTable.end()) { - std::cerr << "The value " << v << " is out of the table" << std::endl; - exit(0); + std::cerr << "The value " << v << " is out of the table" << std::endl; + exit(0); } double v2 = i->first; @@ -49,12 +49,12 @@ double clitk::convertValue(double v, // interpol if (!linear) { - if ((v-v1) > (v2-v)) return p2; - else return p1; + if ((v-v1) > (v2-v)) return p2; + else return p1; } else { - double w = (v-v1)/(v2-v1); - return p1*(1.0-w)+w*p2; + double w = (v-v1)/(v2-v1); + return p1*(1.0-w)+w*p2; } } //-------------------------------------------------------------------- diff --git a/common/clitkListOfPair.h b/common/clitkListOfPair.h index 4e9502f..12a207f 100644 --- a/common/clitkListOfPair.h +++ b/common/clitkListOfPair.h @@ -2,17 +2,19 @@ #define CLITKLISTOFPAIR_H /** - =================================================================== - * @file clitkListOfPair.h - * @author David Sarrut - * @date 27 Feb 2007 09:44:18 + =================================================================== + * @file clitkListOfPair.h + * @author David Sarrut + * @date 27 Feb 2007 09:44:18 - * @brief + * @brief - ===================================================================*/ + ===================================================================*/ #include "clitkCommon.h" +#include + namespace clitk { //==================================================================== @@ -21,8 +23,8 @@ namespace clitk { //==================================================================== double convertValue(double v, - const std::multimap & conversionTable, - bool linear); + const std::multimap & conversionTable, + bool linear); #include "clitkListOfPair.txx" diff --git a/common/clitkTimer.h b/common/clitkTimer.h index 5f16a8e..5f651c3 100644 --- a/common/clitkTimer.h +++ b/common/clitkTimer.h @@ -18,6 +18,7 @@ #include #include #include +#include namespace clitk { diff --git a/common/clitkVfImageIO.h b/common/clitkVfImageIO.h index e26d7a9..23e73e9 100644 --- a/common/clitkVfImageIO.h +++ b/common/clitkVfImageIO.h @@ -18,6 +18,9 @@ // itk include #include "itkImageIOBase.h" +// std include +#include + namespace clitk { //==================================================================== diff --git a/common/clitkVoxImageIO.h b/common/clitkVoxImageIO.h index d4ffb6a..dede8a2 100644 --- a/common/clitkVoxImageIO.h +++ b/common/clitkVoxImageIO.h @@ -17,6 +17,9 @@ // itk include #include "itkImageIOBase.h" +// std include +#include + namespace clitk { //==================================================================== diff --git a/common/clitkVoxImageIOFactory.cxx b/common/clitkVoxImageIOFactory.cxx index b1789db..94e73b6 100644 --- a/common/clitkVoxImageIOFactory.cxx +++ b/common/clitkVoxImageIOFactory.cxx @@ -30,6 +30,8 @@ #include "clitkVoxImageIOFactory.h" +#include + //==================================================================== clitk::VoxImageIOFactory::VoxImageIOFactory() { diff --git a/vv/qt_ui/vvToolBinarize.ui b/vv/qt_ui/vvToolBinarize.ui index 154f977..3b9a1f0 100644 --- a/vv/qt_ui/vvToolBinarize.ui +++ b/vv/qt_ui/vvToolBinarize.ui @@ -6,8 +6,8 @@ 0 0 - 388 - 318 + 320 + 298 @@ -116,12 +116,36 @@ - + + + Use FG + + + false + + + + + + + false + + + + + + Use BG + + + true + + + @@ -138,6 +162,9 @@ + + false + Interactive (unchek to disable on the fly contours drawing) @@ -180,11 +207,11 @@ 85 - 191 + 129 - 601 - 203 + 305 + 129 @@ -196,11 +223,11 @@ 82 - 121 + 70 88 - 191 + 129 @@ -212,11 +239,43 @@ 73 - 141 + 90 137 - 191 + 129 + + + + + mCheckBoxUseBG + toggled(bool) + mBGSlider + setEnabled(bool) + + + 79 + 203 + + + 202 + 204 + + + + + mCheckBoxUseFG + toggled(bool) + mFGSlider + setEnabled(bool) + + + 63 + 177 + + + 242 + 177 diff --git a/vv/vv.cxx b/vv/vv.cxx index fde6e99..9084295 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -34,10 +34,6 @@ along with this program. If not, see . #include "vvInit.h" #include "vvConstants.h" -//------------------------------------------------------------------------------ -// (*NEEDED HERE*) Static instances initialization for ToolManager -TOOL_MANAGER_INITIALIZATION; - //------------------------------------------------------------------------------ int main( int argc, char** argv ) { diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index 05af495..22b356d 100644 --- a/vv/vvToolBinarize.cxx +++ b/vv/vvToolBinarize.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolBinarize.cxx,v $ Language: C++ - Date: $Date: 2010/02/01 15:54:25 $ - Version: $Revision: 1.2 $ + Date: $Date: 2010/02/03 10:54:08 $ + Version: $Revision: 1.3 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -269,14 +269,20 @@ void vvToolBinarize::GetArgsInfoFromGUI() { mArgsInfo.fg_arg = mFGSlider->GetValue(); mArgsInfo.bg_arg = mBGSlider->GetValue(); + + DD(inverseBGandFG); if (inverseBGandFG) { - mArgsInfo.fg_arg = mBGSlider->GetValue(); - mArgsInfo.bg_arg = mFGSlider->GetValue(); + mArgsInfo.fg_arg = mFGSlider->GetValue(); + mArgsInfo.bg_arg = mBGSlider->GetValue(); } mArgsInfo.fg_given = 1; mArgsInfo.bg_given = 1; - mArgsInfo.setBG_flag = true; + mArgsInfo.useBG_flag = mCheckBoxUseBG->isChecked(); + mArgsInfo.useFG_flag = mCheckBoxUseFG->isChecked(); + + DD(mArgsInfo.useBG_flag); + DD(mArgsInfo.useFG_flag); mArgsInfo.verbose_flag = true; diff --git a/vv/vvToolManager.cxx b/vv/vvToolManager.cxx index 0a80a47..e66fa06 100644 --- a/vv/vvToolManager.cxx +++ b/vv/vvToolManager.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolManager.cxx,v $ Language: C++ - Date: $Date: 2010/01/29 13:54:37 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/02/03 10:54:08 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -28,6 +28,8 @@ #include "vvToolManager.h" #include "vvMainWindow.h" +vvToolManager* vvToolManager::mSingleton=0; + //------------------------------------------------------------------------------ vvToolManager * vvToolManager::GetInstance() { if (mSingleton == 0) { @@ -41,15 +43,15 @@ vvToolManager * vvToolManager::GetInstance() { //------------------------------------------------------------------------------ void vvToolManager::AddTool(vvToolCreatorBase * v) { std::cout << "Adding the tool <" << v->mToolName.toStdString() << ">." << std::endl; - mListOfTools.push_back(v); + GetInstance()->mListOfTools.push_back(v); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvToolManager::Initialize(vvMainWindow * m) { - for(unsigned int i=0; iInitialize(m); + for(unsigned int i=0; imListOfTools.size(); i++) { + GetInstance()->mListOfTools[i]->Initialize(m); } } //------------------------------------------------------------------------------ @@ -57,8 +59,8 @@ void vvToolManager::Initialize(vvMainWindow * m) { //------------------------------------------------------------------------------ void vvToolManager::UpdateEnabledTool() { - for(unsigned int i=0; iUpdateEnabledTool(); + for(unsigned int i=0; imListOfTools.size(); i++) { + GetInstance()->mListOfTools[i]->UpdateEnabledTool(); } } //------------------------------------------------------------------------------ diff --git a/vv/vvToolManager.h b/vv/vvToolManager.h index afd5936..8d8c1da 100644 --- a/vv/vvToolManager.h +++ b/vv/vvToolManager.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolManager.h,v $ Language: C++ - Date: $Date: 2010/01/29 13:54:37 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/02/03 10:54:08 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -47,18 +47,10 @@ public: static void Initialize(vvMainWindow * m); static void UpdateEnabledTool(); // Variables - static std::vector mListOfTools; + std::vector mListOfTools; static vvToolManager * mSingleton; }; //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -// Static instances initialization (to put in main) -#define TOOL_MANAGER_INITIALIZATION \ - vvToolManager* vvToolManager::mSingleton=0; \ - std::vector vvToolManager::mListOfTools; -//------------------------------------------------------------------------------ - - #endif -- 2.47.1