]> Creatis software - creaMaracasVisu.git/commitdiff
module IRM view
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Wed, 1 Apr 2009 16:16:54 +0000 (16:16 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Wed, 1 Apr 2009 16:16:54 +0000 (16:16 +0000)
bbtk/src/bbcreaMaracasVisuIRMViewer.cxx [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuIRMViewer.h [new file with mode: 0644]
lib/maracasVisuLib/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx

diff --git a/bbtk/src/bbcreaMaracasVisuIRMViewer.cxx b/bbtk/src/bbcreaMaracasVisuIRMViewer.cxx
new file mode 100644 (file)
index 0000000..f46b52d
--- /dev/null
@@ -0,0 +1,70 @@
+#include "bbcreaMaracasVisuIRMViewer.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+
+#include "wxMaracasIRMView.h"
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,IRMViewer)
+BBTK_BLACK_BOX_IMPLEMENTATION(IRMViewer,bbtk::WxBlackBox);
+void IRMViewer::Process()
+{
+
+       wxMaracasIRMView* irmview = wxMaracasIRMView::getInstance();
+       std::vector<vtkProp3D*> tempvect;
+       int i;
+
+       if(irmview != NULL){
+               vtkRenderer* renderer = bbGetInputRenderer();
+               irmview->setRenderer(renderer);
+               vtkProp3D* prop3D;
+               tempvect.push_back(bbGetInputIn0());
+               tempvect.push_back(bbGetInputIn1());
+               tempvect.push_back(bbGetInputIn2());
+               tempvect.push_back(bbGetInputIn3());
+               tempvect.push_back(bbGetInputIn4());
+
+               for(i = 0; i < tempvect.size();i++){
+                       prop3D = tempvect[i];
+                       if(prop3D != NULL&&renderer != NULL){
+                               irmview->addProp3D(prop3D);
+                       }
+               }
+       }  
+}
+void IRMViewer::CreateWidget(wxWindow* parent)
+{
+       wxMaracasIRMView* irmview = wxMaracasIRMView::getInstance(parent);
+
+       bbSetOutputWidget(irmview);
+  
+}
+void IRMViewer::bbUserConstructor()
+{
+  
+    bbSetInputIn0(NULL);
+       bbSetInputIn1(NULL);
+       bbSetInputIn2(NULL);
+       bbSetInputIn3(NULL);
+       bbSetInputIn4(NULL);
+       bbSetOutputWidget(NULL);
+  
+}
+void IRMViewer::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
+{
+  
+}
+void IRMViewer::bbUserDestructor()
+{
+  
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
diff --git a/bbtk/src/bbcreaMaracasVisuIRMViewer.h b/bbtk/src/bbcreaMaracasVisuIRMViewer.h
new file mode 100644 (file)
index 0000000..12f7563
--- /dev/null
@@ -0,0 +1,62 @@
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuIRMViewer_h_INCLUDED__
+#define __bbcreaMaracasVisuIRMViewer_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "vtkImageData.h"
+#include "vtkProp3D.h"
+
+//#include "marInterface.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT IRMViewer
+ : 
+   public bbtk::WxBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(IRMViewer,bbtk::WxBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer);
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+  //BBTK_DECLARE_INPUT(In,vtkImageData*);
+  BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+  BBTK_DECLARE_INPUT(In0,vtkProp3D*);  
+  BBTK_DECLARE_INPUT(In1,vtkProp3D*);
+  BBTK_DECLARE_INPUT(In2,vtkProp3D*);
+  BBTK_DECLARE_INPUT(In3,vtkProp3D*);
+  BBTK_DECLARE_INPUT(In4,vtkProp3D*);
+  BBTK_PROCESS(Process);
+  void Process();
+  BBTK_CREATE_WIDGET(CreateWidget);
+  void CreateWidget(wxWindow*);
+
+private:
+       //marInterface* mar;
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(IRMViewer,bbtk::WxBlackBox);
+BBTK_NAME("IRMViewer");
+BBTK_AUTHOR("car-prie@uniandes.edu.co");
+BBTK_DESCRIPTION("BB of the module IRMViewer");
+BBTK_CATEGORY("__CategoryBlackBox__");
+//BBTK_INPUT(IRMViewer,In,"Renderer to show the different prop3D",vtkImageData*,"");
+BBTK_INPUT(IRMViewer,Renderer,"Renderer to show the different prop3D",vtkRenderer*,"");
+BBTK_INPUT(IRMViewer,In0,"prop3D to the IRMViewer",vtkProp3D*,"");
+BBTK_INPUT(IRMViewer,In1,"prop3D to the IRMViewer",vtkProp3D*,"");
+BBTK_INPUT(IRMViewer,In2,"prop3D to the IRMViewer",vtkProp3D*,"");
+BBTK_INPUT(IRMViewer,In3,"prop3D to the IRMViewer",vtkProp3D*,"");
+BBTK_INPUT(IRMViewer,In4,"prop3D to the IRMViewer",vtkProp3D*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(IRMViewer);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuIRMViewer_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
index d1d8438b540b8d94cb24eb2ff829e2e95d0ecb60..47ab8c197c3cf909a4562a1d321c7db958e25f20 100644 (file)
@@ -66,6 +66,10 @@ IF ( BUILD_${LIBRARY_NAME} )
     src/interface/wxWindows/widgets/wxVtkBaseView.h
     src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h 
     src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
+       
+       src/interface/wxWindows/widgets/wxMaracasIRMView.h
+       src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
+       
     src/interface/wxWindows/wxMaracas_ManualTree_MPR.h
     src/interface/wxWindows/widgets/wxManualTree_MPRWidget.h
     src/interface/wxWindows/widgets/ContourView.h
@@ -125,6 +129,8 @@ IF ( BUILD_${LIBRARY_NAME} )
 #    src/interface/wxWindows/wxMaracasImageBrowser02.cxx
 #    src/interface/wxWindows/widgets/wxReadingPriorityPanel.cpp
        
+       src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
+       src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
        
     src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
     src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.cxx
index d5056c983db707bdbbb16da3f5a905ab8ebd1eca..9a5382cd4ac7689baf18a244ba230d6a4511af47 100644 (file)
@@ -54,6 +54,8 @@ SET(MARACAS_LIB_SRCS
   wxMaracasHelpDialog.h
   wxMaracasQuantification.cxx
   wxMaracasQuantification.h
+  wxMaracasIRMView.cxx
+  wxMaracasIRMView.h
   
        
   widgets/wxVTKRenderWindowInteractor.cxx
index eb975901ae488789cf2e5efa1e9053a5d55a36e1..663d888bf43301b899d13e9eb913721a49dc8467 100644 (file)
@@ -2888,11 +2888,13 @@ void manualViewBaseContour::ConstructVTKObjects()
                _pts->SetPoint(i,       0       , 0     , 0 );
        }
        // This is for the boundaring inicialisation
+
 //EED 29Mars2009       
        _pts->SetPoint(0,       0       , 0     , -1000 );
        _pts->SetPoint(1,       0       , 0     ,  1000 );
-//     _pts->SetPoint(0, -1000 , -1000 , -1000 );
-//     _pts->SetPoint(1, 1000  , 1000  , 1000  );
+//     _pts->SetPoint(0,       -1000   , -1000 , -1000 );
+//     _pts->SetPoint(1,       1000    , 1000  , 1000  );
+
 
        vtkCellArray *lines = vtkCellArray::New();
        lines->InsertNextCell( nps /* +1 */ );
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
new file mode 100644 (file)
index 0000000..01f52a7
--- /dev/null
@@ -0,0 +1,185 @@
+/*=========================================================================
+
+  Program:   wxMaracas
+  Module:    $RCSfile: wxMaracasIRMView.cxx,v $
+  Language:  C++
+  Date:      $Date: 2009/04/01 16:16:59 $
+  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 "wxMaracasIRMView.h"
+
+wxMaracasIRMView* wxMaracasIRMView::instance=NULL;
+
+wxMaracasIRMView::wxMaracasIRMView( wxWindow* parent) 
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
+
+       //createControls();
+       irmmanager = new wxMaracasIRMViewManager();             
+
+       wxauimanager = new wxAuiManager(this);          
+
+       std::string iconsdir = "/";//defaultdir;
+       iconsdir+= "/Icons";
+       wxToolBar* toolbar = new ToolBar(this,iconsdir);
+       wxAuiPaneInfo paneinfo; 
+       wxauimanager->AddPane(toolbar,paneinfo.ToolbarPane().Top());                    
+
+       wxauimanager->Update();
+       createFileChooser();
+
+}
+wxMaracasIRMView::~wxMaracasIRMView( ){
+
+
+}
+
+void wxMaracasIRMView::loadProp3D(){   
+       
+       wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")),
+               wxString(_T("")),wxString(_T("*.stl")));
+       if(fildial->ShowModal()==wxID_OK){
+               
+               wxString filename(fildial->GetDirectory() + "/"+fildial->GetFilename() );
+               vtkProp3D* prop3D = irmmanager->getProp3D(filename.c_str());
+               if(prop3D != NULL){
+                       this->addProp3D(prop3D);
+               }
+               
+       }
+       delete fildial;
+       
+}
+
+void wxMaracasIRMView::createFileChooser(){
+    
+}
+
+wxMaracasIRMView* wxMaracasIRMView::getInstance(wxWindow* parent){
+       if(instance==NULL){
+               instance = new wxMaracasIRMView(parent);
+       }
+       return instance;
+}
+
+wxMaracasIRMView* wxMaracasIRMView::getInstance(){
+       return instance;
+}
+
+void wxMaracasIRMView::setRenderer(vtkRenderer*  renderer){
+       irmmanager->setRenderer(renderer);
+}
+
+void wxMaracasIRMView::changeOpacity(int _propid, int value){
+       irmmanager->changeOpacity(_propid,value);
+}
+
+void wxMaracasIRMView::changeIsoValue(int _propid, int value){
+
+}
+
+void wxMaracasIRMView::addProp3D(vtkProp3D* prop3D){
+       int id = irmmanager->addProp3D(prop3D);
+       if(id!=-1){
+               wxMaracasIRMViewProp3D* controlpan = new wxMaracasIRMViewProp3D(this, id);
+               wxAuiPaneInfo paneinfo; 
+               wxauimanager->AddPane(controlpan);              
+               
+       }
+       
+}
+
+/**
+**     Implementation of viewProp3D
+**/
+
+wxMaracasIRMViewProp3D::wxMaracasIRMViewProp3D(wxWindow* parent,int propid)
+:wxMaracasIRMViewPanel(parent){
+       createControls();
+       this->_propid = propid;
+}
+
+wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){
+}
+
+void wxMaracasIRMViewProp3D::createControls(){
+
+       wxString choices[2];
+       choices[0] = "On";
+       choices[1] = "Off";
+       radiob = new  wxRadioBox(this,-1,wxString(_T("Actor")),wxDefaultPosition,wxDefaultSize,2,choices,1,wxRA_SPECIFY_COLS);
+       this->addControl(radiob);
+       Connect(radiob->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onRadioBoxChange);    
+               
+
+
+       opacity = new wxSlider(this, -1,0,0,100);
+       this->addControl(opacity);
+       Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onOpacityRelease);      
+
+       isovalue = new wxSlider(this, -1,0,0,100);
+       this->addControl(isovalue);
+       Connect(isovalue->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onIsoValueRelease);    
+}
+void wxMaracasIRMViewProp3D::onRadioBoxChange(wxCommandEvent& event){
+
+}
+void wxMaracasIRMViewProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){  
+
+}
+
+void wxMaracasIRMViewProp3D::onOpacityRelease(wxScrollEvent& event ){
+
+       wxMaracasIRMView::getInstance()->changeOpacity(_propid,opacity->GetValue());
+
+}
+
+void wxMaracasIRMViewProp3D::onIsoValueRelease(wxScrollEvent& event ){
+
+       wxMaracasIRMView::getInstance()->changeIsoValue(_propid,isovalue->GetValue());
+
+}
+
+
+/**
+**
+**/
+
+ToolBar::ToolBar(wxWindow * parent,std::string iconsdir)
+: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize)
+{    
+
+
+       std::string iconfil = iconsdir;
+
+       iconfil+= "/Open.png";
+       wxBitmap* bitmap2 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+       this->AddTool(2, wxString(_T("test")),*bitmap2);                
+       
+       this->Realize();
+       
+       
+}
+
+ToolBar::~ToolBar(void){
+}
+
+
+void ToolBar::onLoadConfig(wxCommandEvent& event){
+       wxMaracasIRMView::getInstance()->loadProp3D();
+}
+
+BEGIN_EVENT_TABLE(ToolBar, wxToolBar)  
+       EVT_MENU(2, ToolBar::onLoadConfig)    
+END_EVENT_TABLE()
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h
new file mode 100644 (file)
index 0000000..d8de471
--- /dev/null
@@ -0,0 +1,204 @@
+/*=========================================================================
+
+  Program:   wxMaracas
+  Module:    $RCSfile: wxMaracasIRMView.h,v $
+  Language:  C++
+  Date:      $Date: 2009/04/01 16:16:59 $
+  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 __wxMaracasIRMViewH__
+#define __wxMaracasIRMViewH__
+
+
+#include <wx/wx.h>
+#include "wx/aui/aui.h"
+
+#include <iostream>
+
+#include "marTypes.h"
+
+#include "vtkProp3D.h"
+
+#include "wxMaracasIRMViewManager.h"
+
+class  creaMaracasVisu_EXPORT  wxMaracasIRMView : public wxPanel
+{      
+
+public:
+    wxMaracasIRMView( wxWindow* parent);
+    ~wxMaracasIRMView( );
+       
+       static wxMaracasIRMView* getInstance(wxWindow* parent);
+
+       static wxMaracasIRMView* getInstance();
+
+       void setRenderer(vtkRenderer*  renderer);
+
+       void changeOpacity(int _propid, int value);
+
+       void changeIsoValue(int _propid, int value);
+
+
+
+       void addProp3D(vtkProp3D* prop3D);
+
+
+       void loadProp3D();
+
+private:
+       static wxMaracasIRMView* instance;
+
+       wxMaracasIRMViewManager* irmmanager;
+
+       wxAuiManager* wxauimanager;
+
+       void createFileChooser();
+};
+
+#endif // __wxMaracasIRMViewH__
+
+// EOF - wxMaracasIRMView.h
+
+#ifndef __wxMaracasIRMViewPanelH__
+#define __wxMaracasIRMViewPanelH__
+
+class wxMaracasIRMViewPanel : public wxPanel{
+public:
+       wxMaracasIRMViewPanel(wxWindow* parent)
+               : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
+                       createPanel();
+       }       
+       //virtual ~wxMaracasIRMViewPanel();
+       virtual void createPanel(){
+               show = false;
+        wxBoxSizer* sizerButtons = new wxBoxSizer(wxVERTICAL);
+
+               wxButton* b = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, 
+                                                               wxDefaultValidator, wxString(_T("-"))); 
+               Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedHide);
+               wxButton* b1 = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, 
+                                                               wxDefaultValidator, wxString(_T("x"))); 
+               Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedEliminate);
+
+               sizerButtons->Add(b, wxFIXED_MINSIZE);
+               sizerButtons->Add(b1, wxFIXED_MINSIZE);
+
+               sizercontrols = new wxBoxSizer(wxVERTICAL);
+
+               wxBoxSizer* sizerpanel = new wxBoxSizer(wxHORIZONTAL);
+
+               sizerpanel->Add(sizerButtons,wxGROW);
+               sizerpanel->Add(sizercontrols,wxGROW);
+       
+               this->SetSizer(sizerpanel, true);               
+               this->SetAutoLayout( true );
+       }
+
+       /**
+       **      Adds a new control to the panel (sizer, radiob, etc)
+       **/
+       virtual void addControl(wxWindow* win){
+               if(sizercontrols!=NULL){
+                       sizercontrols->Add(win, wxGROW);
+               }
+       }
+
+       /**
+       **      Hides or show the controls in the panel
+       **/
+       virtual void onActionButtonPressedHide( wxCommandEvent& event ){
+               wxList list = sizercontrols->GetChildren();             
+               int i;
+               for(i=0; i<list.size();i++){
+                       sizercontrols->Show(i,show);
+               }
+               show = !show;
+               sizercontrols->Layout();
+               this->Layout();
+       }
+
+    /**
+       **      The user must implement this function to remove the panel from the 
+       **/
+       virtual void onActionButtonPressedEliminate( wxCommandEvent& event )=0;
+
+       /**
+       **      The user must implement this function to add the necessary controls to the panel
+       **/
+       virtual void createControls( )=0;
+
+private:
+       wxBoxSizer* sizercontrols;
+       bool show;
+
+};
+
+#endif 
+
+#ifndef __wxMaracasIRMViewPanelProp3DH__
+#define __wxMaracasIRMViewPanelProp3DH__
+
+class wxMaracasIRMViewProp3D : public wxMaracasIRMViewPanel{
+public:
+       wxMaracasIRMViewProp3D(wxWindow* parent, int propid);
+       ~wxMaracasIRMViewProp3D();
+       void createControls();
+       void onActionButtonPressedEliminate( wxCommandEvent& event );
+       void onOpacityRelease(wxScrollEvent& event );
+       void onIsoValueRelease(wxScrollEvent& event );
+       void onRadioBoxChange(wxCommandEvent& event);
+
+       
+private:
+       wxRadioBox* radiob;
+       wxSlider* opacity;
+       wxSlider* isovalue;
+       int _propid;
+       
+};
+#endif 
+
+
+#pragma once
+
+#ifndef __ToolBar__
+#define __ToolBar__
+
+#include <vector>
+
+#include <wx/wx.h>
+
+
+
+class ToolBar : public wxToolBar{
+
+public:
+       
+       ToolBar(wxWindow * parent,std::string iconsdir="C:/Creatis/creaAppli/Development/creaPipeline/Data/Icons/");
+       ~ToolBar(void);
+       
+       
+       void onExecPipeline(wxCommandEvent& event);
+
+       void onLoadConfig(wxCommandEvent& event);
+       
+private:
+
+       
+
+       
+DECLARE_EVENT_TABLE()
+};
+
+#endif
+
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
new file mode 100644 (file)
index 0000000..5636029
--- /dev/null
@@ -0,0 +1,88 @@
+/*=========================================================================
+
+  Program:   wxMaracas
+  Module:    $RCSfile: wxMaracasIRMViewManager.cxx,v $
+  Language:  C++
+  Date:      $Date: 2009/04/01 16:16:59 $
+  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 "wxMaracasIRMViewManager.h"
+
+/**
+**     Start of the manager class
+**/
+wxMaracasIRMViewManager::wxMaracasIRMViewManager(){
+       _renderer = NULL;
+}
+wxMaracasIRMViewManager::~wxMaracasIRMViewManager(){
+}
+
+/**
+**     Sets the renderer to manage the prop3D from the view
+**/
+void wxMaracasIRMViewManager::setRenderer(vtkRenderer*  renderer){
+       _renderer = renderer;
+}
+/**
+**     Adds a prop3D to the manager and returns the identifier
+**/
+int wxMaracasIRMViewManager::addProp3D(vtkProp3D* prop3D){
+       if(prop3D != NULL){
+               prop3Dvect.push_back(prop3D);
+
+               if(_renderer!=NULL){
+                       _renderer->AddActor(prop3D);
+               }else{
+                       throw "Imposible to add actor, check renderer";
+               }
+               
+
+               return prop3Dvect.size()-1;
+       }else{
+               return -1;
+       }
+}
+/**
+**     Changes the opacity in a prop3D
+**/
+void wxMaracasIRMViewManager::changeOpacity(int propid, int value){
+       if(propid < prop3Dvect.size()){
+               vtkActor* actor = (vtkActor*)prop3Dvect[propid];                
+               actor->GetProperty()->SetOpacity((double)value/100.0);  
+               _renderer->Render();
+       }
+}
+
+/**
+**     changes the isovalue in a prop3D
+**/
+void wxMaracasIRMViewManager::changeIsoValue(int propid, int value){
+       if(propid<prop3Dvect.size()){
+
+       }
+}
+
+vtkProp3D* wxMaracasIRMViewManager:: getProp3D(std::string filename){
+       if(filename.compare("")!= 0){
+               vtkSTLReader *STLReader=vtkSTLReader::New();
+               STLReader->SetFileName(filename.c_str());
+               STLReader->Update();
+               vtkPolyDataMapper* dataMapper = vtkPolyDataMapper::New();
+               dataMapper->SetInput(STLReader->GetOutput());
+               
+               vtkActor* dataActor = vtkActor::New();
+               dataActor->SetMapper(dataMapper);       
+               dataActor->GetProperty()->SetOpacity(1);
+               
+               return dataActor;
+       }       
+       return NULL;
+}
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
new file mode 100644 (file)
index 0000000..255cc04
--- /dev/null
@@ -0,0 +1,70 @@
+/*=========================================================================
+
+  Program:   wxMaracas
+  Module:    $RCSfile: wxMaracasIRMViewManager.h,v $
+  Language:  C++
+  Date:      $Date: 2009/04/01 16:16:59 $
+  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 __wxMaracasIRMViewManagerH__
+#define __wxMaracasIRMViewManagerH__
+
+#include <iostream>
+#include <vector>
+
+#include "vtkProp3D.h"
+#include "vtkRenderer.h"
+#include "vtkSTLReader.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkActor.h"
+#include "vtkProperty.h"
+
+class wxMaracasIRMViewManager  {
+
+public:
+       wxMaracasIRMViewManager();
+       ~wxMaracasIRMViewManager();
+
+       /**
+       **      Sets the renderer to manage the prop3D from the view
+       **/
+       void setRenderer(vtkRenderer*  renderer);
+       /**
+       **      Adds a prop3D to the manager and returns the identifier
+       **/
+       int addProp3D(vtkProp3D* prop3D);
+       /**
+       **      Changes the opacity in a prop3D
+       **/
+       void changeOpacity(int propid, int value);
+
+       /**
+       **      changes the isovalue in a prop3D
+       **/
+       void changeIsoValue(int propid, int value);
+
+       /**
+       **      loads a prop3D from a nSTL file
+       **/
+       vtkProp3D* getProp3D(std::string filename);
+       
+private:       
+       std::vector<vtkProp3D*> prop3Dvect;
+
+       vtkRenderer*  _renderer;
+
+       
+};
+#endif 
index cf83734180310faa211ba60bfaeff29c9ae215e9..8057ae28b196636a0bb0e2f1a3cf9c45e9e0fa4e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/03/30 15:31:15 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2009/04/01 16:16:59 $
+  Version:   $Revision: 1.5 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -67,6 +67,7 @@
          
        wxMaracas_N_ViewersWidget::~wxMaracas_N_ViewersWidget()
        {
+               
        }
        //------------------------------------------------------------------------------------------------------------
        // Methods
 
  void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata){
 
-               wxPanel                         *panel          = this;
                wxWindow                                *wxwindow       = NULL;
-               wxSizer *sizer  = panel->GetSizer();
+               wxSizer *sizer  = this->GetSizer();
        
                if(currentwxwindow!=NULL){
-                       sizer->Remove(currentwxwindow);                 
-                       delete currentwxwindow;
+                       currentwxwindow->Show(false);
+                       //sizer->Remove(currentwxwindow);                       
+                       //delete currentwxwindow;
                }
 
                //std::cout<<"size "<<nTypeView->size()<<std::endl;
                {
 
                        std::cout<<"type "<<(*nTypeView)[0]<<std::endl;
-                       wxwindow1 = new wxMaracas_ViewerWidget(panel, imagedata, (*nTypeView)[0]);
+                       wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0]);
                        wxwindow1->ConfigureVTK();
                        wxwindow = wxwindow1;
                }else   if (nTypeView->size()==2)       {
 
                        
-                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
+                       wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
                        wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0]);
                        wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1]);
                        wxwindow1->ConfigureVTK();
                        wxwindow = spliter;
                }else if (nTypeView->size()==3)
                {
-                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
+                       wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
                        wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
                        wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0]);
                        wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
                        spliterA-> SplitHorizontally( wxwindow2 , wxwindow3  );
                        wxwindow = spliter;
                }else if (nTypeView->size()>=4){
-                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
+                       wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
                        wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
                        wxSplitterWindow        *spliterB       = new wxSplitterWindow( spliter , -1);
                        wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0]);
                }
                
                //panel->SetDimension()
