]> Creatis software - creaMaracasVisu.git/commitdiff
2108 Bug Volume Rendering widget options are not stable
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 19 Aug 2013 13:38:57 +0000 (15:38 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 19 Aug 2013 13:38:57 +0000 (15:38 +0200)
lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasMultipleVolumeRendererManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasMultipleVolumeRendererManagerData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx

index 97527c12a3b1b64963794aad3ee65bb7c65afc82..00d115b0bc25ab3b531f42af412fb8dd40c615e2 100644 (file)
 
 #include <vtkVolumeRayCastMapper.h>
 
-#if VTK_MAJOR_VERSION >= 5
-    #if VTK_MINOR_VERSION >= 6
-        #include "vtkGPUVolumeRayCastMapper.h"
-    #endif
+// EED This is code for Juan Carlos Prieto TESTES
+//#if VTK_MAJOR_VERSION >= 5
+//    #if VTK_MINOR_VERSION >= 6
+//        #include "vtkGPUVolumeRayCastMapper.h"
+//    #endif
+//#endif
+
+#if VTK_MAJOR_VERSION >= 6
+        #include "vtkSmartVolumeMapper.h"
 #endif
 
+
+
 using namespace std;
 
 VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, bool usegpu){
@@ -71,11 +78,11 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana
 
     _volumeProperty = vtkVolumeProperty::New();
     _volumeProperty->SetInterpolationTypeToLinear();
-    _volumeProperty->ShadeOn();
+    _volumeProperty->ShadeOff();
     _volumeProperty->SetAmbient(3);
     _volumeProperty->SetDiffuse(0.2);
     _volumeProperty->SetSpecular(0.5);
-    //_volumeProperty->DisableGradientOpacityOn();
+    _volumeProperty->DisableGradientOpacityOn();
     _tfun = vtkPiecewiseFunction::New();    
     _volumeProperty->SetScalarOpacity(_tfun );
     _ctfun = vtkColorTransferFunction::New();
@@ -123,37 +130,48 @@ void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string datana
     }
 */
 
-       VolumeMapper = 0;
-#if VTK_MAJOR_VERSION >= 5
-    #if VTK_MINOR_VERSION >= 6
-       cout<<"using volume render GPU"<<endl;
-       vtkGPUVolumeRayCastMapper * volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
-       volumeMappergpu->AutoAdjustSampleDistancesOn();       
-       VolumeMapper = volumeMappergpu;
-    #endif
+       VolumeMapper = NULL;
+
+// EED This is code for Juan Carlos Prieto TESTES
+//#if VTK_MAJOR_VERSION >= 5
+//    #if VTK_MINOR_VERSION >= 6
+//       cout<<"using volume render GPU"<<endl;
+//       vtkGPUVolumeRayCastMapper * volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
+//       volumeMappergpu->AutoAdjustSampleDistancesOn();
+//       VolumeMapper = volumeMappergpu;
+//    #endif
+//#else
+//       _compositeFunction                                            = vtkVolumeRayCastCompositeFunction::New();
+//       _MIPFunction                                                  = vtkVolumeRayCastMIPFunction::New();
+//       vtkVolumeRayCastMapper* volumeMapper                          = vtkVolumeRayCastMapper::New();
+//       volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+//       volumeMapper->AutoAdjustSampleDistancesOn();
+//       VolumeMapper                                                  = volumeMapper;
+//#endif
+
+#if VTK_MAJOR_VERSION >= 6
+       cout<<"using SmartVolumeRenderingMapper render GPU"<<endl;
+       vtkSmartVolumeMapper * smartvolumemapper                        = vtkSmartVolumeMapper::New();
+       VolumeMapper                                                    = smartvolumemapper;
+       smartvolumemapper->AutoAdjustSampleDistancesOn();
 #else
-
-
-       _compositeFunction                                                              = vtkVolumeRayCastCompositeFunction::New();
-       _MIPFunction                                                                    = vtkVolumeRayCastMIPFunction::New();
-       vtkVolumeRayCastMapper* volumeMapper                                                                    = vtkVolumeRayCastMapper::New();
+       _compositeFunction                                              = vtkVolumeRayCastCompositeFunction::New();
+       _MIPFunction                                                    = vtkVolumeRayCastMIPFunction::New();
+       vtkVolumeRayCastMapper* volumeMapper                            = vtkVolumeRayCastMapper::New();
+       VolumeMapper                                                    = volumeMapper;
        volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
