From 2d5984d688d7b149aa7706a0a0bf8c4b4556d788 Mon Sep 17 00:00:00 2001 From: Juan Prieto Date: Mon, 31 Aug 2009 08:45:58 +0000 Subject: [PATCH] *** empty log message *** --- bbtk/CMakeLists.txt | 4 + bbtk/src/bbcreaMaracasVisuCutModule.cxx | 55 +++ bbtk/src/bbcreaMaracasVisuCutModule.h | 46 +++ bbtk/src/bbmaracasvisuViewerNV.cxx | 2 + bbtk/src/bbmaracasvisuViewerNV.h | 2 + data/Icons/Add.xpm | 80 +++++ data/Icons/Ok.xpm | 189 +++------- data/Icons/Ok1.xpm | 72 ++++ data/Icons/OkAll.xpm | 73 ++++ data/Icons/Redo.xpm | 70 ++++ data/Icons/Statistics.xpm | 120 +++++++ data/Icons/Undo.xpm | 70 ++++ lib/maracasVisuLib/CMakeLists.txt | 7 +- .../src/CutModule/CMakeLists.txt | 26 ++ .../src/CutModule/interface/CMakeLists.txt | 51 +++ .../CutModule/interface/CutModelMainPanel.cxx | 333 ++++++++++++++++++ .../CutModule/interface/CutModelMainPanel.h | 140 ++++++++ .../src/CutModule/interface/CutModelView.cxx | 236 +++++++++++++ .../src/CutModule/interface/CutModelView.h | 101 ++++++ .../src/CutModule/kernel/CMakeLists.txt | 50 +++ .../src/CutModule/kernel/CutModelData.cxx | 261 ++++++++++++++ .../src/CutModule/kernel/CutModelData.h | 94 +++++ .../CutModule/kernel/CutModelException.cxx | 31 ++ .../src/CutModule/kernel/CutModelException.h | 44 +++ .../src/CutModule/kernel/CutModelFigure.cxx__ | 152 ++++++++ .../src/CutModule/kernel/CutModelFigure.h | 83 +++++ .../CutModule/kernel/CutModelFigureCube.cxx | 50 +++ .../src/CutModule/kernel/CutModelFigureCube.h | 21 ++ .../kernel/CutModelFigureCylinder.cxx | 45 +++ .../CutModule/kernel/CutModelFigureCylinder.h | 22 ++ .../CutModule/kernel/CutModelFigureSphere.cxx | 47 +++ .../CutModule/kernel/CutModelFigureSphere.h | 21 ++ .../src/CutModule/kernel/CutModelManager.cxx | 167 +++++++++ .../src/CutModule/kernel/CutModelManager.h | 77 ++++ .../wxWindows/widgets/boxSurfaceObserver.h | 4 +- .../pPlotter/HistogramDialogComboBox.h | 2 +- 36 files changed, 2703 insertions(+), 145 deletions(-) create mode 100644 bbtk/src/bbcreaMaracasVisuCutModule.cxx create mode 100644 bbtk/src/bbcreaMaracasVisuCutModule.h create mode 100644 data/Icons/Add.xpm create mode 100644 data/Icons/Ok1.xpm create mode 100644 data/Icons/OkAll.xpm create mode 100644 data/Icons/Redo.xpm create mode 100644 data/Icons/Statistics.xpm create mode 100644 data/Icons/Undo.xpm create mode 100644 lib/maracasVisuLib/src/CutModule/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/CutModule/interface/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h create mode 100644 lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/interface/CutModelView.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelException.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelException.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.cxx__ create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx create mode 100644 lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h diff --git a/bbtk/CMakeLists.txt b/bbtk/CMakeLists.txt index acd63cf..ef95a14 100644 --- a/bbtk/CMakeLists.txt +++ b/bbtk/CMakeLists.txt @@ -132,6 +132,8 @@ SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS ../lib/maracasVisuLib/src/interface/wxWindows/widgets ../lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter ../lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour + ../lib/maracasVisuLib/src/CutModule/interface + ../lib/maracasVisuLib/src/CutModule/kernel ### ${MaracasSrcDir}/ILPD/src/wxInterface ) #=========================================================================== @@ -359,6 +361,8 @@ SET(${BBTK_PACKAGE_NAME}_LIBS # EXCEPT : the same libs than for INCLUDE_DIRS ### ${MYSQL_LIBRARIES} creaMaracasVisu + creaMaracasVisu_CutModule_interface + creaMaracasVisu_CutModule_kernel ### ILPDModel.lib ### ILPDInterface ### ILPDcontrolerInterface diff --git a/bbtk/src/bbcreaMaracasVisuCutModule.cxx b/bbtk/src/bbcreaMaracasVisuCutModule.cxx new file mode 100644 index 0000000..b5e9e2d --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuCutModule.cxx @@ -0,0 +1,55 @@ +#include "bbcreaMaracasVisuCutModule.h" +#include "bbcreaMaracasVisuPackage.h" +namespace bbcreaMaracasVisu +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,CutModule) +BBTK_BLACK_BOX_IMPLEMENTATION(CutModule,bbtk::WxBlackBox); +void CutModule::Process() +{ + + vtkImageData* img = bbGetInputIn(); + vtkRenderWindowInteractor* interactor = bbGetInputInteractor(); + vtkRenderer* render = bbGetInputRenderer(); + + if(img != NULL && interactor != NULL && render != NULL && _mainpanel!=NULL){ + + if(_currentimage!=img){ + _currentimage=img; + _mainpanel->setImageData(img); + } + + _mainpanel->setInteractor(interactor); + _mainpanel->setRenderer(render); + bbSetOutputOut(_mainpanel->GetResultImage()); + + } + +} +void CutModule::CreateWidget(wxWindow* parent) +{ + + _mainpanel = CutModelMainPanel::getInstance(parent); + bbSetOutputWidget( _mainpanel); + Process(); + +} +void CutModule::bbUserSetDefaultValues() +{ + _mainpanel = NULL; + _currentimage=NULL; +} +void CutModule::bbUserInitializeProcessing() +{ + bbSetInputIn(0); + bbSetInputInteractor(0); + bbSetInputRenderer(0); +} +void CutModule::bbUserFinalizeProcessing() +{ + +} +} +// EO namespace bbcreaMaracasVisu + + diff --git a/bbtk/src/bbcreaMaracasVisuCutModule.h b/bbtk/src/bbcreaMaracasVisuCutModule.h new file mode 100644 index 0000000..666c73a --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuCutModule.h @@ -0,0 +1,46 @@ +#ifdef _USE_WXWIDGETS_ +#ifndef __bbcreaMaracasVisuCutModule_h_INCLUDED__ +#define __bbcreaMaracasVisuCutModule_h_INCLUDED__ +#include "bbcreaMaracasVisu_EXPORT.h" +#include "bbtkWxBlackBox.h" +#include "CutModelMainPanel.h" + +namespace bbcreaMaracasVisu +{ + +class bbcreaMaracasVisu_EXPORT CutModule + : + public bbtk::WxBlackBox +{ + + BBTK_BLACK_BOX_INTERFACE(CutModule,bbtk::WxBlackBox); + BBTK_DECLARE_INPUT(In,vtkImageData*); + BBTK_DECLARE_INPUT(Interactor,vtkRenderWindowInteractor*); + BBTK_DECLARE_INPUT(Renderer,vtkRenderer*); + BBTK_DECLARE_OUTPUT(Out,vtkImageData*); + BBTK_PROCESS(Process); + void Process(); + BBTK_CREATE_WIDGET(CreateWidget); + void CreateWidget(wxWindow*); + +private: + CutModelMainPanel* _mainpanel; + vtkImageData* _currentimage; +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(CutModule,bbtk::WxBlackBox); +BBTK_NAME("CutModule"); +BBTK_AUTHOR("car-prie@uniandes.edu.co"); +BBTK_DESCRIPTION("extracts"); +BBTK_CATEGORY("__CategoryBlackBox__"); +BBTK_INPUT(CutModule,In,"Image",vtkImageData*,""); +BBTK_INPUT(CutModule,Interactor,"WindowInteractor",vtkRenderWindowInteractor*,""); +BBTK_INPUT(CutModule,Renderer,"Renderer",vtkRenderer*,""); +BBTK_OUTPUT(CutModule,Out,"Image output",vtkImageData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(CutModule); +} +// EO namespace bbcreaMaracasVisu + +#endif // __bbcreaMaracasVisuCutModule_h_INCLUDED__ +#endif // _USE_WXWIDGETS_ + diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index ae65750..f5cf90c 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -105,6 +105,8 @@ void ViewerNV::Process() if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); } if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); } + if (wvbv1!=NULL) { bbSetOutputInteractor1( wvbv1->GetWxVTKRenderWindowInteractor() ); } + if(bbGetInputColorFunction()!=NULL){ mwxwidget->setColorTransferFunction(bbGetInputColorFunction()); } diff --git a/bbtk/src/bbmaracasvisuViewerNV.h b/bbtk/src/bbmaracasvisuViewerNV.h index 51d24a3..eb6b39c 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.h +++ b/bbtk/src/bbmaracasvisuViewerNV.h @@ -55,6 +55,7 @@ class /*BBTK_EXPORT*/ ViewerNV BBTK_DECLARE_OUTPUT(Renderer2,vtkRenderer*); BBTK_DECLARE_OUTPUT(Renderer3,vtkRenderer*); BBTK_DECLARE_OUTPUT(Renderer4,vtkRenderer*); + BBTK_DECLARE_OUTPUT(Interactor1,vtkRenderWindowInteractor*); BBTK_DECLARE_OUTPUT(Point,std::vector); BBTK_PROCESS(Process); void Process(); @@ -89,6 +90,7 @@ BBTK_DESCRIPTION("Viewer : N view configuration 2D and 3D"); BBTK_OUTPUT(ViewerNV,Renderer2,"Renderer 2",vtkRenderer *,""); BBTK_OUTPUT(ViewerNV,Renderer3,"Renderer 3",vtkRenderer *,""); BBTK_OUTPUT(ViewerNV,Renderer4,"Renderer 4",vtkRenderer *,""); + BBTK_OUTPUT(ViewerNV,Interactor1,"Interactor1",vtkRenderWindowInteractor *,""); BBTK_OUTPUT(ViewerNV,Point,"Axis point",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(ViewerNV); } diff --git a/data/Icons/Add.xpm b/data/Icons/Add.xpm new file mode 100644 index 0000000..51ea285 --- /dev/null +++ b/data/Icons/Add.xpm @@ -0,0 +1,80 @@ +/* XPM */ +static char * Add_xpm[] = { +"17 17 60 1", +" c None", +". c #79885A", +"+ c #8E9C72", +"@ c #8D9B71", +"# c #99A77D", +"$ c #DEE7CC", +"% c #DBE4C8", +"& c #7C8B5B", +"* c #98A77A", +"= c #DDE8C7", +"- c #D9E5C3", +"; c #7B8B59", +"> c #94A473", +", c #D4E1B8", +"' c #D0DEB5", +") c #788955", +"! c #8B9D68", +"~ c #C3D3A2", +"{ c #C0D19F", +"] c #73854E", +"^ c #6B7D47", +"/ c #778A4F", +"( c #778B4F", +"_ c #92A56B", +": c #B1C48A", +"< c #B0C288", +"[ c #81945A", +"} c #73864C", +"| c #7A8C53", +"1 c #9FB472", +"2 c #A0B573", +"3 c #97AC6A", +"4 c #73864A", +"5 c #8DA65A", +"6 c #8EA75B", +"7 c #879F55", +"8 c #6C8041", +"9 c #7C9744", +"0 c #7D9744", +"a c #779141", +"b c #63753C", +"c c #5F7532", +"d c #647C34", +"e c #6D8737", +"f c #6D8637", +"g c #607732", +"h c #607532", +"i c #5E7332", +"j c #596D2F", +"k c #5F742F", +"l c #5E742F", +"m c #576A2E", +"n c #53662B", +"o c #526529", +"p c #53662C", +"q c #52642B", +"r c #4F6228", +"s c #52652C", +"t c #647542", +"u c #62733F", +" ", +" .++@ ", +" #$$%& ", +" *==-; ", +" >,,') ", +" !~~{] ", +" ^/((/_::<[(((} ", +" |1222222222223 ", +" 45666666666667 ", +" 8900000000000a ", +" bccccdeefghcci ", +" jkklm ", +" nooop ", +" qrrrs ", +" qrrrs ", +" tuuu ", +" "}; diff --git a/data/Icons/Ok.xpm b/data/Icons/Ok.xpm index 2d5e8b2..4e76169 100644 --- a/data/Icons/Ok.xpm +++ b/data/Icons/Ok.xpm @@ -1,139 +1,54 @@ /* XPM */ static char * Ok_xpm[] = { -"40 40 96 2", -" c None", -". c #62F77B", -"+ c #61F67A", -"@ c #61F77A", -"# c #61F579", -"$ c #60F579", -"% c #61F679", -"& c #60F378", -"* c #60F478", -"= c #5FF377", -"- c #5EF075", -"; c #5EF176", -"> c #5EF277", -", c #5FF277", -"' c #5DEE74", -") c #5DEF75", -"! c #5DF075", -"~ c #5EF076", -"{ c #5BEC73", -"] c #5CEE74", -"^ c #5AEA72", -"/ c #5BEB72", -"( c #5BED73", -"_ c #5CED74", -": c #59E770", -"< c #59E970", -"[ c #5AEA71", -"} c #57E46E", -"| c #58E76F", -"1 c #59E870", -"2 c #55E16C", -"3 c #56E46D", -"4 c #57E66E", -"5 c #58E66F", -"6 c #54DF6A", -"7 c #54E16B", -"8 c #55E26C", -"9 c #52DB67", -"0 c #52DE68", -"a c #51DA66", -"b c #51DC67", -"c c #4ED763", -"d c #4FD965", -"e c #4CD360", -"f c #4DD562", -"g c #49CF5D", -"h c #4AD15F", -"i c #47CB5A", -"j c #48CD5C", -"k c #45C958", -"l c #46CB5A", -"m c #42C555", -"n c #44C757", -"o c #2BA83A", -"p c #2DAA3C", -"q c #40C152", -"r c #41C353", -"s c #26A336", -"t c #28A537", -"u c #2AA739", -"v c #3DBD4F", -"w c #3EBF50", -"x c #3FC152", -"y c #42C455", -"z c #25A235", -"A c #26A436", -"B c #2DAA3D", -"C c #3BBB4D", -"D c #3CBD4E", -"E c #24A234", -"F c #2DA93C", -"G c #38B749", -"H c #39B94B", -"I c #3BBB4C", -"J c #36B547", -"K c #33B144", -"L c #34B345", -"M c #24A133", -"N c #30AD40", -"O c #31AF42", -"P c #23A132", -"Q c #2AA639", -"R c #2EAB3E", -"S c #229F31", -"T c #2CA83B", -"U c #219F31", -"V c #29A538", -"W c #209E2F", -"X c #1F9D2E", -"Y c #1F9E2F", -"Z c #1E9D2D", -"` c #28A538", -" . c #1D9C2D", -".. c #1B9B2C", -"+. c #1A9A2B", -"@. c #1B9B2B", -" . ", -" + @ . ", -" # + + + ", -" $ # % ", -" & * $ ", -" = = & ", -" - ; > , ", -" ' ) ! ~ ", -" { ] ' ) ", -" ^ / ( _ ", -" : < [ / ", -" } | 1 < ", -" 2 3 4 5 ", -" 6 7 8 3 ", -" 9 0 6 7 ", -" a b 0 ", -" c d a 9 ", -" e f c d ", -" g h e f ", -" i j g h ", -" k l j g ", -" m n k i ", -" o p q r m n ", -" s t u o p v w x r y ", -" z A t u o B C D w x ", -" E A t u o F G H I D ", -" E A t u o J G H C ", -" E A t u o K L J G ", -" M E A t u N O K L J ", -" P E A t Q R N O K ", -" S P E A t T B R N O ", -" U P E A V u o B R ", -" W U P E A t u o B ", -" X Y U P E A t u ", -" Z Y U P E A ` ", -" .Z Y U P E ", -" .Z Y U P ", -" .. .Z W ", -" +.@. . ", -" "}; +"40 40 11 1", +" c None", +". c #79885A", +"+ c #DDE8C7", +"@ c #D4E1B8", +"# c #B1C48A", +"$ c #A0B573", +"% c #8EA75B", +"& c #7D9744", +"* c #4F6228", +"= c #6D8737", +"- c #5F742F", +" ", +" .. ", +" ..++.", +" ..++. ", +" ..++. ", +" ..++. ", +" ..++. ", +" .@++.. ", +" .@@+.. ", +" .#@@.. ", +" .##@@. ", +" .###@. ", +" .$###. ", +" .$$##.. ", +" .$$$#.. ", +" .%$$$#. ", +" ..%%$$$. ", +" ..%%%$$. ", +" ..&%%%$. ", +" ..&&%%%.. ", +" . ..&&&%%%. ", +" .*.. ..=&&&%%. ", +" .**.. ..==&&&%. ", +" .****... ....===&&&. ", +" .******...--===&&.. ", +" .********---===&&. ", +" .*******---===&. ", +" .******---===. ", +" .******---==.. ", +" .*****---==. ", +" .*****---=. ", +" .****---.. ", +" .****---. ", +" .***--. ", +" .**-. ", +" .**-. ", +" .*. ", +" . ", +" ", +" "}; diff --git a/data/Icons/Ok1.xpm b/data/Icons/Ok1.xpm new file mode 100644 index 0000000..b98910b --- /dev/null +++ b/data/Icons/Ok1.xpm @@ -0,0 +1,72 @@ +/* XPM */ +static char * Ok1_xpm[] = { +"17 17 52 1", +" c None", +". c #808E61", +"+ c #B4C19A", +"@ c #A0AE85", +"# c #7C8B5E", +"$ c #B7C49E", +"% c #9FAD84", +"& c #99A879", +"* c #CAD7B0", +"= c #8F9E72", +"- c #8E9F6C", +"; c #B5C692", +"> c #A9B78C", +", c #879863", +"' c #A6BA7D", +") c #99AB76", +"! c #81945A", +"~ c #9BB06E", +"{ c #9FB377", +"] c #7B8D56", +"^ c #8CA55B", +"/ c #97AC6B", +"( c #798B54", +"_ c #7E9747", +": c #8EA65B", +"< c #80915B", +"[ c #61723E", +"} c #687946", +"| c #768851", +"1 c #748D3E", +"2 c #7E9846", +"3 c #85995B", +"4 c #647541", +"5 c #4F6228", +"6 c #576A32", +"7 c #637440", +"8 c #697C41", +"9 c #6A8137", +"0 c #738D3C", +"a c #7B914D", +"b c #5B6D37", +"c c #5D722E", +"d c #688034", +"e c #728A41", +"f c #6D7D4C", +"g c #688036", +"h c #5D6F39", +"i c #6E8046", +"j c #55672F", +"k c #64773A", +"l c #637540", +"m c #6D7E49", +" ", +" .+@", +" #$% ", +" &*= ", +" -;> ", +" ,') ", +" !~{ ", +" ]^/ ", +" (_:< ", +" [} |123 ", +" 4567890a ", +" b55cde ", +" f55cg| ", +" h5ci ", +" jk ", +" lm ", +" "}; diff --git a/data/Icons/OkAll.xpm b/data/Icons/OkAll.xpm new file mode 100644 index 0000000..92e4ed4 --- /dev/null +++ b/data/Icons/OkAll.xpm @@ -0,0 +1,73 @@ +/* XPM */ +static char * OkAll_xpm[] = { +"17 17 53 1", +" c None", +". c #808E61", +"+ c #B4C19A", +"@ c #A0AE85", +"# c #7C8B5E", +"$ c #B7C49E", +"% c #9FAD84", +"& c #99A879", +"* c #CAD7B0", +"= c #8F9E72", +"- c #8E9F6C", +"; c #B5C692", +"> c #A9B78C", +", c #879863", +"' c #A6BA7D", +") c #99AB76", +"! c #81945A", +"~ c #9BB06E", +"{ c #9FB377", +"] c #7B8D56", +"^ c #8CA55B", +"/ c #97AC6B", +"( c #798B54", +"_ c #7E9747", +": c #8EA65B", +"< c #80915B", +"[ c #61723E", +"} c #687946", +"| c #768851", +"1 c #748D3E", +"2 c #7E9846", +"3 c #85995B", +"4 c #FF0000", +"5 c #647541", +"6 c #4F6228", +"7 c #576A32", +"8 c #637440", +"9 c #697C41", +"0 c #6A8137", +"a c #738D3C", +"b c #7B914D", +"c c #5B6D37", +"d c #5D722E", +"e c #688034", +"f c #728A41", +"g c #6D7D4C", +"h c #688036", +"i c #5D6F39", +"j c #6E8046", +"k c #55672F", +"l c #64773A", +"m c #637540", +"n c #6D7E49", +" ", +" .+@", +" #$% ", +" &*= ", +" -;> ", +" ,') ", +" !~{ ", +" ]^/ ", +" (_:< ", +" [} |123 44 ", +" 567890ab 44 ", +" c66def 4 4 ", +" g66dh| 4 4 ", +" i6dj 4444 ", +" kl 4 4 ", +" mn 4 4 ", +" "}; diff --git a/data/Icons/Redo.xpm b/data/Icons/Redo.xpm new file mode 100644 index 0000000..bf5be87 --- /dev/null +++ b/data/Icons/Redo.xpm @@ -0,0 +1,70 @@ +/* XPM */ +static char * Redo_xpm[] = { +"17 17 50 1", +" c None", +". c #627637", +"+ c #5E7333", +"@ c #5D7232", +"# c #5D7233", +"$ c #607536", +"% c #677B3D", +"& c #6E8342", +"* c #647A36", +"= c #637A35", +"- c #6B803E", +"; c #6A8239", +"> c #698138", +", c #6A823A", +"' c #728944", +") c #748E42", +"! c #6F893B", +"~ c #708A3C", +"{ c #7B924C", +"] c #728C3F", +"^ c #708A3D", +"/ c #768F44", +"( c #7C944D", +"_ c #779240", +": c #76913E", +"< c #7E974A", +"[ c #839B51", +"} c #789342", +"| c #77923F", +"1 c #80984D", +"2 c #7C9841", +"3 c #7C9842", +"4 c #839D4C", +"5 c #83A047", +"6 c #85A14A", +"7 c #8FAA55", +"8 c #9BB565", +"9 c #9AB463", +"0 c #A1B96D", +"a c #A9C176", +"b c #A6BF72", +"c c #A7C073", +"d c #AFC67E", +"e c #B2CA81", +"f c #B2CA80", +"g c #B3CB82", +"h c #BFD492", +"i c #BED48F", +"j c #C0D592", +"k c #C9DE9E", +" ", +" ", +" .+@#$% ", +" &*======- ", +" ;>>>,>>>>' ", +" )!!~{ ]!!^/( ", +" _::< [}|:_1 ", +" 223 4 ", +" 556 ", +" 777 ", +" 8990 ", +" abbcd ", +" effg ", +" hiij ", +" k ", +" ", +" "}; diff --git a/data/Icons/Statistics.xpm b/data/Icons/Statistics.xpm new file mode 100644 index 0000000..446fbd8 --- /dev/null +++ b/data/Icons/Statistics.xpm @@ -0,0 +1,120 @@ +/* XPM */ +static char * Statistics_xpm[] = { +"17 17 100 2", +" c None", +". c #C6D0A6", +"+ c #C3CEA4", +"@ c #D4E0B2", +"# c #C6D1A6", +"$ c #C8D3A6", +"% c #414537", +"& c #E5F2BE", +"* c #D6E2B1", +"= c #C6D0A7", +"- c #5A5F4C", +"; c #E5F1C1", +"> c #E7F3C3", +", c #DBEDA4", +"' c #D8E3B6", +") c #D4E0AD", +"! c #788063", +"~ c #E4F1BB", +"{ c #D7EB9B", +"] c #9ACC02", +"^ c #D5EA96", +"/ c #D5E1AE", +"( c #D8E2B8", +"_ c #7B8169", +": c #E8F4C6", +"< c #B5DA46", +"[ c #AAD52B", +"} c #B2D83E", +"| c #D9E4B9", +"1 c #DCEDA6", +"2 c #C2E066", +"3 c #D9ECA0", +"4 c #A0D012", +"5 c #DFEFAF", +"6 c #A2D016", +"7 c #D6EA98", +"8 c #D6E1B3", +"9 c #7A8066", +"0 c #E6F3C1", +"a c #BADC52", +"b c #D6EB99", +"c c #B7DB4C", +"d c #C1E064", +"e c #C6E26F", +"f c #B2D940", +"g c #D7E3B4", +"h c #D6E1B2", +"i c #E6F2C0", +"j c #DFEFAE", +"k c #9FCF10", +"l c #C4E26C", +"m c #ABD52D", +"n c #E6F2BF", +"o c #DDEEAA", +"p c #A0CF11", +"q c #E1F0B5", +"r c #E3F1BA", +"s c #A2D015", +"t c #D9EC9F", +"u c #D7E2B3", +"v c #BCDD57", +"w c #BADD53", +"x c #E3F1B9", +"y c #A8D325", +"z c #CBE57E", +"A c #B9DC51", +"B c #BDDE59", +"C c #C3E168", +"D c #B3D941", +"E c #E3F1B8", +"F c #E0F0B2", +"G c #D5EA95", +"H c #A3D11A", +"I c #E2F0B6", +"J c #BBDD54", +"K c #D9E3B8", +"L c #BEDF5E", +"M c #B8DB4D", +"N c #B1D83D", +"O c #D7E2B5", +"P c #7A8167", +"Q c #DDEEAB", +"R c #D5E1B0", +"S c #798064", +"T c #B6DA47", +"U c #E5F2BD", +"V c #D4E0AE", +"W c #798063", +"X c #DAECA2", +"Y c #D5E2AF", +"Z c #D8E2B7", +"` c #5B604D", +" . c #81886C", +".. c #46493D", +"+. c #B8C19C", +"@. c #D3DFAE", +"#. c #C9D5A7", +"$. c #8D9574", +"%. c #D0DDAB", +"&. c #C5D0A5", +". + @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ", +"$ % & & & & & & & & & & & & & & * ", +"= - ; > > > > > > > > > , > > > ' ", +") ! ~ ~ ~ ~ ~ ~ ~ ~ ~ { ] ^ ~ ~ / ", +"( _ : : : : : : : : : < [ } : : | ", +") ! ~ ~ ~ 1 2 ~ ~ ~ 3 4 5 6 7 ~ / ", +"8 9 0 0 0 a ] b 0 0 c d 0 e f 0 g ", +"h 9 i i j k l m n o p q i r s t u ", +") ! ~ ~ v w x y z A B ~ ~ ~ C D / ", +"( _ : E p F : G H p I : : : & J K ", +") ! ~ L M ~ ~ ~ N J ~ ~ ~ ~ ~ ~ / ", +"O P x 4 Q > > > 0 i > > > > > > ' ", +"R S 2 T U U U U U U U U U U U U * ", +"V W t X ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Y ", +"Z ` . . . . . . . . . . . . ...+.", +") @.#.#.#.#.#.#.#.#.#.#.#.#.#.$.%.", +"&.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # "}; diff --git a/data/Icons/Undo.xpm b/data/Icons/Undo.xpm new file mode 100644 index 0000000..7343762 --- /dev/null +++ b/data/Icons/Undo.xpm @@ -0,0 +1,70 @@ +/* XPM */ +static char * Undo_xpm[] = { +"17 17 50 1", +" c None", +". c #697D3F", +"+ c #64783A", +"@ c #627737", +"# c #637839", +"$ c #6C823F", +"% c #687E3A", +"& c #6A803D", +"* c #738A44", +"= c #6E853D", +"- c #6E863D", +"; c #718841", +"> c #7D954D", +", c #7A9348", +"' c #748E40", +") c #748D3F", +"! c #799147", +"~ c #748D40", +"{ c #7E964D", +"] c #80994A", +"^ c #7B9543", +"/ c #7B9542", +"( c #7F9949", +"_ c #89A057", +": c #7F9848", +"< c #87A150", +"[ c #859F4E", +"} c #8AA454", +"| c #819C46", +"1 c #829D48", +"2 c #87A34B", +"3 c #88A44C", +"4 c #9CB566", +"5 c #93AE57", +"6 c #93AE58", +"7 c #A1BA6C", +"8 c #9DB766", +"9 c #A0B969", +"0 c #B1C980", +"a c #A9C375", +"b c #A9C274", +"c c #ADC57B", +"d c #B5CD83", +"e c #B5CC82", +"f c #C0D691", +"g c #C0D590", +"h c #C0D690", +"i c #C2D794", +"j c #CDE1A2", +"k c #CCE19F", +" ", +" ", +" .+@@#. ", +" $%%%%%%& ", +" *===--===; ", +" >,'))! !~)){ ", +" ]^/^(_ ://: ", +" <[ }||1 ", +" 223 ", +" 4556 ", +" 7889 ", +" 0abbc ", +" deed ", +" fghi ", +" jk ", +" ", +" "}; diff --git a/lib/maracasVisuLib/CMakeLists.txt b/lib/maracasVisuLib/CMakeLists.txt index c606552..f05f5e4 100644 --- a/lib/maracasVisuLib/CMakeLists.txt +++ b/lib/maracasVisuLib/CMakeLists.txt @@ -212,13 +212,10 @@ ELSE(WIN32) TARGETS ${LIBRARY_NAME} DESTINATION lib) ENDIF(WIN32) - - - - #---------------------------------------------------------------------------- - #--------------------------------------------------------------------------- ENDIF ( BUILD_${LIBRARY_NAME} ) + +SUBDIRS(src) diff --git a/lib/maracasVisuLib/src/CutModule/CMakeLists.txt b/lib/maracasVisuLib/src/CutModule/CMakeLists.txt new file mode 100644 index 0000000..a52a32a --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/CMakeLists.txt @@ -0,0 +1,26 @@ +#---------------------------------------------------------------------------- +# SET THE NAME OF YOUR LIBRARY + + +SET ( LIBRARY_NAME creaMaracasVisu_CutModule ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# CREATES A USER OPTION IN CMAKE +OPTION ( BUILD_${LIBRARY_NAME} "Build ${LIBRARY_NAME} library ?" ON) + +#---------------------------------------------------------------------------- +IF ( BUILD_${LIBRARY_NAME} )#---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # BUILD LIBRARY + #---------------------------------------------------------------------------- +#jhcl-Start=========================================================================== + INCLUDE_DIRECTORIES( + interface + kernel +) + SUBDIRS(interface) + SUBDIRS(kernel) +ENDIF ( BUILD_${LIBRARY_NAME} ) + diff --git a/lib/maracasVisuLib/src/CutModule/interface/CMakeLists.txt b/lib/maracasVisuLib/src/CutModule/interface/CMakeLists.txt new file mode 100644 index 0000000..2a59464 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/interface/CMakeLists.txt @@ -0,0 +1,51 @@ +#---------------------------------------------------------------------------- +# SET THE NAME OF YOUR LIBRARY +SET ( LIBRARY_NAME creaMaracasVisu_CutModule_interface ) +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # BUILD LIBRARY + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY HEADERS (TO BE INSTALLED) + # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE: + FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h") + # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND + # SET ( ${LIBRARY_NAME}_HEADERS + # + # ) + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY SOURCES (TO BE COMPILED) + # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: + FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc) + # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) + # SET ( ${LIBRARY_NAME}_SOURCES + # + # ) + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH) + SET ( ${LIBRARY_NAME}_LINK_LIBRARIES + ${crea_LIBRARIES} + ${WXWIDGETS_LIBRARIES} + # ${VTK_LIBRARIES} + # ${ITK_LIBRARIES} + # ${GDCM_LIBRARIES} + # ${BOOST_LIBRARIES} + ) + #---------------------------------------------------------------------------- + + + #---------------------------------------------------------------------------- + # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL + #CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) + #---------------------------------------------------------------------------- + + ADD_LIBRARY(${LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_SOURCES} ${${LIBRARY_NAME}_HEADERS} ) + # LINK + TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx new file mode 100644 index 0000000..fdd2630 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx @@ -0,0 +1,333 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelMainPanel.cxx,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:09 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + + + +// EOF - wxMaracasMPR.cxx + +#include "CutModelMainPanel.h" + + +#include +#include + +#include +#include +#include +#include + +CutModelMainPanel* CutModelMainPanel::instance=NULL; + +CutModelMainPanel::CutModelMainPanel( wxWindow* parent) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ + + cutmanager=NULL; + + initialize(); + +} +CutModelMainPanel::~CutModelMainPanel( ){ + + +} + +void CutModelMainPanel::initialize(){ + cutmanager = new CutModelManager(); + + _panelid = 0; + _wxauimanager = new wxAuiManager(this); + + wxAuiPaneInfo paneinfo; + _wxauimanager->AddPane(new ToolBarCutModel(this),paneinfo.ToolbarPane().Top()); + + _wxauimanager->Update(); +} + +CutModelMainPanel* CutModelMainPanel::getInstance(wxWindow* parent){ + if(instance==NULL){ + instance = new CutModelMainPanel(parent); + } + return instance; +} + +CutModelMainPanel* CutModelMainPanel::getInstance(){ + return instance; +} + +void CutModelMainPanel::setImageData(vtkImageData* img){ + try{ + checkInvariant(); + cutmanager->setImageData(img); + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::setInteractor(vtkRenderWindowInteractor* interactor){ + try{ + checkInvariant(); + cutmanager->setInteractor(interactor); + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::setRenderer(vtkRenderer* renderer){ + try{ + checkInvariant(); + cutmanager->setRenderer(renderer); + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::checkInvariant()throw (CutModelException){ + if(cutmanager==NULL){ + throw CutModelException("The manager is not initialize"); + } +} + +void CutModelMainPanel::showErrorDialog(std::string str){ + wxMessageDialog* diag = new wxMessageDialog(this, wxString(str.c_str(),wxConvUTF8 ), wxString(str.c_str(),wxConvUTF8 ), wxICON_ERROR); + diag->ShowModal(); +} + +void CutModelMainPanel::RemoveActor(int id){ + try{ + checkInvariant(); + + for(int i = 0; i < viewpanels.size()-1;i++){ + if(viewpanels[i]->getId()==id){ + for(int j = i; j < viewpanels.size()-1;j++){ + viewpanels[j]=viewpanels[j+1]; + } + i = viewpanels.size(); + } + } + viewpanels.pop_back(); + + + cutmanager->RemoveActor(id); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::onAddCutModel(){ + try{ + checkInvariant(); + + int id = addNewViewPanel(); + cutmanager->onAddCutModel(id, getModelView(id)); + + _panelid++; + + ShowCurrentPanel(id); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} +void CutModelMainPanel::ShowCurrentPanel(int id){ + for(int i = 0; i < viewpanels.size();i++){ + if(viewpanels[i]->getId()==id){ + _wxauimanager->GetPane(viewpanels[i]).Show(true); + }else{ + _wxauimanager->GetPane(viewpanels[i]).Show(false); + } + } + _wxauimanager->Update(); +} +int CutModelMainPanel::addNewViewPanel()throw( CutModelException){ + + CutModelView* viewpanel = new CutModelView(this,cutmanager->getImageRange()); + + wxAuiPaneInfo paneinfo0; + _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre()); + + viewpanel->setId(_panelid); + viewpanels.push_back(viewpanel); + + return viewpanel->getId(); + + +} +CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException){ + + CutModelView* current = NULL; + for(int i = 0; i < viewpanels.size();i++){ + if(viewpanels[i]->getId()==id){ + current = viewpanels[i]; + } + } + if(current == NULL){ + std::string s = "Id not found"; + throw CutModelException(s); + } + return current; +} +void CutModelMainPanel::onUndo(){ + +} + +void CutModelMainPanel::onRedo(){ + +} + +void CutModelMainPanel::changeOpacity(int id,int opacity){ + try{ + checkInvariant(); + cutmanager->changeOpacity(id, opacity); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::ShowViewBox(int id,bool check){ + try{ + checkInvariant(); + cutmanager->ShowViewBox(id, check); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} +void CutModelMainPanel::ShowPopUpMenu(int id){ + showErrorDialog("test"); +} +void CutModelMainPanel::changeColor(int id,double r,double g,double b){ + + try{ + checkInvariant(); + cutmanager->changeColor(id, r, g, b); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } + +} +void CutModelMainPanel::ChangeShape(int id,int selection){ + try{ + checkInvariant(); + + cutmanager->ChangeShape(id, selection); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} +void CutModelMainPanel::updateActorDirection(int id){ + try{ + checkInvariant(); + + cutmanager->updateActorDirection(id); + + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside){ + try{ + checkInvariant(); + cutmanager->ExecuteCut(id, range, isinside); + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } +} + +void CutModelMainPanel::ExecuteAll(){ + for(int i = 0; i < viewpanels.size();i++){ + viewpanels[i]->ExecuteCut(); + } + +} +vtkImageData* CutModelMainPanel::GetResultImage(){ + try{ + checkInvariant(); + return cutmanager->GetResultImage(); + }catch(CutModelException e){ + showErrorDialog(e.getCause()); + } + return NULL; +} +/** +** +**/ + +ToolBarCutModel::ToolBarCutModel(wxWindow * parent) +: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize) +{ + + wxBitmap bitmap10(Add_xpm); + this->AddTool(10, wxString(_T("Add")),bitmap10); + + this->AddSeparator(); + + wxBitmap bitmap20(Undo_xpm); + this->AddTool(20, wxString(_T("Undo")),bitmap20); + + wxBitmap bitmap30(Redo_xpm); + this->AddTool(30, wxString(_T("Redo")),bitmap30); + + this->AddSeparator(); + + wxBitmap bitmap40(OkAll_xpm); + this->AddTool(40, wxString(_T("Ok All")),bitmap40); + + this->Realize(); + + _evthand = new ToolBarEventHandlerCutModel(); + this->SetEventHandler(_evthand); + +} + +ToolBarCutModel::~ToolBarCutModel(void){ +} + +ToolBarEventHandlerCutModel::ToolBarEventHandlerCutModel() +: wxEvtHandler(){ +} +ToolBarEventHandlerCutModel::~ToolBarEventHandlerCutModel(){ +} + +void ToolBarEventHandlerCutModel::onAdd(wxCommandEvent& event){ + CutModelMainPanel::getInstance()->onAddCutModel(); +} + +void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event){ + CutModelMainPanel::getInstance()->onUndo(); +} + +void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event){ + CutModelMainPanel::getInstance()->onRedo(); +} + +void ToolBarEventHandlerCutModel::onExecuteAll(wxCommandEvent& event){ + CutModelMainPanel::getInstance()->ExecuteAll(); +} + + +BEGIN_EVENT_TABLE(ToolBarEventHandlerCutModel, wxEvtHandler) + EVT_MENU(10, ToolBarEventHandlerCutModel::onAdd) + EVT_MENU(20, ToolBarEventHandlerCutModel::onUndo) + EVT_MENU(30, ToolBarEventHandlerCutModel::onRedo) + EVT_MENU(40, ToolBarEventHandlerCutModel::onExecuteAll) +END_EVENT_TABLE() + diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h new file mode 100644 index 0000000..8eb3d66 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h @@ -0,0 +1,140 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelMainPanel.h,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:09 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#ifndef __CutModelMainPanelPanelH__ +#define __CutModelMainPanelPanelH__ + +#include +#include +#include +#include "wx/aui/aui.h" +#include +#include +#include "marTypes.h" + + +#include "CutModelManager.h" +#include "CutModelException.h" +#include "CutModelView.h" + +#include "vtkImageData.h" +#include "vtkRenderWindowInteractor.h" + + +class creaMaracasVisu_EXPORT CutModelMainPanel : public wxPanel +{ + +public: + CutModelMainPanel( wxWindow* parent); + ~CutModelMainPanel( ); + + static CutModelMainPanel* getInstance(wxWindow* parent); + + static CutModelMainPanel* getInstance(); + + void setImageData(vtkImageData* img); + + void setInteractor(vtkRenderWindowInteractor* interactor); + + void setRenderer(vtkRenderer* renderer); + + void initialize(); + + void onAddCutModel(); + + void onUndo(); + + void onRedo(); + + void changeOpacity(int id,int opacity); + + void ShowViewBox(int id,bool check); + + void ChangeShape(int id,int selection); + + void changeColor(int id,double r,double g,double b); + + void updateActorDirection(int id); + + void RemoveActor(int id); + + void ExecuteCut(int id, double* range, bool isinside); + + void ExecuteAll(); + + vtkImageData* GetResultImage(); + + void ShowCurrentPanel(int id); + + void ShowPopUpMenu(int id); +private: + static CutModelMainPanel* instance; + + CutModelManager* cutmanager; + + void checkInvariant() throw( CutModelException); + + void showErrorDialog(std::string str); + + std::vector viewpanels; + + wxAuiManager* _wxauimanager; + + + int addNewViewPanel()throw( CutModelException); + + CutModelView* getModelView(int id)throw( CutModelException); + + int _panelid; +}; + + +class ToolBarEventHandlerCutModel : public wxEvtHandler{ + + public: + ToolBarEventHandlerCutModel(); + ~ToolBarEventHandlerCutModel(); + + void onAdd(wxCommandEvent& event); + + void onUndo(wxCommandEvent& event); + + void onRedo(wxCommandEvent& event); + + void onExecuteAll(wxCommandEvent& event); + + private: + + DECLARE_EVENT_TABLE() + }; + +class ToolBarCutModel : public wxToolBar{ + + +public: + ToolBarCutModel(wxWindow * parent); + ~ToolBarCutModel(void); + + +private: + + ToolBarEventHandlerCutModel* _evthand; + +}; + +#endif + diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx new file mode 100644 index 0000000..0be3752 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx @@ -0,0 +1,236 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelView.cxx,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:09 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + + + +// EOF - wxMaracasMPR.cxx + +#include "CutModelView.h" + + +#include +#include + +#include +#include +#include + +#include "vtkBoxWidget.h" + +#include "CutModelMainPanel.h" + +CutModelView::CutModelView( wxWindow* parent, double* range) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ + + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + + this->SetSizer(sizer); + + sizer->Add(getBoxControls(this, range),wxSizerFlags().FixedMinSize()); + + sizer->AddSpacer(5); + + sizer->Add(getActorProperties(this),wxSizerFlags().FixedMinSize()); + + + wxBitmap bitmapok(Ok1_xpm); + wxBitmapButton* okbutton = new wxBitmapButton(this, -1, bitmapok,wxDefaultPosition,wxSize(30,30)); + Connect(okbutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModelViewEventHandler::onExecute)); + + sizer->AddSpacer(5); + sizer->Add(okbutton,wxSizerFlags().FixedMinSize()); + + + + + +} +CutModelView::~CutModelView( ){ + CutModelMainPanel::getInstance()->RemoveActor(this->getId()); +} + +wxSizer* CutModelView::getBoxControls(wxWindow* parent,double* range){ + + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + wxCheckBox* checkbox = new wxCheckBox(parent,-1,_T("View Box")); + sizer->Add(checkbox,wxSizerFlags().FixedMinSize()); + checkbox->SetValue(true); + Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)(&CutModelViewEventHandler::onViewBoxChecked)); + + wxString choices1[3]; + //choices1[0] = _T("Select a shape..."); + choices1[0] = _T("Sphere"); + choices1[1] = _T("Cylinder"); + choices1[2] = _T("Cube"); + wxComboBox* combo = new wxComboBox(parent, -1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices1); + combo->SetValue(_T("Sphere")); + sizer->Add(combo,wxSizerFlags().FixedMinSize()); + Connect(combo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)(&CutModelViewEventHandler::onShapeChange)); + + wxStaticText* labelgreyv = new wxStaticText(parent, -1, wxString(_T("Grey value range"))); + _sliderrange = new wxSlider(parent, -1, range[0],range[0],range[1],wxDefaultPosition,wxDefaultSize,wxSL_LABELS|wxSL_SELRANGE); + wxBoxSizer* sizergreyv = new wxBoxSizer(wxVERTICAL); + sizergreyv->Add(labelgreyv,wxSizerFlags().FixedMinSize()); + sizergreyv->Add(_sliderrange,wxSizerFlags().FixedMinSize()); + sizer->Add(sizergreyv,wxSizerFlags().FixedMinSize().Border()); + + wxString choices[2]; + choices[0] = _T("Cut"); + choices[1] = _T("Statistics"); + _radiocutstat = new wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices); + sizer->Add(_radiocutstat,wxSizerFlags().FixedMinSize()); + + wxString choices0[2]; + choices0[0] = _T("inside"); + choices0[1] = _T("outside"); + _radioinsideout = new wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices0); + sizer->Add(_radioinsideout,wxSizerFlags().FixedMinSize()); + + return sizer; +} +wxSizer* CutModelView::getActorProperties(wxWindow* parent){ + + wxBoxSizer* sizeractorproperties = new wxBoxSizer(wxVERTICAL); + + wxStaticText* labelshapeactor = new wxStaticText(parent, -1, wxString(_T("Actor's properties"))); + + sizeractorproperties->Add(labelshapeactor,wxSizerFlags().FixedMinSize()); + + sizeractorproperties->Add(getColorChooseActor(parent),wxSizerFlags().FixedMinSize()); + + sizeractorproperties->Add(getOpacityActor(parent),wxSizerFlags().FixedMinSize()); + + return sizeractorproperties; + +} + +wxSizer* CutModelView::getOpacityActor(wxWindow* parent){ + wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL); + + wxStaticText* labelopacity = new wxStaticText(parent, -1, wxString(_T("Opacity"))); + wxSlider* slider0 = new wxSlider(parent, -1, 40,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS); + Connect(slider0->GetId(), wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(&CutModelViewEventHandler::onOpacityChange)); + + sizeropacity->Add(labelopacity,wxSizerFlags().FixedMinSize()); + sizeropacity->Add(slider0,wxSizerFlags().FixedMinSize()); + + return sizeropacity; +} + +wxSizer* CutModelView::getColorChooseActor(wxWindow* parent){ + wxBoxSizer* sizercolor = new wxBoxSizer(wxHORIZONTAL); + wxBitmap bitmap(Color_xpm); + wxBitmapButton* colorchoose = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30)); + wxObjectEventFunction f = (wxObjectEventFunction)(&CutModelViewEventHandler::onColorChange); + Connect(colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, f); + + _currentcolor = new wxStaticText(parent,-1,_T(""),wxDefaultPosition,wxSize(20,20)); + + sizercolor->Add(colorchoose,wxSizerFlags().FixedMinSize()); + sizercolor->AddSpacer(5); + sizercolor->Add(_currentcolor,wxSizerFlags().FixedMinSize().Centre()); + return sizercolor; +} + +void CutModelView::checkInvariant()throw (CutModelException){ + +} + +void CutModelView::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual + //vtkBoxWidget *boxwidget = reinterpret_cast(wdg); + + if(eventId==vtkCommand::StartInteractionEvent){ + CutModelMainPanel::getInstance()->ShowCurrentPanel(this->getId()); + }else if(eventId==vtkCommand::InteractionEvent){ + CutModelMainPanel::getInstance()->updateActorDirection(this->getId()); + }else if(eventId==vtkCommand::RightButtonReleaseEvent){ + // =( + CutModelMainPanel::getInstance()->ShowPopUpMenu(this->getId()); + } +} + +void CutModelView::ExecuteCut(){ + if(this->isCut()){ + CutModelMainPanel::getInstance()->ExecuteCut(this->getId(),this->getRange(),this->isInside()); + }else{ + } + +} + +double* CutModelView::getRange(){ + double* x = new double[3]; + x[0] = 0; + x[1] = _sliderrange->GetValue(); + x[2] = 100000; + + return x; +} +bool CutModelView::isCut(){ + return _radiocutstat->GetSelection()==0; +} +bool CutModelView::isInside(){ + return _radioinsideout->GetSelection()==0; +} +void CutModelView::SetCurrentColor(wxColour colour){ + _currentcolor->SetBackgroundColour(colour); + + this->Refresh(); + this->Layout(); +} + +void CutModelViewEventHandler::onColorChange(wxCommandEvent& event){ + CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); + wxColourDialog* colourdiag = new wxColourDialog(parent); + if(colourdiag->ShowModal()==wxID_OK){ + wxColour colour = colourdiag->GetColourData().GetColour(); + + parent->SetCurrentColor(colour); + + double r = (double)(colour.Red())/255.0; + double g = (double)(colour.Green())/255.0; + double b = (double)(colour.Blue())/255.0; + CutModelMainPanel::getInstance()->changeColor(parent->getId(),r,g,b); + + + } + delete colourdiag; +} + +void CutModelViewEventHandler::onOpacityChange(wxScrollEvent& event){ + CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); + + CutModelMainPanel::getInstance()->changeOpacity(parent->getId(),event.GetInt()); +} +void CutModelViewEventHandler::onViewBoxChecked(wxCommandEvent& event){ + CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); + + CutModelMainPanel::getInstance()->ShowViewBox(parent->getId(),event.IsChecked()); +} +void CutModelViewEventHandler::onShapeChange(wxCommandEvent& event){ + CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); + + //if(event.GetSelection()>0){ + //std::cout<<"id in CutModelViewEventHandler:: "<getId()<ChangeShape(parent->getId(),event.GetSelection()); + //} +} +void CutModelViewEventHandler::onExecute(wxCommandEvent& event){ + CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); + + parent->ExecuteCut(); + +} diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h new file mode 100644 index 0000000..1266030 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h @@ -0,0 +1,101 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelView.h,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:09 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#ifndef __CutModelViewPanelH__ +#define __CutModelViewPanelH__ + +#include +#include +#include +#include "wx/aui/aui.h" +#include +#include "marTypes.h" + + +#include "CutModelManager.h" +#include "CutModelException.h" + +#include "vtkObject.h" +#include "vtkCommand.h" + + +class creaMaracasVisu_EXPORT CutModelView : public wxPanel, public vtkCommand +{ + +public: + CutModelView( wxWindow* parent,double* range); + ~CutModelView( ); + + virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; + + int getId(){ + return _id; + } + void setId(int id){ + _id = id; + } + + void ExecuteCut(); + + void SetCurrentColor(wxColour colour); + +private: + + int _id; + + wxSlider* _sliderrange; + wxRadioBox* _radioinsideout; + wxRadioBox* _radiocutstat; + wxStaticText* _currentcolor; + + double* getRange(); + bool isCut(); + bool isInside(); + + + + wxSizer* getBoxControls(wxWindow* parent, double* range); + + + wxSizer* getActorProperties(wxWindow* parent); + wxSizer* getColorChooseActor(wxWindow* parent); + wxSizer* getOpacityActor(wxWindow* parent); + + void checkInvariant() throw( CutModelException); + +}; + +class CutModelViewEventHandler : public wxEvtHandler{ + + public: + CutModelViewEventHandler(): wxEvtHandler(){}; + ~CutModelViewEventHandler(){}; + + void onColorChange(wxCommandEvent& event); + void onOpacityChange(wxScrollEvent& event); + void onViewBoxChecked(wxCommandEvent& event); + void onShapeChange(wxCommandEvent& event); + void onExecute(wxCommandEvent& event); + + + private: + +}; + + +#endif + diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CMakeLists.txt b/lib/maracasVisuLib/src/CutModule/kernel/CMakeLists.txt new file mode 100644 index 0000000..96115d8 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CMakeLists.txt @@ -0,0 +1,50 @@ +#---------------------------------------------------------------------------- +# SET THE NAME OF YOUR LIBRARY +SET ( LIBRARY_NAME creaMaracasVisu_CutModule_kernel ) +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # BUILD LIBRARY + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY HEADERS (TO BE INSTALLED) + # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE: + FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h") + # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND + # SET ( ${LIBRARY_NAME}_HEADERS + # + # ) + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY SOURCES (TO BE COMPILED) + # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: + FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc) + # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) + # SET ( ${LIBRARY_NAME}_SOURCES + # + # ) + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH) + SET ( ${LIBRARY_NAME}_LINK_LIBRARIES + ${crea_LIBRARIES} + # ${VTK_LIBRARIES} + # ${ITK_LIBRARIES} + # ${GDCM_LIBRARIES} + # ${BOOST_LIBRARIES} + ) + #---------------------------------------------------------------------------- + + + #---------------------------------------------------------------------------- + # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL + #CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) + #---------------------------------------------------------------------------- + + ADD_LIBRARY(${LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_SOURCES} ${${LIBRARY_NAME}_HEADERS} ) + # LINK + TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx new file mode 100644 index 0000000..7396cc2 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx @@ -0,0 +1,261 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelData.cxx,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:11 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "CutModelData.h" + +/** +** Start of the manager class +**/ +CutModelData::CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){ + _id = id; + _currentshape=0; + createBoxWidget(interactor, observer); + setTransform(img); + createActor(); + createShapes(); + ChangeShape(0); + checkInvariant(); + + +} +CutModelData::~CutModelData(){ + checkInvariant(); + _boxWidgetVolume->Off(); + _boxWidgetVolume->Delete(); + _Mapper->Delete(); + _Actor->Delete(); + delete _cubefigure; + delete _cylinderfigure; + delete _spherefigure; + currentmatrix->Delete(); + inversModel->Delete(); +} + +void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer){ + + _boxWidgetVolume = vtkBoxWidget::New(); + _boxWidgetVolume->SetInteractor( interactor ); + //_boxWidgetVolume->SetPlaceFactor(2); + //_boxWidgetVolume->SetInput( img ); + //_boxWidgetVolume->PlaceWidget(); + _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , observer ); + _boxWidgetVolume->AddObserver( vtkCommand::StartInteractionEvent , observer ); + _boxWidgetVolume->AddObserver( vtkCommand::RightButtonReleaseEvent , observer ); + + _boxWidgetVolume->HandlesOn (); + _boxWidgetVolume->On(); +} +void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){ + + currentmatrix = vtkTransform::New(); + modeltransform = vtkTransform::New(); + inversModel = vtkTransform::New(); + + vtkMatrix4x4* matrix = vtkMatrix4x4::New(); + matrix->Identity(); + int *ext = img->GetExtent(); + double *spc = img->GetSpacing(); + + matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]); + matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]); + matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]); + matrix->SetElement(0,3,(ext[1]-ext[0])/2*spc[0]); + matrix->SetElement(1,3,(ext[3]-ext[2])/2*spc[1]); + matrix->SetElement(2,3,(ext[5]-ext[4])/2*spc[2]); + + currentmatrix->SetMatrix(matrix); + _boxWidgetVolume->SetTransform(currentmatrix); + +} +void CutModelData::createActor(){ + + _Mapper = vtkPolyDataMapper::New(); + _Actor = vtkActor::New(); + _Actor->SetMapper(_Mapper); + _Actor->GetProperty()->SetColor(1, 0, 0); + _Actor->GetProperty()->SetOpacity(0.4); + +} +void CutModelData::udapteActorDirection()throw( CutModelException){ + checkInvariant(); + + _boxWidgetVolume->GetTransform(currentmatrix); + _Actor->SetUserMatrix(currentmatrix->GetMatrix());//SetUserTransform(currentmatrix ); +} +void CutModelData::createShapes(){ + _cubefigure = new CutModelFigureCube(); + _cylinderfigure = new CutModelFigureCylinder(); + _spherefigure = new CutModelFigureSphere(); +} +void CutModelData::changeOpacity(int opacity)throw( CutModelException){ + checkInvariant(); + _Actor->GetProperty()->SetOpacity((double)opacity/100.0); +} + +void CutModelData::ShowViewBox(bool check)throw( CutModelException){ + checkInvariant(); + if(check){ + _boxWidgetVolume->On(); + }else{ + _boxWidgetVolume->Off(); + } +} + +void CutModelData::ChangeShape(int selection)throw( CutModelException){ + checkInvariant(); + + if(selection == 0){ + _Mapper->SetInput(_spherefigure->getPolyData()); + }else if(selection == 1){ + _Mapper->SetInput(_cylinderfigure->getPolyData()); + }else if(selection == 2){ + _Mapper->SetInput(_cubefigure->getPolyData()); + }else{ + throw CutModelException("Shape type not found"); + } + + _currentshape=selection; +} + +void CutModelData::checkInvariant()throw( CutModelException){ + if(_boxWidgetVolume==NULL){ + throw CutModelException("Box Widget not created"); + } + if(_Mapper==NULL){ + throw CutModelException("Mapper not created"); + } + if(_Actor==NULL){ + throw CutModelException("Actor not created"); + } + if(_cubefigure==NULL){ + throw CutModelException("Cube not created"); + } + if(_cylinderfigure==NULL){ + throw CutModelException("Cylinder not created"); + } + if(_spherefigure==NULL){ + throw CutModelException("Sphere not created"); + } + +} + +vtkActor* CutModelData::getActor()throw( CutModelException){ + checkInvariant(); + return _Actor; +} + +void CutModelData::changeColor(double r,double g,double b)throw( CutModelException){ + checkInvariant(); + _Actor->GetProperty()->SetColor( r,g,b ); +} +CutModelFigure* CutModelData::getCurentCuttingModel(){ + checkInvariant(); + + if(_currentshape == 0){ + return _spherefigure; + }else if(_currentshape == 1){ + return _cylinderfigure; + }else if(_currentshape == 2){ + return _cubefigure; + }else{ + throw CutModelException("Shape type not found"); + } +} +void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage) +{ + + wxBusyCursor wait; + + CutModelFigure* actualCuttingModel = getCurentCuttingModel(); + + actualCuttingModel->SetVtkTransform(getModelTransform(copyimage)); + actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); + + bool inside; + bool volInt, volExt; + int xx,yy,zz; + unsigned short* pOrg; + int ext[6]; + double spc[3]; + long int contAfter = 0; + long int contBefor = 0; + + double minvalue = range[0]; + double value = range[1]; + double maxvalue = range[2]; + + + copyimage->GetExtent(ext); + + for (xx=ext[0];xxIfPointInside(xx,yy,zz); + if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) ) + { + pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); + + //std::cout<<"xx,yy,zz "<GetMatrix(); + vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix(); + + double *spc = copyimage->GetSpacing(); + + matrixmodel->Identity(); + matrixmodel->SetElement(0,0,matrix->GetElement(0,0)/spc[0]); + matrixmodel->SetElement(1,0,matrix->GetElement(1,0)/spc[0]); + matrixmodel->SetElement(2,0,matrix->GetElement(2,0)/spc[0]); + matrixmodel->SetElement(0,1,matrix->GetElement(0,1)/spc[1]); + matrixmodel->SetElement(1,1,matrix->GetElement(1,1)/spc[1]); + matrixmodel->SetElement(2,1,matrix->GetElement(2,1)/spc[1]); + matrixmodel->SetElement(0,2,matrix->GetElement(0,2)/spc[2]); + matrixmodel->SetElement(1,2,matrix->GetElement(1,2)/spc[2]); + matrixmodel->SetElement(2,2,matrix->GetElement(2,2)/spc[2]); + matrixmodel->SetElement(0,3,matrix->GetElement(0,3)/spc[0]); + matrixmodel->SetElement(1,3,matrix->GetElement(1,3)/spc[1]); + matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); + + + modeltransform->Update(); + + return modeltransform; + + +} +vtkTransform* CutModelData::getModelTransformInvers(){ + inversModel->Identity (); + inversModel->Concatenate ( modeltransform ); + inversModel->Inverse(); + return inversModel; +} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h new file mode 100644 index 0000000..5f6f53e --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h @@ -0,0 +1,94 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelData.h,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:11 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + + + + +#ifndef __CutModelDataH__ +#define __CutModelDataH__ + +#include +#include + +#include "vtkImageData.h" +#include "vtkRenderWindowInteractor.h" +#include "vtkCommand.h" +#include "vtkBoxWidget.h" +#include "vtkPolyDataMapper.h" +#include "vtkActor.h" +#include "vtkProperty.h" +#include "CutModelException.h" +#include "CutModelFigure.h" +#include "CutModelFigureCube.h" +#include "CutModelFigureSphere.h" +#include "CutModelFigureCylinder.h" + +#include + +class CutModelData { + +public: + CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img); + ~CutModelData(); + + int getId(){ + return _id; + } + + void changeOpacity(int opacity)throw( CutModelException); + + void ShowViewBox(bool check)throw( CutModelException); + + void ChangeShape(int selection)throw( CutModelException); + + vtkActor* getActor()throw( CutModelException); + + void changeColor(double r,double g,double b)throw( CutModelException); + + void udapteActorDirection()throw( CutModelException); + + void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException); +private: + + void checkInvariant()throw( CutModelException); + + void createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer); + void createActor(); + void setTransform(vtkImageData* img)throw( CutModelException); + void createShapes(); + + vtkBoxWidget* _boxWidgetVolume; + vtkPolyDataMapper* _Mapper; + vtkActor* _Actor; + int _id; + + int _currentshape; + + CutModelFigureCube* _cubefigure; + CutModelFigureCylinder* _cylinderfigure; + CutModelFigureSphere* _spherefigure; + vtkTransform* currentmatrix; + vtkTransform* modeltransform; + vtkTransform* inversModel; + + CutModelFigure* getCurentCuttingModel(); + + vtkTransform* getModelTransform(vtkImageData* copyimage); + vtkTransform* getModelTransformInvers(); +}; + +#endif diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelException.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelException.cxx new file mode 100644 index 0000000..c20984f --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelException.cxx @@ -0,0 +1,31 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelException.cxx,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:11 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "CutModelException.h" + +/** +** Start of the manager class +**/ +CutModelException::CutModelException(std::string cause) +:std::exception(){ + _cause = cause; +} +CutModelException::~CutModelException(){ +} + + + + diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelException.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelException.h new file mode 100644 index 0000000..d4461a6 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelException.h @@ -0,0 +1,44 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelException.h,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:11 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + + + + +#ifndef __CutModelExceptionH__ +#define __CutModelExceptionH__ + +#include +#include + + +class CutModelException : public std::exception{ + +public: + CutModelException(std::string cause); + ~CutModelException(); + + std::string getCause(){ + return _cause; + } + +private: + + std::string _cause; + +}; + +#endif diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.cxx__ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.cxx__ new file mode 100644 index 0000000..6be77f5 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.cxx__ @@ -0,0 +1,152 @@ + +#include "CutModelFigure.h" + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +CutModelFigure::CutModelFigure() +{ + _inversModel = vtkTransform::New(); + _matrixModel = vtkTransform::New(); + _matrixVisual = vtkTransform::New(); + + _spcX=1; + _spcY=1; + _spcZ=1; +} +//---------------------------------------------------------------------------- +CutModelFigure::~CutModelFigure() // virtual +{ + _inversModel->Delete(); +} +//---------------------------------------------------------------------------- +void CutModelFigure::SetPosition(double x,double y, double z) +{ + _px=x; + _py=y; + _pz=z; +} +//---------------------------------------------------------------------------- +void CutModelFigure::SetScale(double sx,double sy, double sz) +{ + _sx=sx; + _sy=sy; + _sz=sz; +} +//---------------------------------------------------------------------------- +void CutModelFigure::SetRotation(double alfa,double beta, double teta) +{ + _alfa=alfa; + _beta=beta; + _teta=teta; +} + +//---------------------------------------------------------------------------- +void CutModelFigure::CalculeMatrix() +{ + _matrixModel->Identity(); + _matrixModel->Translate(_px,_py,_pz); + _matrixModel->RotateY(_beta); + _matrixModel->RotateX(_alfa); + _matrixModel->RotateY(_teta); + _matrixModel->Scale(_sx,_sy,_sz); + + _matrixVisual->Identity(); + _matrixVisual->Translate( _px*_spcX , _py*_spcY , _pz*_spcZ ); + _matrixVisual->RotateY(_beta); + _matrixVisual->RotateX(_alfa); + _matrixVisual->RotateY(_teta); + _matrixVisual->Scale( _sx*_spcX , _sy*_spcY , _sz*_spcZ ); + +} + + +//---------------------------------------------------------------------------- +void CutModelFigure::CalculeInversMatrix() +{ + _inversModel->Identity (); + _inversModel->Concatenate ( _matrixModel ); + _inversModel->Inverse(); +} +//---------------------------------------------------------------------------- +bool CutModelFigure::IfPointInside(double x, double y, double z) // virtual +{ + return true; +} + +//---------------------------------------------------------------------------- +vtkTransform *CutModelFigure::GetVtkTransform() +{ + return _matrixVisual; +} + +//---------------------------------------------------------------------------- +//void CutModelFigure::SetVtkTransform(vtkTransform *matrix) +//{ +// _matrixModel = matrix; +//} + +//---------------------------------------------------------------------------- +double CutModelFigure::GetTheoricVolume() // virtual +{ + return 0; +} + +//---------------------------------------------------------------------------- +double CutModelFigure::GetPositionX() +{ + return _px; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetPositionY() +{ + return _py; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetPositionZ() +{ + return _pz; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetScaleX() +{ + return _sx; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetScaleY() +{ + return _sy; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetScaleZ() +{ + return _sz; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetAngleAlfa() +{ + return _alfa; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetAngleBeta() +{ + return _beta; +} +//---------------------------------------------------------------------------- +double CutModelFigure::GetAngleTeta() +{ + return _teta; +} +//---------------------------------------------------------------------------- +char *CutModelFigure::GetName() // virtual +{ + return "--"; +} + +//---------------------------------------------------------------------------- +void CutModelFigure::SetSpacing(double spcX,double spcY, double spcZ) +{ + _spcX = spcX; + _spcY = spcY; + _spcZ = spcZ; +} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.h new file mode 100644 index 0000000..476a090 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigure.h @@ -0,0 +1,83 @@ +#ifndef FIGURECUTTINGMODEL_H_ +#define FIGURECUTTINGMODEL_H_ + +#include "vtkTransform.h" +#include "vtkPolyData.h" + +class CutModelFigure +{ +public: + CutModelFigure(){} + + //~CutModelFigure(); + + virtual void SetPosition(double x,double y, double z){ + _px = x; + _py = y; + _pz = z; + } + + virtual void SetScale(double sx,double sy, double sz){ + _sx = sx; + _sy = sy; + _sz = sz; + } + + virtual void SetRotation(double alfa,double beta, double teta){ + _alfa = alfa; + _beta = beta; + _teta = teta; + } + + virtual void SetSpacing(double spcX,double spcY, double spcZ){ + _spcX = spcX; + _spcY = spcY; + _spcZ = spcZ; + } + + virtual void SetVtkTransform(vtkTransform *transform){ + double *orient = transform->GetOrientation(); + _alfa = orient[0]; + _beta = orient[1]; + _teta = orient[2]; + + double *scale = transform->GetScale(); + _sx = scale[0]; + _sy = scale[1]; + _sz = scale[2]; + + double *position = transform->GetPosition(); + _px = position[0]; + _py = position[1]; + _pz = position[2]; + + + } + virtual void SetInversVtkTransform(vtkTransform *inverstransform){ + _inversModel = inverstransform; + } + + virtual bool IfPointInside(double x, double y, double z) = 0; + virtual double GetTheoricVolume()=0; + virtual vtkPolyData* getPolyData()=0; + +private: + double _px; + double _py; + double _pz; + double _alfa; + double _beta; + double _teta; + double _spcX; + double _spcY; + double _spcZ; + char *GetName; +protected: + double _sx; + double _sy; + double _sz; + vtkTransform *_inversModel; + vtkTransform *_matrixModel; +}; + +#endif /*FIGURECUTTINGMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx new file mode 100644 index 0000000..a5c7659 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx @@ -0,0 +1,50 @@ + +#include "CutModelFigureCube.h" + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +CutModelFigureCube::CutModelFigureCube() +: CutModelFigure() +{ + _vtkcube = vtkCubeSource::New(); + _vtkcube->SetXLength (1); + _vtkcube->SetYLength (1); + _vtkcube->SetZLength (1); +} +//---------------------------------------------------------------------------- +CutModelFigureCube::~CutModelFigureCube() // virtual +{ + _vtkcube->Delete(); +} +//---------------------------------------------------------------------------- +bool CutModelFigureCube::IfPointInside(double x, double y, double z) // virtual +{ + double in[4],out[4]; + in[0]=x; + in[1]=y; + in[2]=z; + in[3]=1; + _inversModel->MultiplyPoint (in, out); + + bool result=false; + if ((out[0]>-0.5) && (out[0]<0.5) && (out[1]>-0.5) && (out[1]<0.5) && (out[2]>-0.5) && (out[2]<0.5) ) + { + result=true; + } + return result; +} +//---------------------------------------------------------------------------- +double CutModelFigureCube::GetTheoricVolume() // virtual +{ + return _sx * _sy * _sz; +} + +//---------------------------------------------------------------------------- +char *CutModelFigureCube::GetName() // virtual +{ + return "Cube"; +} +vtkPolyData* CutModelFigureCube::getPolyData(){ + return _vtkcube->GetOutput(); +} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h new file mode 100644 index 0000000..31858cc --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h @@ -0,0 +1,21 @@ +#ifndef CutModelFigureCube_H_ +#define CutModelFigureCube_H_ + +#include "CutModelFigure.h" +#include "vtkCubeSource.h" + +class CutModelFigureCube : public CutModelFigure +{ +public: + CutModelFigureCube(); + virtual ~CutModelFigureCube(); + virtual bool IfPointInside(double x, double y, double z); + virtual double GetTheoricVolume(); + virtual vtkPolyData* getPolyData(); + virtual char *GetName(); +private: + vtkCubeSource* _vtkcube; +protected: +}; + +#endif /*FIGURECUTTINGCUBEMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx new file mode 100644 index 0000000..4ef0a77 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx @@ -0,0 +1,45 @@ + +#include "CutModelFigureCylinder.h" + +CutModelFigureCylinder::CutModelFigureCylinder() +{ + _vtkcylinder = vtkCylinderSource::New(); + _vtkcylinder->SetResolution(20); +} +//---------------------------------------------------------------------------- +CutModelFigureCylinder::~CutModelFigureCylinder() // virtual +{ + _vtkcylinder->Delete(); +} +//---------------------------------------------------------------------------- +bool CutModelFigureCylinder::IfPointInside(double x, double y, double z) // virtual +{ + double in[4],out[4]; + in[0]=x; + in[1]=y; + in[2]=z; + in[3]=1; + _inversModel->MultiplyPoint (in, out); + + bool result=false; + if ((sqrt( out[0]*out[0] + out[2]*out[2] )<0.5 ) && (out[1]>-0.5) && (out[1]<0.5) ) + { + result=true; + } + return result; +} +//---------------------------------------------------------------------------- +double CutModelFigureCylinder::GetTheoricVolume() // virtual +{ + double piTMP=3.14159265; + return piTMP*(_sx/2)*(_sz/2)*_sy; +} +//---------------------------------------------------------------------------- +char *CutModelFigureCylinder::GetName() // virtual +{ + return "Cylinder"; +} +vtkPolyData* CutModelFigureCylinder::getPolyData(){ + return _vtkcylinder->GetOutput(); +} +//---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h new file mode 100644 index 0000000..410a4fa --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h @@ -0,0 +1,22 @@ +#ifndef CutModelFigureCylinder_H_ +#define CutModelFigureCylinder_H_ + +#include "CutModelFigure.h" +#include "vtkCylinderSource.h" + +class CutModelFigureCylinder : public CutModelFigure +{ +public: + CutModelFigureCylinder(); + virtual ~CutModelFigureCylinder(); + virtual bool IfPointInside(double x, double y, double z); + virtual double GetTheoricVolume(); + virtual vtkPolyData* getPolyData(); + virtual char *GetName(); + +private: + vtkCylinderSource* _vtkcylinder; +protected: +}; + +#endif /*FIGURECUTTINGCYLINDERMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx new file mode 100644 index 0000000..127b8ca --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx @@ -0,0 +1,47 @@ +#include "CutModelFigureSphere.h" + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +CutModelFigureSphere::CutModelFigureSphere() +{ + _vtksphere = vtkSphereSource::New(); + _vtksphere->SetThetaResolution (20); + _vtksphere->SetPhiResolution (20); +} +//---------------------------------------------------------------------------- +CutModelFigureSphere::~CutModelFigureSphere() // virtual +{ + _vtksphere->Delete(); +} +//---------------------------------------------------------------------------- +bool CutModelFigureSphere::IfPointInside(double x, double y, double z) // virtual +{ + double in[4],out[4]; + in[0]=x; + in[1]=y; + in[2]=z; + in[3]=1; + _inversModel->MultiplyPoint (in, out); + + bool result=false; + if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 ) + { + result=true; + } + return result; +} +//---------------------------------------------------------------------------- +double CutModelFigureSphere::GetTheoricVolume() // virtual +{ + double piTMP=3.14159265; + return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2); +} +//---------------------------------------------------------------------------- +char *CutModelFigureSphere::GetName() // virtual +{ + return "Sphere"; +} +vtkPolyData* CutModelFigureSphere::getPolyData(){ + return _vtksphere->GetOutput(); +} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h new file mode 100644 index 0000000..4ce69c6 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h @@ -0,0 +1,21 @@ +#ifndef CutModelFigureSphere_H_ +#define CutModelFigureSphere_H_ + +#include "CutModelFigure.h" +#include "vtkSphereSource.h" + +class CutModelFigureSphere : public CutModelFigure +{ +public: + CutModelFigureSphere(); + virtual ~CutModelFigureSphere(); + virtual bool IfPointInside(double x, double y, double z); + virtual double GetTheoricVolume(); + virtual char *GetName(); + virtual vtkPolyData* getPolyData(); +private: + vtkSphereSource* _vtksphere; +protected: +}; + +#endif /*FIGURECUTTINGSPHEREMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx new file mode 100644 index 0000000..6aa1875 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx @@ -0,0 +1,167 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelManager.cxx,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:12 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "CutModelManager.h" + +/** +** Start of the manager class +**/ +CutModelManager::CutModelManager(){ + _img = NULL; + _copyimg = NULL; + _interactor = NULL; + _render = NULL; +} +CutModelManager::~CutModelManager(){ +} + + +void CutModelManager::setImageData(vtkImageData* img){ + _img = img; + if(_copyimg!=NULL){ + _copyimg->Delete(); + } + _copyimg = vtkImageData::New(); + _copyimg->SetExtent(_img->GetExtent()); + _copyimg->SetSpacing(_img->GetSpacing()); + _copyimg->AllocateScalars(); + + _copyimg->DeepCopy(_img); + +} + +void CutModelManager::setInteractor(vtkRenderWindowInteractor* interactor){ + _interactor = interactor; +} + +void CutModelManager::setRenderer(vtkRenderer* renderer){ + _render = renderer; +} + +void CutModelManager::onAddCutModel(int id, vtkCommand* observer) throw( CutModelException){ + checkInvariant(); + + CutModelData* data = new CutModelData(id,_interactor, observer, _img); + _vectordata.push_back(data); + + _render->AddActor(data->getActor()); + + //_render->UpdateCamera(); + _render->Render(); +} + +void CutModelManager::checkInvariant() throw( CutModelException){ + if(_img==NULL){ + throw CutModelException("The image is not set"); + } + if(_copyimg==NULL){ + throw CutModelException("The image is not set"); + } + if(_interactor==NULL){ + throw CutModelException("Interactor not set"); + } + if(_render==NULL){ + throw CutModelException("Render not set"); + } +} + +double* CutModelManager::getImageRange()throw( CutModelException){ + checkInvariant(); + return _img->GetScalarRange(); +} + +void CutModelManager::changeOpacity(int id,int opacity)throw( CutModelException){ + checkInvariant(); + CutModelData* current = getCutModelData(id); + current->changeOpacity(opacity); +} + +void CutModelManager::ShowViewBox(int id,bool check)throw( CutModelException){ + checkInvariant(); + CutModelData* current = getCutModelData(id); + current->ShowViewBox(check); +} + +void CutModelManager::ChangeShape(int id,int selection)throw( CutModelException){ + checkInvariant(); + CutModelData* current = getCutModelData(id); + current->ChangeShape(selection); + _render->Render(); +} + +CutModelData* CutModelManager::getCutModelData(int id)throw( CutModelException){ + + CutModelData* current = NULL; + for(int i= 0; i < _vectordata.size();i++){ + std::cout<<"id in CutModelManager:: "<getId()<getId()==id){ + current = _vectordata[i]; + } + } + if(current ==NULL){ + + throw CutModelException("Data not found"); + } + return current; +} + +void CutModelManager::updateActorDirection(int id)throw( CutModelException){ + checkInvariant(); + CutModelData* current = getCutModelData(id); + current->udapteActorDirection(); + +} + +void CutModelManager::changeColor(int id,double r,double g,double b)throw( CutModelException){ + + checkInvariant(); + CutModelData* current = getCutModelData(id); + current->changeColor(r,g,b); + _render->Render(); +} +void CutModelManager::RemoveActor(int id)throw( CutModelException){ + + checkInvariant(); + + CutModelData* current = getCutModelData(id); + for(int i = 0; i < _vectordata.size()-1;i++){ + if(_vectordata[i]->getId()==id){ + for(int j = i; j < _vectordata.size()-1;j++){ + _vectordata[j]=_vectordata[j+1]; + } + i = _vectordata.size(); + } + } + _render->RemoveActor(current->getActor()); + delete current; + _vectordata.pop_back(); + _render->Render(); + +} + +void CutModelManager::ExecuteCut(int id, double* range, bool isinside)throw( CutModelException){ + checkInvariant(); + CutModelData* current = getCutModelData(id); + current->ExecuteCut(range, isinside,_copyimg); + +} + +vtkImageData* CutModelManager::GetResultImage(){ + checkInvariant(); + return _copyimg; +} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h new file mode 100644 index 0000000..8ea3fa7 --- /dev/null +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h @@ -0,0 +1,77 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: CutModelManager.h,v $ + Language: C++ + Date: $Date: 2009/08/31 08:46:12 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + + + + +#ifndef __CutModelManagerH__ +#define __CutModelManagerH__ + +#include +#include + +#include "vtkImageData.h" +#include "vtkRenderWindowInteractor.h" +#include "vtkRenderer.h" + +#include "CutModelException.h" +#include "CutModelData.h" + +class CutModelManager { + +public: + CutModelManager(); + ~CutModelManager(); + + void setImageData(vtkImageData* img); + + void setInteractor(vtkRenderWindowInteractor* interactor); + + void setRenderer(vtkRenderer* renderer); + + void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException); + + double* getImageRange()throw( CutModelException); + + void changeOpacity(int id,int opacity)throw( CutModelException); + + void ShowViewBox(int id,bool check)throw( CutModelException); + + void ChangeShape(int id,int selection)throw( CutModelException); + + void changeColor(int id,double r,double g,double b)throw( CutModelException); + + void updateActorDirection(int id)throw( CutModelException); + + void RemoveActor(int id)throw( CutModelException); + + void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException); + + vtkImageData* GetResultImage(); +private: + void checkInvariant() throw( CutModelException); + vtkImageData* _img; + vtkImageData* _copyimg; + vtkRenderer* _render; + vtkRenderWindowInteractor* _interactor; + + std::vector _vectordata; + CutModelData* getCutModelData(int id)throw( CutModelException); + +}; + +#endif diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h index e67b5be..54ec625 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/boxSurfaceObserver.h @@ -24,8 +24,8 @@ class boxSurfaceObserver : public vtkCommand virtual char const *GetClassName() const { return "boxSurfaceObserver";} static boxSurfaceObserver *New(){ - boxSurfaceObserver * result; - result = new boxSurfaceObserver(); + boxSurfaceObserver * result; + result = new boxSurfaceObserver(); return result; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h index 578fdf5..71f6d4a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h @@ -70,7 +70,7 @@ private: std::vector _greyvecttransfer; std::vector _value; vtkImageData* _img; - int _maxgreyvalue; + double _maxgreyvalue; int _currentitem; /* -- 2.45.1