From 10480b68ab85e5e7a4ddcf56ebfc83f5870061b5 Mon Sep 17 00:00:00 2001 From: caballero Date: Wed, 25 Feb 2009 09:30:47 +0000 Subject: [PATCH] Clean Up Code and Added min dimension check --- appli/TestWxGimmickReaderDialog/main.cxx | 1 - src2/creaImageIOTreeView.h | 12 +-- src2/creaImageIOWxGimmickReaderDialog.cpp | 2 - src2/creaImageIOWxGimmickReaderDialog.h | 1 - src2/creaImageIOWxGimmickView.cpp | 3 - src2/creaImageIOWxGimmickView.h | 3 - src2/creaImageIOWxTreeView.cpp | 107 ++++++++++++---------- 7 files changed, 63 insertions(+), 66 deletions(-) diff --git a/appli/TestWxGimmickReaderDialog/main.cxx b/appli/TestWxGimmickReaderDialog/main.cxx index 4ce9a54..4846e21 100644 --- a/appli/TestWxGimmickReaderDialog/main.cxx +++ b/appli/TestWxGimmickReaderDialog/main.cxx @@ -41,7 +41,6 @@ bool myApp::OnInit( ) wxSize(1200,800), min_dim, max_dim, - output_dim, threads); w.ShowModal(); diff --git a/src2/creaImageIOTreeView.h b/src2/creaImageIOTreeView.h index de4f7f2..4f61518 100644 --- a/src2/creaImageIOTreeView.h +++ b/src2/creaImageIOTreeView.h @@ -46,18 +46,14 @@ namespace creaImageIO void SetMaxDimension(int maxdim){ mSelectionMaxDimension=maxdim; } ///Sets the minimum dimension allowed for selections void SetMinDimension(int mindim){ mSelectionMinDimension=mindim; } - ///Sets the output dimension desired for selections - void SetOutputDimension(int outdim){ mOutputDimension=outdim; } - + protected: TreeHandler* GetTreeHandler() { return mTreeHandler; } ///Gets the maximum dimension allowed for selections int GetMaxDimension(){ return mSelectionMaxDimension; } ///Gets the minimum dimension allowed for selections int GetMinDimension(){ return mSelectionMinDimension; } - ///Gets the output dimension desired for selections - int GetOutputDimension(){ return mOutputDimension; } - + private: /// The TreeHandler with which it corresponds TreeHandler* mTreeHandler; @@ -65,9 +61,7 @@ namespace creaImageIO int mSelectionMaxDimension; //The selection's minimum dimension int mSelectionMinDimension; - //The user desired output dimension - int mOutputDimension; - }; + }; // EO class TreeView //===================================================================== diff --git a/src2/creaImageIOWxGimmickReaderDialog.cpp b/src2/creaImageIOWxGimmickReaderDialog.cpp index c12cd06..b04c27e 100644 --- a/src2/creaImageIOWxGimmickReaderDialog.cpp +++ b/src2/creaImageIOWxGimmickReaderDialog.cpp @@ -11,7 +11,6 @@ namespace creaImageIO const wxSize& size, int min_dim, int max_dim, - int out_dim, int threads) : wxDialog( parent, id, @@ -45,7 +44,6 @@ namespace creaImageIO size, min_dim, max_dim, - out_dim, threads); mView->Initialize(); } diff --git a/src2/creaImageIOWxGimmickReaderDialog.h b/src2/creaImageIOWxGimmickReaderDialog.h index 54f929c..4d93221 100644 --- a/src2/creaImageIOWxGimmickReaderDialog.h +++ b/src2/creaImageIOWxGimmickReaderDialog.h @@ -25,7 +25,6 @@ namespace creaImageIO const wxSize& size, int image_min_dim = GIMMICK_2D_IMAGE_SELECTION, int image_max_dim = GIMMICK_3D_IMAGE_SELECTION, - int output_dim = NATIVE, int threads = 0); Gimmick* GetGimmick() { return mGimmick; } diff --git a/src2/creaImageIOWxGimmickView.cpp b/src2/creaImageIOWxGimmickView.cpp index cec329b..99a0077 100644 --- a/src2/creaImageIOWxGimmickView.cpp +++ b/src2/creaImageIOWxGimmickView.cpp @@ -63,7 +63,6 @@ namespace creaImageIO const wxPoint& pos, const wxSize& size, int min_dim, int max_dim, - int out_dim, int number_of_threads) : wxPanel(parent,id,pos,size), GimmickView(gimmick), @@ -102,7 +101,6 @@ namespace creaImageIO mSelectionMaxDimension=max_dim; mSelectionMinDimension=min_dim; - mOutputDimension=out_dim; // Create the views CreateTreeViews(); @@ -189,7 +187,6 @@ namespace creaImageIO view->SetMaxDimension(mSelectionMaxDimension); view->SetMinDimension(mSelectionMinDimension); - view->SetOutputDimension(mOutputDimension); // TO DO : TEST THAT A VIEW WITH SAME NAME IS NOT // ALREADY IN THE MAP diff --git a/src2/creaImageIOWxGimmickView.h b/src2/creaImageIOWxGimmickView.h index 235c8f0..ac816a0 100644 --- a/src2/creaImageIOWxGimmickView.h +++ b/src2/creaImageIOWxGimmickView.h @@ -32,7 +32,6 @@ namespace creaImageIO const wxPoint& pos, const wxSize& size, int min_dim = GIMMICK_2D_IMAGE_SELECTION, int max_dim = GIMMICK_3D_IMAGE_SELECTION, - int out_dim = NATIVE, int number_of_threads = 0); /// Virtual destructor virtual ~WxGimmickView(); @@ -89,8 +88,6 @@ namespace creaImageIO int mSelectionMaxDimension; //The selection's minimum dimension int mSelectionMinDimension; - //The user desired output dimension - int mOutputDimension; wxString mCurrentDirectory; diff --git a/src2/creaImageIOWxTreeView.cpp b/src2/creaImageIOWxTreeView.cpp index bd64078..829549a 100644 --- a/src2/creaImageIOWxTreeView.cpp +++ b/src2/creaImageIOWxTreeView.cpp @@ -456,10 +456,10 @@ namespace creaImageIO { int level=mLevelList.size(); std::vector sel=GetSelected(level+1); + bool valid=true; if(sel.size()>0) { std::vector::iterator i; - bool valid=true; std::string row; std::string col; std::string plane; @@ -492,52 +492,65 @@ namespace creaImageIO << std::endl); //Dimention validation //Compatibility with maximum - if(valid) - { - int rows; - int cols; - int planes; - std::string s; - std::istringstream t(s); - s=row; - t >> rows; - if(row==""){rows=1;} - s=col; - t >> cols; - if(col==""){cols=1;} - s=plane; - t >> planes; - if(plane==""){planes=1;} - - int dim = 0; - if (planes>1) dim=3; - else if (cols>1) dim=2; - else if (rows>1) dim=1; - - if (dim == 0) - { - GimmickMessage(1, - "Unknown image dimension : cannot select !" - <GetMaxDimension()) - { - GimmickMessage(1,"Selecting "<> rows; + if(row==""){rows=1;} + s=col; + t >> cols; + if(col==""){cols=1;} + s=plane; + t >> planes; + if(plane==""){planes=1;} + + int dim = 0; + if (planes>1) dim=3; + else if (cols>1) dim=2; + else if (rows>1) dim=1; + + if (dim == 0) + { + GimmickMessage(1, + "Unknown image dimension : cannot select !" + <GetMaxDimension()) + { + GimmickMessage(1,"Selecting "<ProcessEvent( event ); - } + } -- 2.45.1