]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authordonadio <donadio>
Tue, 14 Apr 2009 08:56:03 +0000 (08:56 +0000)
committerdonadio <donadio>
Tue, 14 Apr 2009 08:56:03 +0000 (08:56 +0000)
17 files changed:
appli/wxContourGUIExample/wxContourGUIExample.cxx
lib/CMakeLists.txt
lib/Interface_Icons_NDimensions/CMakeLists.txt
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx
lib/Interface_Icons_NDimensions/interfSegmentationMenu.h
lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx
lib/Interface_Icons_NDimensions/interfSegmentationPanels.h
lib/Interface_Icons_NDimensions/interfToolsMenu.cxx
lib/Interface_Icons_NDimensions/interfToolsMenu.h
lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
lib/Interface_Icons_NDimensions/interfToolsPanels.h
lib/Interface_ManagerContour_NDimensions/CMakeLists.txt
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/kernel_ManagerContour_NDimensions/CMakeLists.txt
lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx

index c59f95560ef497a02b31f0401d440fd66dc8d4d8..190111890132816ee0a09fe6d22e10f56ead67c4 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "vtkMetaImageReader.h"
 #include <map>
-#include "vtkImageData.h"mb_
+#include "vtkImageData.h"
 
 #include "wx/artprov.h"
 #include <wx/filedlg.h>
index feb4d9c27202ad743ccdf4e85da85ba2be454ca7..2faab7b425598f21d365b89f5c0ceeb07125e3f3 100644 (file)
@@ -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
index db29a566bc9d2f2042dc2a0f7f395af330aa12ab..d8b9adfdea7600c916a5d4aeb6f763a4e64675c8 100644 (file)
@@ -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} )
index 96868371791e73884b5df23d78b729c50090d3a2..82c8040c6bde40349e89182a41897941c17d7106 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef __interfMainPanel_h_INCLUDED_H__
+#define __interfMainPanel_h_INCLUDED_H__
+
 #pragma once
 
 #include <wx/wx.h>
@@ -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
index 5491252cd4f44e7c1d6f58cbe269d20e94fb78c1..8ec2fa73f27784b86d1e244ca4a9994f3de1383b 100644 (file)
@@ -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();
+
+}
+
 //------------------------------------------------------------------------------------------------------------
 
index a01a9098df1140b3147b7f1a2dfd2e7ddd54f2f5..b8a334ae45afa99e1dc0f6240d7470fe9b75faa4 100644 (file)
@@ -28,6 +28,10 @@ public:
 
        void  onSnakePressed(wxCommandEvent& event);
 
+       void onMirrorPressed(wxCommandEvent& event);
+
+       void onThreshold(wxCommandEvent& event);
+
 private:
 
        //wxContourEventHandler* contourevent;
index feea22133a9ef91dce437639b3b2a1b7b05b7321..9be4d4b98eb3c41d2eb3e1d4a32ae9f6bc0f725d 100644 (file)
@@ -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()
+
+
index bf830aeaae313220c76bebbaaef777dc23c4f278..5e5b9406cdb3fd0750f4f93a26f7d67a2df82752 100644 (file)
@@ -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
  
  
index 5467db7ededd5774088d475d2dde0f6fc1748d8f..c68af6eb2bd526641160a6f6b9519dc514474a7b 100644 (file)
@@ -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();
-
-}
-
index 6bf63a947bee4b079b6fc4b1ca8d3f3ef8caeda3..86a51ba8c082dc9c842d7aed9b627cd7c64fe17a 100644 (file)
@@ -32,8 +32,6 @@ public:
 
        void onHelpPressed(wxCommandEvent& event);
 
-       void onMirrorPressed(wxCommandEvent& event);
-
 private:
 
        //wxContourEventHandler* contourevent;
index 5aa8b3fccf31e8d2276cf2f4b193f049a95d2e60..32d1173f49c954975da07af65bf5102fc9e11603 100644 (file)
@@ -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
index 3ce9141a6dd3b291e054cbc796b9f8e708b9ff56..c26d5dd4ab9c03f30a300edc4da3461b5b179930 100644 (file)
@@ -84,20 +84,6 @@ private:
 
        
                
-};
-
-class interfMirrorPanel
-       : public wxPanel
-{
-public:
-       interfMirrorPanel(wxWindow * parent);           
-       ~interfMirrorPanel();
-
-private:
-
-       wxSlider* _thickness;
-
-       void onMirrorGo(wxCommandEvent& event);
 };
 
 #endif
index fde0c9b6d4ecb970a60e552cec37f229ef783a46..6ace19852eb662337db57df4bb2dea20515b5ffc 100644 (file)
@@ -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} )
index 4cfa08134be989b9946325c498bb01b7ab4ca905..34182bdfeca0d59f525d589d6bfb145e2f30dcd4 100644 (file)
@@ -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<vtkImageData*> images ){
                return instance;
        }
 
-       std::vector<vtkImageData*> wxContourMainFrame ::getVectImages(){
+       std::vector<vtkImageData*> 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<int> 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();
 }
index 1a2a54234102d9e0aa9b372e401b44b7026df7b4..80ca4e22caa7914be03f8bf2ceaf041824b4edbf 100644 (file)
 #include "vtkMetaImageWriter.h"
 #include "vtkImageData.h"
 #include "vtkTransform.h"
+
+#include "vtkCamera.h"
+#include "vtkImageActor.h"
+#include <vtkImageMapToColors.h>
+#include <vtkLookupTable.h>
+#include <vtkCommand.h>
+
 //#include "vtkMetaImageReader.h"
 
 //------------------------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------------------------
 // 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<vtkImageData*> 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;
 
index 04b1bc3f8fda3a9123e3a889918ad2bd69d9c3e1..8c8735b60ec023e2130550197aa648c8ccc5c5aa 100644 (file)
@@ -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
index 24307db8f8a38c16da8466286620a8f0d25c2dd2..30cff3614c071f943e2a35faf29e2dc23a61d2c1 100644 (file)
@@ -34,7 +34,8 @@ KernelManagerContour::KernelManagerContour(){
 **/
 
 }
-KernelManagerContour::KernelManagerContour(std::vector<vtkImageData*> images,std::string datadir,std::string tmpdir){
+KernelManagerContour::KernelManagerContour(std::vector<vtkImageData*> images,std::string datadir,std::string tmpdir)
+{
 
 
 /**THIS ALL SHOULD BE IN AN OTHER LIB CALLED PERSISTANCE