-               volumeMapper->AutoAdjustSampleDistancesOn();
-               VolumeMapper                                                                    = volumeMapper;
+       volumeMapper->AutoAdjustSampleDistancesOn();
 #endif
-
-
-        VolumeMapper->SetClippingPlanes( _volumePlanes );
-        _newvol->SetMapper(VolumeMapper );
-        VolumeMapper->SetInput( _vol );
-        VolumeMapper->Update();
-    _newvol->Update();
+       VolumeMapper->SetClippingPlanes( _volumePlanes );
+       _newvol->SetMapper(VolumeMapper );
+       VolumeMapper->SetInput( _vol );
+       VolumeMapper->Update();
+       _newvol->Update();
 }
 
 
 VolumeRendererManagerData::~VolumeRendererManagerData()
 {
-
         _tfun->Delete();
         _ctfun->Delete();
         _volumePlanes->Delete();
@@ -170,22 +188,26 @@ VolumeRendererManagerData::~VolumeRendererManagerData()
         if(BoxWidget){
             DisableBoundingBox();
         }
-
 }
-void VolumeRendererManagerData::SetIndependentComponents(bool independent){
 
-    if(independent){
+
+void VolumeRendererManagerData::SetIndependentComponents(bool independent)
+{
+    if(independent)
+    {
         _volumeProperty->IndependentComponentsOn();
     }else{
         _volumeProperty->IndependentComponentsOff();
     }
 }
 
+
 void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* interactor)
 {
 //EED9Juin2011    if(_volumeMappergpu){
 
-    if(!BoxWidget){
+    if(!BoxWidget)
+    {
         BoxWidget = vtkBoxWidget::New();
         BoxWidget->SetInteractor( interactor );
         BoxWidget->SetPlaceFactor(1.01);
@@ -219,16 +241,14 @@ void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* int
 //EED9Juin2011  }
 }
 
-void VolumeRendererManagerData::DisableBoundingBox(){
-
-    if(BoxWidget){
+void VolumeRendererManagerData::DisableBoundingBox()
+{
+    if(BoxWidget)
+    {
         BoxWidget->EnabledOff();
         //BoxWidget->Delete();
         //BoxWidget = 0;
-
         cout<<"JPRG::VolumeRendererManagerData::DisableBoundingBox"<<endl;
-
-
     }
 }
 
@@ -249,19 +269,23 @@ void VolumeRendererManagerData::setVolumeColor(std::vector<double>& greylevelcol
         _newvol->Update();
 }
 
+
+
 /**
 **     Volume Opacity
 **/
-void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value){
-
+void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value)
+{
         _tfun->RemoveAllPoints();
-        for(unsigned int i = 0; i < greylevel.size();i++){
+        for(unsigned int i = 0; i < greylevel.size();i++)
+        {
                 _tfun->AddPoint(greylevel[i], value[i]);
                 //std::cout<<"VolumeRendererManagerData::setVolumeOpacity "<<greylevel[i]<<" "<< value[i]<<std::endl;
-        }
+        } // for i
     _newvol->Update();
 }
 
+
 /**
 **     Volume Opacity
 **/
@@ -273,6 +297,7 @@ void VolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,d
     setVolumeOpacity(greylevel, valuevector);
 }
 
+
 /**
 **     Check if the variables are setted correctly
 **/
@@ -288,50 +313,67 @@ void VolumeRendererManagerData::checkInvariant()throw (char *){
         }
 }
 
+
 /**
 **     Check if the variables are setted correctly
 **/
-void VolumeRendererManagerData::Update(){
+void VolumeRendererManagerData::Update()
+{
          _newvol->Update();
 }
+
+
 /**
 **     get the prop3D
 **/
-vtkProp3D* VolumeRendererManagerData::getProp3D(){
+vtkProp3D* VolumeRendererManagerData::getProp3D()
+{
         return this->_newvol;
 }
+
 /**
 **     return the id from the daat
 **/
-int VolumeRendererManagerData::getId(){
+int VolumeRendererManagerData::getId()
+{
         return _id;
 }
+
+
 /**
 **     set data id
 **/
-void VolumeRendererManagerData::setId(int propid){
+void VolumeRendererManagerData::setId(int propid)
+{
         _id = propid;
 }
 
+
 /**
 **     Get the filanme
 **/
-std::string VolumeRendererManagerData::getDataname(){
+std::string VolumeRendererManagerData::getDataname()
+{
         return _dataname;
 }
+
+
 /**
 ** Set the filanme
 **/
-void VolumeRendererManagerData::setDataname(std::string dataname){
+void VolumeRendererManagerData::setDataname(std::string dataname)
+{
         _dataname = dataname;
 }
 
-void VolumeRendererManagerData::changeCompositeMIPFunction(int function){
+
+void VolumeRendererManagerData::changeCompositeMIPFunction(int function)
+{
         //checkInvariant();
-        if(VolumeMapper){
-#if VTK_MAJOR_VERSION >= 5
-    #if VTK_MINOR_VERSION >= 6
-            if(dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper)){
+        if(VolumeMapper!=NULL){
+#if VTK_MAJOR_VERSION >= 6
+           if(dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper))
+           {
                 vtkVolumeRayCastMapper* volumemapper = dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper);
                 if(function == 0){
                         volumemapper->SetVolumeRayCastFunction(_compositeFunction);
@@ -348,9 +390,8 @@ void VolumeRendererManagerData::changeCompositeMIPFunction(int function){
                     volumemapper->SetBlendModeToMinimumIntensity();
                 }
             }
-    #endif
 #else
-            vtkGPUVolumeRayCastMapper* volumemapper = dynamic_cast<vtkGPUVolumeRayCastMapper*>(VolumeMapper);
+            vtkVolumeRayCastMapper* volumemapper = dynamic_cast<vtkVolumeRayCastMapper*>(VolumeMapper);
             if(function == 0){
                 volumemapper->SetBlendModeToComposite();
             }else if(function == 1){
@@ -363,7 +404,8 @@ void VolumeRendererManagerData::changeCompositeMIPFunction(int function){
 
 }
 
-void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable){
+void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable)
+{
     if(lookuptable){
          _ctfun->RemoveAllPoints();
          vtkColorTransferFunction* colort = (vtkColorTransferFunction*)lookuptable;
@@ -378,7 +420,8 @@ void VolumeRendererManagerData::SetLookupTable(vtkLookupTable* lookuptable){
 
 }
 
-void VolumeRendererManagerData::changeInterpolationType(int type){
+void VolumeRendererManagerData::changeInterpolationType(int type)
+{
     //checkInvariant();
     if(type == 0){
         _volumeProperty->SetInterpolationTypeToLinear();
index 88d8c52a9ea34b5ecebfa8f2bc639f436c60990f..e57059a3fed44f08493276d8d7f8684a49800434 100644 (file)
@@ -43,23 +43,17 @@ HistogramDialogComboBox::HistogramDialogComboBox(wxWindow* parent)
        colorBar_Bitmap         = NULL;
        _bitmapsizer            = NULL;
 
+       InitCurrentPathColorsFuntion();
        this->SetSizer(getBitmapCombo());
        _img                    = NULL;
-       _currentitem            = -1;
+       _currentitem            = -1;    
        _maxgreyvalue           = 0;
-printf("EED HistogramDialogComboBox\n");
-#ifdef LINUX
-       std::string currentpath = crea::System::GetExecutablePath();
 
 
-    currentpath.append("../share/creaMaracasVisu/data/");
-printf("EED JCP OOOOJJJOOO cambiar esto HistogramDialogComboBox::HistogramDialog writting in this directory\n");
-    currentpath = "/home/davila/dataHistogram";
+}
+
 
 
-       crea::System::createDirectory(currentpath.c_str());
-#endif
-}
 
 HistogramDialogComboBox::~HistogramDialogComboBox()
 {
@@ -80,6 +74,7 @@ wxSizer* HistogramDialogComboBox::getBitmapCombo()
 
        wxBoxSizer* comboeditsizer = new wxBoxSizer(wxHORIZONTAL);
        _bitmapcombo = getBitmapComboElements();
+        BitmapComboItemSelect(0);
 
        wxBitmap bitmap1(Edit_xpm);
        wxBitmapButton* edit = new wxBitmapButton(this, -1, bitmap1,wxDefaultPosition,wxSize(30,30));
@@ -176,39 +171,33 @@ void HistogramDialogComboBox::OnEditBitmapCombo(wxCommandEvent& event)
                        dialog->UpdateCurrentComboElement();
                        _bitmapsitems = dialog->getComboBoxItems();
 
-                       //std::string currentpath = crea::System::GetDllAppPath("bbcreaMaracasVisu"); // JPR
-                       std::string dllLastName;
-                       std::string currentpath;
-                       #ifdef WIN32
-                       dllLastName = "bbcreaMaracasVisu";
-                       currentpath = crea::System::GetDllAppPath(dllLastName);
-                       #endif
-                       #ifdef LINUX
-                       currentpath = crea::System::GetExecutablePath();
-                       currentpath.append("../share/creaMaracasVisu/data/");
-                       #endif
-                       currentpath.append(FILENAME);
-
                        std::vector<double> redvect,greenvect,bluevect;
                        std::vector<double> greyvect;
 
-                       saveCurrentConfiguration(_bitmapsitems, currentpath);
+                       saveCurrentConfiguration(_bitmapsitems, GetFileNameOfColorsFunction() );
                        wxBitmapComboBox* tempbitmapcombo = _bitmapcombo;
-                       for(int i = 0; i < _bitmapsitems.size();i++){
+                       for(int i = 0; i < _bitmapsitems.size();i++)
+                       {
                                delete _bitmapsitems[i];
                        }
                        _bitmapsitems.clear();
                        _bitmapcombo = getBitmapComboElements();
-                       if(_bitmapsizer->Replace(tempbitmapcombo,_bitmapcombo)){
-
-                               tempbitmapcombo->Destroy();
-                       }
+                       
+// EED Eraseme                 
+//                     if(_bitmapsizer->Replace(tempbitmapcombo,_bitmapcombo))
+//                     {
+//                             tempbitmapcombo->Destroy();
+//                     } else {
+//                             printf ("EED ERROR HistogramDialogComboBox::OnEditBitmapCombo. Can't replace bitmapcombo \n");
+//                     }
+                       
                        this->Layout();
                }
                dialog->Destroy();
        }
 }
 
+
 void HistogramDialogComboBox::saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename)
 {
        std::ofstream file;
@@ -265,63 +254,92 @@ void HistogramDialogComboBox::saveCurrentConfiguration(std::vector<HistogramDial
        file.close();
 }
 
-wxBitmapComboBox* HistogramDialogComboBox::getBitmapComboElements()
+void HistogramDialogComboBox::InitCurrentPathColorsFuntion()
 {
-       std::string currentpath = "";
+      _currentpathColorsFuntion = "";
 #ifdef WIN32
-       currentpath = crea::System::GetDllAppPath("bbcreaMaracasVisu");
+       _currentpathColorsFuntion = crea::System::GetDllAppPath("bbcreaMaracasVisu");
 #endif
 #ifdef LINUX
-       currentpath = crea::System::GetExecutablePath();
-       currentpath.append("../share/CreaMaracasVisu/data/");
+       _currentpathColorsFuntion = crea::System::GetExecutablePath();
+       _currentpathColorsFuntion.append("/../share/creaMaracasVisu/data/");
+#endif
+       crea::System::createDirectory(_currentpathColorsFuntion.c_str());
+}
 
-printf("EED JCP OOOOJJJOOO cambiar esto HistogramDialogComboBox::HistogramDialog writting in this file ******************\n");
-    currentpath = "/home/davila/dataHistogram";
 
-#endif
-       currentpath.append(FILENAME);
 
-       std::cout<<"current file name " <<currentpath<<std::endl;
+std::string HistogramDialogComboBox::GetFileNameOfColorsFunction()
+{
+   std::string filename;
+   filename = _currentpathColorsFuntion;                                                       
+   filename.append(COLORSFUNCTIONFILENAME);                                                                                                                       
+   return filename;
+}
 
+
+wxBitmapComboBox* HistogramDialogComboBox::getBitmapComboElements()
+{
        std::vector<HistogramDialogComboBoxItem*> bitmapsitems;
-       OnLoadComboBoxData(bitmapsitems, currentpath);
+       OnLoadComboBoxData(bitmapsitems, GetFileNameOfColorsFunction() );
        _bitmapsitems = bitmapsitems;
        wxString* choices;
        choices = new wxString[bitmapsitems.size()];
        for(int i = 0; i < bitmapsitems.size();i++)
        {
-               choices[i] = _T("");
+               choices[i] = _T("Color Function");
+       }
+       
+       wxBitmapComboBox* bitmapcombo;
+//EED  wxBitmapComboBox* bitmapcombo = new wxBitmapComboBox(this, -1, _T(""), wxDefaultPosition, wxDefaultSize, bitmapsitems.size(),choices);
+       if (_bitmapcombo!=NULL)
+       {
+               _bitmapcombo->Clear();
+               bitmapcombo=_bitmapcombo;
+       } else {
+               bitmapcombo = new wxBitmapComboBox(this, -1, _T(""));
        }
-       wxBitmapComboBox* bitmapcombo = new wxBitmapComboBox(this, -1, _T(""), wxDefaultPosition, wxDefaultSize, bitmapsitems.size(),choices);
-       bitmapcombo->SetSize(65,30);
+//     wxBitmapComboBox* bitmapcombo = new wxBitmapComboBox(this, -1, _T(""));
+       bitmapcombo->SetSize(165,30);
 
        Connect(bitmapcombo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction)&HistogramDialogComboBox::OnBitmapComboItemSelected);
 
        for(int i = 0; i < bitmapsitems.size(); i++)
        {
-        bitmapcombo->SetItemBitmap(i, bitmapsitems[i]->GetBitmap());
+               bitmapcombo->Append(_T("ColorFunction"), bitmapsitems[i]->GetBitmap() );
+//        bitmapcombo->SetItemBitmap(i, bitmapsitems[i]->GetBitmap());
        }
+       BitmapComboItemSelect(0);
        return  bitmapcombo;
 }
 
-void HistogramDialogComboBox::OnBitmapComboItemSelected(wxCommandEvent& event)
+
+void HistogramDialogComboBox::BitmapComboItemSelect(int value)
 {
+       HistogramDialogComboBoxItem* currentconfig;
        if(_bitmapcombo!=NULL)
        {
-               _currentitem = event.GetInt();
+               _currentitem = value;
+               _bitmapcombo->Select(value);
                if(_bitmapsitems.size()>_currentitem)
                {
-                       HistogramDialogComboBoxItem* currentconfig = _bitmapsitems[_currentitem];
-                       _greyvect = currentconfig->getGreyVector();
-                       _redvect = currentconfig->getRedVector();
-                       _greenvect = currentconfig->getGreenVector();
-                       _bluevect= currentconfig->getBlueVector();
-                       _greyvecttransfer = currentconfig->getGreyVectorTransfer();
-                       _value  = currentconfig->getValueVector();
+                       currentconfig           = _bitmapsitems[_currentitem];
+                       _greyvect                       = currentconfig->getGreyVector();
+                       _redvect                        = currentconfig->getRedVector();
+                       _greenvect                      = currentconfig->getGreenVector();
+                       _bluevect                       = currentconfig->getBlueVector();
+                       _greyvecttransfer       = currentconfig->getGreyVectorTransfer();
+                       _value                          = currentconfig->getValueVector();
                        wxCommandEvent newevent(wxEVT_COMMAND_COMBOBOX_SELECTED,this->GetId());
             ProcessEvent(newevent);
-               }
-       }
+               } // if size
+       } // _bitmapcombo
+}
+
+
+void HistogramDialogComboBox::OnBitmapComboItemSelected(wxCommandEvent& event)
+{
+       BitmapComboItemSelect(  event.GetInt() );
 }
 
 void HistogramDialogComboBox::OnLoadComboBoxData(std::vector<HistogramDialogComboBoxItem*>& itembitmaps, std::string filename)
@@ -343,6 +361,7 @@ void HistogramDialogComboBox::OnLoadComboBoxData(std::vector<HistogramDialogComb
 
        //std::cout<<filename<<std::endl;
        itembitmaps.clear();
+
        if(file.is_open())
        {
                bool add = false;
index c50d11a3d1f9902e45fbed243dd2254690ed422a..9fc89ac6600153985365952f9d7639396f3852bf 100644 (file)
 #include <wx/bmpcbox.h>
 #include "vtkImageData.h"
 
-#ifdef WIN32
-#define FILENAME "/data/colorsfunction.txt"
-#else
-#define FILENAME "colorsfunction.txt"
-#endif
-
+#define COLORSFUNCTIONFILENAME "colorsfunction.txt"
 
 class HistogramDialogComboBox : public wxPanel
 {
@@ -72,6 +67,7 @@ public:
 
        void OnEditBitmapCombo(wxCommandEvent& event);
        void OnBitmapComboItemSelected(wxCommandEvent& event);
+       void BitmapComboItemSelect(int value);
 
        void OnColorLevelChanged(wxCommandEvent& event);        
        void OnWindowLevelChanged(wxCommandEvent& event);       
@@ -94,6 +90,8 @@ public:
 
        double GetWindowLevel();
        double GetColorLevel();
+       void InitCurrentPathColorsFuntion();
+       std::string GetFileNameOfColorsFunction();
 
 private:
 
@@ -107,6 +105,8 @@ private:
        double _maxgreyvalue;
        int _currentitem;       
 
+       std::string _currentpathColorsFuntion;
+
        /*
        * Represents the color of the backGround. Default color is the parent color. 
        */              
index f1d5f3659021208297968c1835222db679a7aedc..8ab810eb2d87f954bc1791461ca9cc86f4926380 100644 (file)
@@ -41,6 +41,7 @@
 =========================================================================*/
 #include "wxMaracasMultipleVolumeRendererManager.h"
 
+#include "vtkRenderWindow.h"
 #include <vtkMetaImageReader.h>
 #include <vtkImageCast.h>
 /**
@@ -73,7 +74,7 @@ vtkRenderer* wxMaracasMultipleVolumeRendererManager::getRenderer(){
 void wxMaracasMultipleVolumeRendererManager::Update(int ppid){
        wxMaracasMultipleVolumeRendererManagerData* data = this->getViewData(ppid);
        data->Update();
-       _renderer->Render();
+       _renderer->GetRenderWindow()->Render();
 }
 
 /**
@@ -106,7 +107,8 @@ int wxMaracasMultipleVolumeRendererManager::addVolume(int idTP, vtkImageData* vo
 **     adds or removes an actor depending of the bool value
 **/
 
-void wxMaracasMultipleVolumeRendererManager::addRemoveActor(int propid, bool addremove)  throw(char*){
+void wxMaracasMultipleVolumeRendererManager::addRemoveActor(int propid, bool addremove)  throw(char*)
+{
        checkInvariant();
        
        wxMaracasMultipleVolumeRendererManagerData* data = this->getViewData(propid);           
@@ -116,19 +118,22 @@ void wxMaracasMultipleVolumeRendererManager::addRemoveActor(int propid, bool add
                }else{
                        _renderer->RemoveViewProp(data->getProp3D());
                }
-               _renderer->Render();
+               _renderer->GetRenderWindow()->Render();
        }
        
 }
+
+
 /**
 **     Changes the opacity in a prop3D
 **/
-void wxMaracasMultipleVolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value)  throw(char*){
+void wxMaracasMultipleVolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value)  throw(char*)
+{
        checkInvariant();               
 
        this->getViewData(propid)->setVolumeOpacity(greylevel, value);
        
-       _renderer->Render();
+       _renderer->GetRenderWindow()->Render();
 
 }
 
@@ -138,15 +143,18 @@ void wxMaracasMultipleVolumeRendererManager::setVolumeOpacity(int propid, std::v
 void wxMaracasMultipleVolumeRendererManager::setVolumeColor(int volid, std::vector<double> greylevel,
                                                                std::vector<double> red,
                                                                std::vector<double> green,
-                                                               std::vector<double> blue)throw(char*){
+                                                               std::vector<double> blue)throw(char*)
+{
        checkInvariant();               
 
        this->getViewData(volid)->setVolumeColor(greylevel, red, green, blue);
        
-       _renderer->Render();
+       _renderer->GetRenderWindow()->Render();
 }
 
-vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData(std::string filename){
+
+vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData(std::string filename)
+{
        if(filename.compare("")!= 0){   
                
                vtkMetaImageReader* reader =  vtkMetaImageReader::New();        
@@ -166,17 +174,23 @@ vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData(std::string f
        return NULL;
 }
 
-vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData(){  
+
+vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData()
+{
        return image;
 }
 
-void wxMaracasMultipleVolumeRendererManager::checkInvariant()  throw(char*){
+
+void wxMaracasMultipleVolumeRendererManager::checkInvariant()  throw(char*)
+{
        if(this->_renderer==NULL){
                throw "Renderer not set";
        }
 }
 
-wxMaracasMultipleVolumeRendererManagerData* wxMaracasMultipleVolumeRendererManager::getViewData(int id) throw(char*){
+
+wxMaracasMultipleVolumeRendererManagerData* wxMaracasMultipleVolumeRendererManager::getViewData(int id) throw(char*)
+{
     int i;
        for(i = 0; i < (int)(prop3Dvect.size());i++){
                if(prop3Dvect[i]->getId() == id){
@@ -188,7 +202,9 @@ wxMaracasMultipleVolumeRendererManagerData* wxMaracasMultipleVolumeRendererManag
        return NULL;
 }
 
-void wxMaracasMultipleVolumeRendererManager::deleteActor(int propid) throw (char *){
+
+void wxMaracasMultipleVolumeRendererManager::deleteActor(int propid) throw (char *)
+{
        checkInvariant();       
 
        this->addRemoveActor(propid, false);
@@ -215,14 +231,22 @@ void wxMaracasMultipleVolumeRendererManager::deleteActor(int propid) throw (char
     
 }
 
-vtkPiecewiseFunction* wxMaracasMultipleVolumeRendererManager::GetTransferFunction(int volumeid){
+
+vtkPiecewiseFunction* wxMaracasMultipleVolumeRendererManager::GetTransferFunction(int volumeid)
+{
        return getViewData(volumeid)->GetTransferFunction();
 }
-vtkColorTransferFunction* wxMaracasMultipleVolumeRendererManager::GetColorFunction(int volumeid){
+
+
+vtkColorTransferFunction* wxMaracasMultipleVolumeRendererManager::GetColorFunction(int volumeid)
+{
 
        return getViewData(volumeid)->GetColorFunction();
 }
 
-void wxMaracasMultipleVolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *){
+
+void wxMaracasMultipleVolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *)
+{
        getViewData(id)->changeCompositeMIPFunction(function);
+       Update(id);
 }
index 89d4dee29bad7d5d9b52c7740a9cb2bb62872372..d1197c5f5c6a20519dc87e0e7562bbc238a38478 100644 (file)
@@ -48,7 +48,7 @@ wxMaracasMultipleVolumeRendererManagerData::wxMaracasMultipleVolumeRendererManag
        _volumeMapper->AutoAdjustSampleDistancesOn();
        _volumeProperty = vtkVolumeProperty::New();     
        _volumeProperty->SetInterpolationTypeToLinear();
-       //_volumeProperty->ShadeOn();
+       _volumeProperty->ShadeOn();
        _volumeProperty->DisableGradientOpacityOn();    
        _volumeProperty->SetColor(_ctfun);
        _volumeProperty->SetScalarOpacity(_tfun );
index b9bc3ac4551796029d358a8e0ad36b3156f69ecf..b6e50ca0e95e42fc60d84e5a851cb28a1b325b41 100644 (file)
@@ -236,7 +236,11 @@ void wxVtkMPR2DView::Refresh()
 {
        //wxVtk2DBaseView::Refresh();
        int x1 = 0,x2 = 0,y1 = 0,y2 = 0,z1 = 0,z2 = 0;
-       int x = 0, y = 0, z = 0;
+
+//EED 02/08/2013
+//     int x = 0, y = 0, z = 0;
+       double x = 0, y = 0, z = 0;
+
        int xx = 0, yy = 0, zz = 0;
        double *spc     = 0;
        double *origin  = 0;
@@ -275,10 +279,16 @@ void wxVtkMPR2DView::Refresh()
                yy = (int)(GetVtkmprbasedata()->GetY());
                zz = (int)(GetVtkmprbasedata()->GetZ());
 
-               x =  round(xx*spc[0]);
-               y =  round(yy*spc[1]);
-               z =  round(zz*spc[2]);
-               
+//EED 02/08/2013
+//             x =  round(xx*spc[0]);
+//             y =  round(yy*spc[1]);
+//             z =  round(zz*spc[2]);
+
+               x =  xx*spc[0];
+               y =  yy*spc[1];
+               z =  zz*spc[2];
+
+
                if ((xx!=_backX) || (yy!=_backY) || (zz!=_backZ)) {
 
                        if (_direction==0) {    // YZ