From a609787b177c3ba7652e6e4f91cf348f9d7b036c Mon Sep 17 00:00:00 2001 From: donadio Date: Tue, 14 Apr 2009 08:56:03 +0000 Subject: [PATCH] *** empty log message *** --- .../wxContourGUIExample.cxx | 2 +- lib/CMakeLists.txt | 58 +++++++- .../CMakeLists.txt | 20 +++ .../interfMainPanel.h | 26 +++- .../interfSegmentationMenu.cxx | 20 +++ .../interfSegmentationMenu.h | 4 + .../interfSegmentationPanels.cxx | 128 +++++++++++++++++ .../interfSegmentationPanels.h | 42 ++++++ .../interfToolsMenu.cxx | 10 -- .../interfToolsMenu.h | 2 - .../interfToolsPanels.cxx | 35 +---- .../interfToolsPanels.h | 14 -- .../CMakeLists.txt | 27 +++- .../wxContourMainFrame.cxx | 131 ++++++++++++++---- .../wxContourMainFrame.h | 24 +++- .../CMakeLists.txt | 19 +++ .../KernelManagerContour.cxx | 3 +- 17 files changed, 466 insertions(+), 99 deletions(-) diff --git a/appli/wxContourGUIExample/wxContourGUIExample.cxx b/appli/wxContourGUIExample/wxContourGUIExample.cxx index c59f955..1901118 100644 --- a/appli/wxContourGUIExample/wxContourGUIExample.cxx +++ b/appli/wxContourGUIExample/wxContourGUIExample.cxx @@ -16,7 +16,7 @@ #include "vtkMetaImageReader.h" #include -#include "vtkImageData.h"mb_ +#include "vtkImageData.h" #include "wx/artprov.h" #include diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index feb4d9c..2faab7b 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,3 +1,59 @@ + + + + # Sets the settings for macro CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE + SET(LIBRARY_NAME creaContours) + SET(LIBRARY_NAME_BASE ${LIBRARY_NAME} ) + + SET(${LIBRARY_NAME}_INSTALL_FOLDER ${LIBRARY_NAME}) + +#EED 01Avril2009 +# SET(${LIBRARY_NAME}_LIBRARIES ${LIBRARY_NAME} ) + SET(${LIBRARY_NAME}_LIBRARIES Interface_ManagerContour_NDimensions_lib Interface_Icons_NDimensions_lib kernel_ManagerContour_NDimensions_lib ) + +# FILE(RELATIVE_PATH +# ${LIBRARY_NAME}_BUILD_TREE_RELATIVE_INCLUDE_PATHS +# ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} +# ) + +SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_INCLUDE_PATHS + lib/Interface_ManagerContour_NDimensions + lib/Interface_Icons_NDimensions + lib/kernel_ManagerContour_NDimensions +) + + + IF ( ${PROJECT_BINARY_DIR} STREQUAL ${EXECUTABLE_OUTPUT_PATH} ) + SET(CILFC_EXECUTABLE_OUTPUT_REL_PATH ".") + ELSE ( ${PROJECT_BINARY_DIR} STREQUAL ${EXECUTABLE_OUTPUT_PATH} ) + FILE(RELATIVE_PATH + CILFC_EXECUTABLE_OUTPUT_REL_PATH + ${PROJECT_BINARY_DIR} ${EXECUTABLE_OUTPUT_PATH}) + ENDIF ( ${PROJECT_BINARY_DIR} STREQUAL ${EXECUTABLE_OUTPUT_PATH} ) + + IF(UNIX) + SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_LIBRARY_PATHS + ${CILFC_EXECUTABLE_OUTPUT_REL_PATH}) + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_LIBRARY_PATHS lib) + ELSE(UNIX) + SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_LIBRARY_PATHS + ${CILFC_EXECUTABLE_OUTPUT_REL_PATH}) + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_LIBRARY_PATHS bin) + ENDIF(UNIX) + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/${LIBRARY_NAME}) + +# SET(${LIBRARY_NAME}_HAS_ADDITIONAL_CONFIG_FILE TRUE) +#SET(${LIBRARY_NAME}_ADDITIONAL_CONFIG_FILE +# ${PROJECT_SOURCE_DIR}/src/AdditionalcreaImageIOConfig.cmake.in) +#SET(${LIBRARY_NAME}_ADDITIONAL_USE_FILE +# ${PROJECT_SOURCE_DIR}/src/AdditionalUsecreaImageIO.cmake.in) + + # Invoke the advanced macro + CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE(${LIBRARY_NAME}) + + SUBDIRS(Interface_ManagerContour_NDimensions) SUBDIRS(Interface_Icons_NDimensions) -SUBDIRS(kernel_ManagerContour_NDimensions) \ No newline at end of file +SUBDIRS(kernel_ManagerContour_NDimensions) + + \ No newline at end of file diff --git a/lib/Interface_Icons_NDimensions/CMakeLists.txt b/lib/Interface_Icons_NDimensions/CMakeLists.txt index db29a56..d8b9adf 100644 --- a/lib/Interface_Icons_NDimensions/CMakeLists.txt +++ b/lib/Interface_Icons_NDimensions/CMakeLists.txt @@ -58,5 +58,25 @@ IF ( BUILD_${LIBRARY_NAME} ) # LINK TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) + + #--------------------------------------------------------------------------- + + # INSTALLS LIBRARY + INSTALL( + FILES ${${LIBRARY_NAME}_HEADERS} + DESTINATION ${${LIBRARY_NAME_BASE}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS} + ) + IF(WIN32) + INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION bin) + ELSE(WIN32) + INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION lib) + ENDIF(WIN32) + + + #--------------------------------------------------------------------------- ENDIF ( BUILD_${LIBRARY_NAME} ) diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index 9686837..82c8040 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -1,3 +1,6 @@ +#ifndef __interfMainPanel_h_INCLUDED_H__ +#define __interfMainPanel_h_INCLUDED_H__ + #pragma once #include @@ -42,7 +45,10 @@ public: ** Gets the instance of the class **/ static interfMainPanel* getInstance(); - + /** + ** Ressts the instance of the class + **/ + static void resetInstance(); /** ** Adds a new checkbox to the scrolledwindow using the checkboxsizer @@ -108,6 +114,8 @@ public: vtkImageData* getImageData(); + void getImageRange(double[2]); + void onSegmentationOneSlice(int isovalue,int sampling,int method); void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation); @@ -120,6 +128,12 @@ public: void onMirror(); + void onMirrorChangeWidth(int width); + + void onThreshold(int minVal, int maxVal); + + void onThresholdPressed(); + void setLabelSegmentationPanelVTK(wxString tmpString); void onSegmentationPressed(); @@ -218,13 +232,17 @@ private: wxPanel* configPanel; wxPanel* spreadPanel; interfSpreadPanel* panelSpread; - wxPanel* mirrorPanel; - interfMirrorPanel* panelMirror; wxWindow* infoWin; wxPanel* informationPanel; + + wxPanel* mirrorPanel; + interfMirrorPanel* panelMirror; + wxPanel* thresholdPanel; + interfThresholdPanel* panelThreshold; bool axisshown; bool refLineShown; + bool thresholdShown; //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in //list of contours @@ -254,3 +272,5 @@ private: }; + +#endif \ No newline at end of file diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx index 5491252..8ec2fa7 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx @@ -33,6 +33,14 @@ void interfSegmentationMenu::initButtons(wxEvtHandler* evtHandler) { nom.push_back("Find shapes using border snake interaction"); funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSnakePressed); + path.push_back(datadir + "/Mirror.png"); + nom.push_back("Create an Axis and select a contour to mirror it accordingly"); + funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onMirrorPressed); + + path.push_back(datadir + "/Threshold.png"); + nom.push_back("Superpose a 'Red Image' to the selected Image Threshold"); + funct.push_back((wxObjectEventFunction)&interfSegmentationMenu::onThreshold); + this->addButtons(path, nom); this->setVectorFunction(funct); @@ -73,5 +81,17 @@ void interfSegmentationMenu::onSnakePressed(wxCommandEvent& event){ } +void interfSegmentationMenu::onMirrorPressed(wxCommandEvent& event){ + + interfMainPanel::getInstance()->onMirrorPressed(); + +} + +void interfSegmentationMenu::onThreshold(wxCommandEvent& event){ + + interfMainPanel::getInstance()->onThresholdPressed(); + +} + //------------------------------------------------------------------------------------------------------------ diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationMenu.h b/lib/Interface_Icons_NDimensions/interfSegmentationMenu.h index a01a909..b8a334a 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationMenu.h +++ b/lib/Interface_Icons_NDimensions/interfSegmentationMenu.h @@ -28,6 +28,10 @@ public: void onSnakePressed(wxCommandEvent& event); + void onMirrorPressed(wxCommandEvent& event); + + void onThreshold(wxCommandEvent& event); + private: //wxContourEventHandler* contourevent; diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index feea221..9be4d4b 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -190,5 +190,133 @@ void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method);*/ } + //------------------------------------------------------------------------------------------------------------ + +/** +** Begin of the mirror panel +**/ + +interfMirrorPanel::interfMirrorPanel(wxWindow* parent) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) +{ + wxButton *mirrorGoBtn = new wxButton(this,-1,_T("Go"), wxDefaultPosition, wxSize(200,35) ); + _thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + + Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); + + wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + sizer -> Add( new wxStaticText(this,-1,_T("Thickness")) , 1, wxGROW ); + sizer -> Add( _thickness, 1, wxGROW ); + sizer -> Add( mirrorGoBtn, 1, wxGROW ); + + this->SetSizer( sizer ); + this->SetAutoLayout( true ); + this->Layout(); +} + +interfMirrorPanel::~interfMirrorPanel(){ +} + +void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) +{ + interfMainPanel::getInstance()->onMirror(); +} + +void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) +{ + int width = _thickness->GetValue(); + interfMainPanel::getInstance()->onMirrorChangeWidth(width); +} + + + +/** +** Begin of the threshold panel +**/ +interfThresholdPanel::interfThresholdPanel(wxWindow* parent) +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) +{ + wxButton *thresholdGoBtn = new wxButton(this,-1,_T("Threshold Go"), wxDefaultPosition, wxSize(200,30) ); + + _thresholdGo = false; + + double range[2]; + interfMainPanel::getInstance()->getImageRange(range); + + _mBarThreshold = new mBarRange(this,70,65); + _mBarThreshold->SetMin(0); + _mBarThreshold->SetStart(0); + _mBarThreshold-> SetOrientation( true ); + _mBarThreshold-> setActiveStateTo(true); + _mBarThreshold-> setVisibleLabels( true ); + _mBarThreshold-> setDeviceEndMargin(10); + _mBarThreshold-> setRepresentedValues( range[0] , range[1] ); + _mBarThreshold-> setDeviceBlitStart(10,10); + _mBarThreshold-> setIfWithActualDrawed( false ); + _mBarThreshold-> SetStart( range[0] ); + _mBarThreshold-> SetEnd( range[1] ); + + Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfThresholdPanel::onThresholdGo ); + + wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + sizer -> Add( _mBarThreshold, 1, wxGROW ); + sizer -> Add( thresholdGoBtn, 1, wxGROW ); + sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); + sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); + //sizer -> Add( new wxStaticText(this,-1,_T("Select the image's range to superpose a Fake Color")) , 1, wxGROW ); + + + this->SetSizer( sizer ); + this->SetAutoLayout( true ); + this->Layout(); +} + +interfThresholdPanel::~interfThresholdPanel(){ +} + + + +void interfThresholdPanel::onThresholdChange(wxCommandEvent& event) +{ + if (_thresholdGo) + { + int minVal = _mBarThreshold->GetStart(); + int maxVal = _mBarThreshold->GetEnd(); + + interfMainPanel::getInstance()->onThreshold(minVal, maxVal); + + std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; + } +} + +void interfThresholdPanel::onThresholdGo(wxCommandEvent& event) +{ + if (!_thresholdGo) + { + int minVal = _mBarThreshold->GetStart(); + int maxVal = _mBarThreshold->GetEnd(); + + interfMainPanel::getInstance()->onThreshold(minVal, maxVal); + _thresholdGo=true; + } +} + +void interfThresholdPanel::onThresholdStop() +{ + _thresholdGo=false; +} + + +BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) + EVT_SCROLL(interfMirrorPanel :: onChangeWidth) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(interfThresholdPanel, wxPanel) + EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_START, interfThresholdPanel :: onThresholdChange) + EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_END, interfThresholdPanel :: onThresholdChange) + EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_MOVED, interfThresholdPanel :: onThresholdChange) +END_EVENT_TABLE() + + diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h index bf830ae..5e5b940 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h @@ -77,6 +77,48 @@ private: wxTextCtrl * _infStrength; }; + +class interfMirrorPanel + : public wxPanel +{ +public: + interfMirrorPanel(wxWindow * parent); + ~interfMirrorPanel(); + +private: + + wxSlider* _thickness; + + void onMirrorGo(wxCommandEvent& event); + + void onChangeWidth(wxScrollEvent& event); + + DECLARE_EVENT_TABLE() +}; + + +class interfThresholdPanel + : public wxPanel +{ +public: + interfThresholdPanel(wxWindow * parent); + ~interfThresholdPanel(); + + void onThresholdStop(); + +private: + + mBarRange* _mBarThreshold; + bool _thresholdGo; + + void onThresholdChange(wxCommandEvent& event); + + void onThresholdGo(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() +}; + + #endif diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx index 5467db7..c68af6e 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsMenu.cxx @@ -43,10 +43,6 @@ void interfToolsMenu::initButtons(wxEvtHandler* evtHandler) { nom.push_back("Show help page with information about the tools"); funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onHelpPressed); - path.push_back(datadir + "/Mirror.png"); - nom.push_back("Create an Axis and select a contour to mirror it accordingly"); - funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onMirrorPressed); - this->addButtons(path, nom); this->setVectorFunction(funct); @@ -98,9 +94,3 @@ void interfToolsMenu::onHelpPressed(wxCommandEvent& event){ } -void interfToolsMenu::onMirrorPressed(wxCommandEvent& event){ - - interfMainPanel::getInstance()->onMirrorPressed(); - -} - diff --git a/lib/Interface_Icons_NDimensions/interfToolsMenu.h b/lib/Interface_Icons_NDimensions/interfToolsMenu.h index 6bf63a9..86a51ba 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsMenu.h +++ b/lib/Interface_Icons_NDimensions/interfToolsMenu.h @@ -32,8 +32,6 @@ public: void onHelpPressed(wxCommandEvent& event); - void onMirrorPressed(wxCommandEvent& event); - private: //wxContourEventHandler* contourevent; diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index 5aa8b3f..32d1173 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -392,37 +392,4 @@ void interfInformationPanel::setColLabel(int tmpIntB,wxString tmpTitleString){ wxString interfInformationPanel::getCellValue(int j,int i){ return _grid->GetCellValue( j , i ); -} - - - -/** -** Begin of the mirror panel -**/ - -interfMirrorPanel::interfMirrorPanel(wxWindow* parent) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) -{ - wxButton *mirrorGoBtn = new wxButton(this,-1,_T("Go"), wxDefaultPosition, wxSize(200,35) ); - _thickness = new wxSlider(this, -1, 0 , 0, 10, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - - Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); - sizer -> Add( new wxStaticText(this,-1,_T("Thickness")) , 1, wxGROW ); - sizer -> Add( _thickness, 1, wxGROW ); - sizer -> Add( mirrorGoBtn, 1, wxGROW ); - - this->SetSizer( sizer ); - this->SetAutoLayout( true ); - this->Layout(); -} - -interfMirrorPanel::~interfMirrorPanel(){ -} - -void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) -{ - //wxString thick=_thickness->GetValue(); - interfMainPanel::getInstance()->onMirror(); -} +} \ No newline at end of file diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index 3ce9141..c26d5dd 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -84,20 +84,6 @@ private: -}; - -class interfMirrorPanel - : public wxPanel -{ -public: - interfMirrorPanel(wxWindow * parent); - ~interfMirrorPanel(); - -private: - - wxSlider* _thickness; - - void onMirrorGo(wxCommandEvent& event); }; #endif diff --git a/lib/Interface_ManagerContour_NDimensions/CMakeLists.txt b/lib/Interface_ManagerContour_NDimensions/CMakeLists.txt index fde0c9b..6ace198 100644 --- a/lib/Interface_ManagerContour_NDimensions/CMakeLists.txt +++ b/lib/Interface_ManagerContour_NDimensions/CMakeLists.txt @@ -39,8 +39,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH) SET ( ${LIBRARY_NAME}_LINK_LIBRARIES kernel_ManagerContour_NDimensions_lib - Interface_Icons_NDimensions_lib - ${crea_LIBRARIES} + Interface_Icons_NDimensions_lib + ${crea_LIBRARIES} ${WXWIDGETS_LIBRARIES} ${VTK_LIBRARIES} # ${ITK_LIBRARIES} @@ -59,6 +59,27 @@ IF ( BUILD_${LIBRARY_NAME} ) # LINK TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) -#MESSAGE(FATAL_ERROR "${LIBRARY_NAME}_LINK_LIBRARIES = ${${LIBRARY_NAME}_LINK_LIBRARIES}") + #--------------------------------------------------------------------------- + + + # INSTALLS LIBRARY + INSTALL( + FILES ${${LIBRARY_NAME}_HEADERS} + DESTINATION ${${LIBRARY_NAME_BASE}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS} + ) + IF(WIN32) + INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION bin) + ELSE(WIN32) + INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION lib) + ENDIF(WIN32) + + + + #--------------------------------------------------------------------------- + ENDIF ( BUILD_${LIBRARY_NAME} ) diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 4cfa081..34182bd 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -87,17 +87,16 @@ char wxContourMainFrame::COPY = 'C'; _datadir = datadir; - inredo = 0; - inundo = 0; + inredo = 0; + inundo = 0; - interfMainPanel* pannew = interfMainPanel::getInstance(parent,datadir+"/data/Icons");//, eventHandler); - _performingOperation = new PerformingOperation(); + _pannew = interfMainPanel::getInstance(this,datadir+"/data/Icons");//, eventHandler); + _performingOperation = new PerformingOperation(); - - - if(images.size() > 0){ - this->setVectImages(images); - } + if(images.size() > 0) + { + this->setVectImages(images); + } } @@ -146,25 +145,41 @@ void wxContourMainFrame::setVectImages( std::vector images ){ return instance; } - std::vector wxContourMainFrame ::getVectImages(){ + std::vector wxContourMainFrame ::getVectImages() + { return kernelManager->getVectImages(); } - wxContourMainFrame* wxContourMainFrame :: getInstance(){ - return instance; - + + wxContourMainFrame* wxContourMainFrame :: getInstance() + { + return instance; + } + + void wxContourMainFrame :: resetInstance() + { + delete instance; + instance = NULL; } wxContourMainFrame :: ~wxContourMainFrame() { - m_mgr.UnInit(); - //El problema al cerrar la aplicacion puede estar asociado - //a que wxAUINotebook esta en la aplicacion - //principal (wxContourGUIExample)tambien -//EED???? delete _theViewPanel; -//EED???? delete _instantPanel; -//EED???? delete _buttonsBar; -//EED???? delete _actualInstant; -//EED???? delete _sceneManager; + + _pannew->Close(); + interfMainPanel::resetInstance(); + //_pannew->Destroy(); + //delete _pannew; + + m_mgr.UnInit(); + //delete m_mgr; + + //El problema al cerrar la aplicacion puede estar asociado + //a que wxAUINotebook esta en la aplicacion + //principal (wxContourGUIExample)tambien + //EED???? delete _theViewPanel; + //EED???? delete _instantPanel; + //EED???? delete _buttonsBar; + //EED???? delete _actualInstant; + //EED???? delete _sceneManager; } @@ -563,7 +578,8 @@ bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ){ return _instantPanel->getIfConceptCheckedAt( name, pos ); } -void wxContourMainFrame::changeInstant(){ +void wxContourMainFrame::changeInstant() +{ std::vector instantVect; _instantPanel->getInstant( instantVect ); // Instant * theInstant = new Instant ( &instantVect ); @@ -611,6 +627,7 @@ void wxContourMainFrame::updateInstantImageData(){ _theViewPanel->setImageSlice(z); } } + void wxContourMainFrame::updateInstantAxes(){ } @@ -1524,7 +1541,6 @@ myfile.close(); } // if addedModel } // if sizeCtrPt } - int wxContourMainFrame::GetImageDataSizeZ(){ return _theViewPanel->GetImageDataSizeZ(); } @@ -1637,6 +1653,15 @@ void wxContourMainFrame::refLineShow() } } +void wxContourMainFrame::refLineChangeWidth(int width) +{ + _refLineView->SetWidthLine(width); + _refLineView->RefreshContour(); + + RefreshInterface(); +} + + void wxContourMainFrame::onMirror() { //AD:02-09 @@ -1671,7 +1696,63 @@ void wxContourMainFrame::onMirror() //_refName = ""; } -void wxContourMainFrame::showAxis(bool show){ +void wxContourMainFrame::onThreshold(int minVal, int maxVal) +{ + + vtkImageData * img = _theViewPanel->getImageData(); + + double range[2]; + img->GetScalarRange(range); + + //vtkImageData * fakeImage = new vtkImageData(); + + //Lookup Table + vtkLookupTable *lookup = vtkLookupTable::New(); + lookup->SetNumberOfTableValues(range[1]); + lookup->SetTableRange(range); + lookup->SetAlphaRange(0, 1); + lookup->SetValueRange(0, 1); + lookup->SetSaturationRange(0, 0); + lookup->SetRampToLinear( ); + + + //Assign a fake color for the upper image, and set the white as transparent + for(int i = range[0]; i < range[1]; i++) + { + if( i >= minVal && i <= maxVal ) + { + lookup->SetTableValue(i, 1.0, 0.0, 0.0, 1); + } + else if( i >= range[0] && i < minVal ) + { + lookup->SetTableValue(i, 0.0, 0.0, 0.0, 0); //transparent + } + else if( i > maxVal && i < range[1] ) + { + lookup->SetTableValue(i, 0.0, 0.0, 0.0, 0); //transparent + } + } + + lookup->Build( ); + + vtkImageMapToColors *mapperImage = vtkImageMapToColors::New( ); + mapperImage->SetInput( img ); + mapperImage->SetLookupTable( lookup ); + + vtkImageActor * upperImageActor = vtkImageActor::New( ); + upperImageActor->SetInput( mapperImage->GetOutput() ); + upperImageActor->SetOpacity( 1 ); + + //viewer->SetInput( myImage ); viewer->GetRenderer()->AddActor( myActor );ACTOR!!! + + //baseImageActor = vtkImageActor::New( ); + //baseImageActor->SetInput( mBox->bbGetInputImage1() ); + + RefreshInterface(); +} + +void wxContourMainFrame::showAxis(bool show) +{ _theViewPanel->SetVisibleAxis(show); _theViewPanel->Refresh(); } diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 1a2a542..80ca4e2 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -93,6 +93,13 @@ #include "vtkMetaImageWriter.h" #include "vtkImageData.h" #include "vtkTransform.h" + +#include "vtkCamera.h" +#include "vtkImageActor.h" +#include +#include +#include + //#include "vtkMetaImageReader.h" //------------------------------------------------------------------------------------------------------------ @@ -108,7 +115,7 @@ //------------------------------------------------------------------------------------------------------------ // Class definition //------------------------------------------------------------------------------------------------------------ - +class interfMainPanel; class wxContourMainFrame : public wxPanel { public: @@ -145,6 +152,8 @@ class wxContourMainFrame : public wxPanel { void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel ); + + // void setButtonsBar( wxContour_ButtonsBar * theButtonsBar ); // void setGrid( wxContour_Grid * theGridPanel ); // void setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel ); @@ -170,6 +179,7 @@ class wxContourMainFrame : public wxPanel { //------------------------------------------------------------------------------------------------------------ static wxContourMainFrame* getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector images, long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, std::string datadir="C:/Creatis/creaContoursBin/RelWithDebInfo/"); static wxContourMainFrame* getInstance(); + static void resetInstance(); //------------------------------------------------------------------------------------------------------------ // Other functional methods //------------------------------------------------------------------------------------------------------------ @@ -241,10 +251,13 @@ class wxContourMainFrame : public wxPanel { void referenceLine(); void refLineHide(); void refLineShow(); + void refLineChangeWidth(int width); //AD void onMirror(); + void onThreshold(int minVal, int maxVal); + void showAxis(bool show); void onRigidPressed(); @@ -292,10 +305,15 @@ private: //------------------------------------------------------------------------------------------------------------ // Attributtes //------------------------------------------------------------------------------------------------------------ + static wxContourMainFrame* instance; KernelManagerContour* kernelManager; + interfMainPanel* _pannew; + + PerformingOperation* _performingOperation; + std::string _datadir; wxContourViewPanel* _theViewPanel; @@ -366,10 +384,6 @@ private: int inundo; std::string stundoredo; - - - //wxContourViewPanel* _viewPan; - PerformingOperation* _performingOperation; static char COPY; diff --git a/lib/kernel_ManagerContour_NDimensions/CMakeLists.txt b/lib/kernel_ManagerContour_NDimensions/CMakeLists.txt index 04b1bc3..8c8735b 100644 --- a/lib/kernel_ManagerContour_NDimensions/CMakeLists.txt +++ b/lib/kernel_ManagerContour_NDimensions/CMakeLists.txt @@ -62,6 +62,25 @@ IF ( BUILD_${LIBRARY_NAME} ) # LINK TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) + #--------------------------------------------------------------------------- + + + # INSTALLS LIBRARY + INSTALL( + FILES ${${LIBRARY_NAME}_HEADERS} + DESTINATION ${${LIBRARY_NAME_BASE}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS} + ) + IF(WIN32) + INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION bin) + ELSE(WIN32) + INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION lib) + ENDIF(WIN32) + + #--------------------------------------------------------------------------- ENDIF ( BUILD_${LIBRARY_NAME} ) \ No newline at end of file diff --git a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx index 24307db..30cff36 100644 --- a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx +++ b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx @@ -34,7 +34,8 @@ KernelManagerContour::KernelManagerContour(){ **/ } -KernelManagerContour::KernelManagerContour(std::vector images,std::string datadir,std::string tmpdir){ +KernelManagerContour::KernelManagerContour(std::vector images,std::string datadir,std::string tmpdir) +{ /**THIS ALL SHOULD BE IN AN OTHER LIB CALLED PERSISTANCE -- 2.45.1