-               sizer->Add( wxwindow , 1, wxGROW);
+               sizer->Add( wxwindow , 1, wxEXPAND);
                sizer->Layout();
                currentwxwindow = wxwindow;             
                currentwxwindow->Show(true);
index 7af1e6888d1ac0ca6bef704b6a38a9e85bb18aff..edfe3f3004da62d269e0faf7fc9c4ef49cc27a29 100644 (file)
@@ -68,7 +68,7 @@ wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent)//, marInterface* mar)
        _wxMaracasMPR           = NULL;
        _maxSize                = 2000;
        _minSize                = 300;
-
+       _imagedata = NULL;
        _stlMarchingCubesLevel  = 128;
        _stlDeltaGaussLevel             = 100;
 
@@ -153,9 +153,16 @@ wxPanel* wxSTLWidget_03::CreateViewPanel(wxWindow *parent)
 
 void wxSTLWidget_03::setImage(vtkImageData* img){
 
+       marImageData* marimagedata = new marImageData(img);
 
-       _wxMaracasMPR->setMarImage(new marImageData(img), 1);
+       _wxMaracasMPR->setMarImage(marimagedata, 1);
        _wxMaracasMPR->ConfigureVTK();
+       this->ConfigureProcessing(marimagedata,0,0,0);
+       this->ConfigureSTL();
+
+       _wxMaracasMPR->Refresh();
+       
+       //this->Refresh();
 }
 //-------------------------------------------------------------------
 wxWindow* wxSTLWidget_03::CreateSelectAPointPanel(wxWindow *parent)
@@ -530,11 +537,11 @@ void wxSTLWidget_03::ConfigureVTK()
 {
        wxBusyCursor wait;
 //     vtkImageData    *imagedata              = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
-       marImageData    *marimagedata;//                = _mar->_experiment->getDynData( )->GetMarImageData();
+       //marImageData  *marimagedata;//                = _mar->_experiment->getDynData( )->GetMarImageData();
        
        //CONFIGURACION ADICIONAL
        this->ConfigureSTL();
-       this->ConfigureProcessing(marimagedata,0,0,0);
+       //this->ConfigureProcessing(marimagedata,0,0,0);
        
 }