void *p;
p = imagedata->GetScalarPointer(x,y,z);
- if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
- { unsigned char *pp = (unsigned char*)p;
+ if (imagedata->GetScalarType()==VTK_CHAR)
+ {
+ char *pp = (char*)p;
result = (double)(*pp);
}
- if (imagedata->GetScalarType()==VTK_FLOAT)
- { float *pp = (float*)p;
+ else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
+ {
+ signed char *pp = (signed char*)p;
result = (double)(*pp);
}
- if (imagedata->GetScalarType()==VTK_SHORT)
- { short *pp = (short*)p;
+ else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
+ {
+ unsigned char *pp = (unsigned char*)p;
result = (double)(*pp);
}
- if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
- { unsigned short *pp = (unsigned short*)p;
+ else if (imagedata->GetScalarType()==VTK_SHORT)
+ {
+ short *pp = (short*)p;
+ result = (double)(*pp);
+ }
+ else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
+ {
+ unsigned short *pp = (unsigned short*)p;
+ result = (double)(*pp);
+ }
+ else if (imagedata->GetScalarType()==VTK_INT)
+ {
+ int *pp = (int*)p;
+ result = (double)(*pp);
+ }
+ else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
+ {
+ unsigned int *pp = (unsigned int*)p;
result = (double)(*pp);
}
+ else if (imagedata->GetScalarType()==VTK_LONG)
+ {
+ long *pp = (long*)p;
+ result = (double)(*pp);
+ }
+ else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
+ {
+ unsigned long *pp = (unsigned long*)p;
+ result = (double)(*pp);
+ }
+ else if (imagedata->GetScalarType()==VTK_FLOAT)
+ {
+ float *pp = (float*)p;
+ result = (double)(*pp);
+ }
+ else if (imagedata->GetScalarType()==VTK_DOUBLE)
+ {
+ double *pp = (double*)p;
+ result = (double)(*pp);
+ }
+
return result;
}
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasSuperposition.cxx,v $
+ Language: C++
+ Date: $Date: 2009/06/03 13:47:07 $
+ Version: $Revision: 1.3 $
+
+ 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 "wxMaracasSuperposition.h"
+#include "creaWx.h"
+#include "vtkMetaImageReader.h"
+#include "wx/artprov.h"
+
+
+
+wxMaracasSuperposition* wxMaracasSuperposition::instance=NULL;
+
+wxMaracasSuperposition::wxMaracasSuperposition( wxWindow* parent, std::vector<vtkImageData*> imgs): wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize)
+{
+ m_mgr.SetManagedWindow(this);
+
+ _superposition1 = NULL;
+ _superposition2 = NULL;
+ _superposition3 = NULL;
+
+ _images = imgs;
+
+ // set up default notebook style
+ m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
+ m_notebook_theme = 0;
+ _notebook = this->createNotebook();
+
+ createPanels();
+ configurePanels();
+}
+
+wxMaracasSuperposition::~wxMaracasSuperposition()
+{
+ _notebook->Destroy();
+ m_mgr.UnInit();
+}
+
+wxMaracasSuperposition* wxMaracasSuperposition :: getInstance ( wxWindow* parent, std::vector<vtkImageData*> imgs)
+{
+ if(instance == NULL)
+ {
+ instance = new wxMaracasSuperposition(parent, imgs);
+ }
+ return instance;
+}
+
+wxMaracasSuperposition* wxMaracasSuperposition :: getInstance()
+{
+ return instance;
+}
+
+//------------------------------------------------------------------------------------------------------------
+// Creational and initialization methods using WxAui
+//------------------------------------------------------------------------------------------------------------
+
+wxAuiNotebook * wxMaracasSuperposition :: createNotebook()
+{
+ wxSize client_size = GetClientSize();
+ wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
+ wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
+
+ return noteBook;
+}
+
+void wxMaracasSuperposition :: configurePanels()
+{
+ if( _superposition1!=NULL )
+ {
+ _notebook->AddPage( _superposition1, wxT(" Superoposition 1 ") );
+ m_mgr.Update();
+ }
+
+ if( _superposition2!=NULL )
+ {
+ _notebook->AddPage( _superposition2, wxT(" Superoposition 2 ") );
+ m_mgr.Update();
+ }
+
+ if( _superposition3!=NULL )
+ {
+ _notebook->AddPage( _superposition3, wxT(" Superoposition 3 ") );
+ m_mgr.Update();
+ }
+
+
+ m_mgr.AddPane(_notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
+ m_mgr.Update();
+
+ SetMinSize(wxSize(300,300));
+ m_mgr.Update();
+}
+
+void wxMaracasSuperposition :: createPanels()
+{
+ if( _superposition1==NULL )
+ {
+ createSuperpositionPanel(1);
+ }
+
+ else if( _superposition1!=NULL )
+ {
+
+ }
+
+ if( _superposition2==NULL )
+ {
+ createSuperpositionPanel(2);
+ }
+
+ else if( _superposition2!=NULL )
+ {
+
+ }
+
+ if( _superposition3==NULL )
+ {
+ createSuperpositionPanel(3);
+ }
+
+ else if( _superposition3!=NULL )
+ {
+
+ }
+}
+
+void wxMaracasSuperposition :: createSuperpositionPanel(int type)
+{
+ if (type=1)
+ {
+ _superposition1 = new wxMaracasSuperpositionPanel ( _images, _notebook );
+ }
+ if (type=2)
+ {
+ _superposition2 = new wxMaracasSuperpositionPanel ( _images, _notebook );
+ }
+ if (type=3)
+ {
+ _superposition3 = new wxMaracasSuperpositionPanel ( _images, _notebook );
+ }
+}
+
+void wxMaracasSuperposition :: changeImages(std::vector<vtkImageData*> imgs)
+{
+ _images = imgs;
+
+ createPanels();
+ configurePanels();
+}
+
+std::vector<vtkImageData*> wxMaracasSuperposition :: getImages( )
+{
+ return _images;
+}
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasSuperposition.h,v $
+ Language: C++
+ Date: $Date: 2009/06/03 13:47:07 $
+ Version: $Revision: 1.3 $
+
+ 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 __wxMaracasSuperpositionH__
+#define __wxMaracasSuperpositionH__
+
+#include <vector>
+#include <wx/wx.h>
+#include "wx/aui/aui.h"
+#include "wxMaracasSuperpositionPanel.h"
+#include "vtkMetaImageReader.h"
+#include "vtkImageData.h"
+
+
+
+
+class creaMaracasVisu_EXPORT wxMaracasSuperposition : public wxPanel
+{
+
+public:
+
+ wxMaracasSuperposition(wxWindow* parent, std::vector<vtkImageData*> imgs);
+
+ ~wxMaracasSuperposition();
+
+ static wxMaracasSuperposition* getInstance(wxWindow* parent, std::vector<vtkImageData*> imgs);
+
+ static wxMaracasSuperposition* getInstance();
+
+ wxAuiNotebook * createNotebook();
+
+ void createPanels();
+
+ void createSuperpositionPanel(int type);
+
+ void configurePanels();
+
+ void changeImages(std::vector<vtkImageData*> imgs);
+
+ std::vector<vtkImageData*> getImages( );
+
+
+private:
+
+ static wxMaracasSuperposition * instance;
+
+ wxAuiManager m_mgr;
+
+ wxAuiNotebook * _notebook;
+
+ std::vector<vtkImageData*> _images;
+
+ wxMaracasSuperpositionPanel * _superposition1;
+
+ wxMaracasSuperpositionPanel * _superposition2;
+
+ wxMaracasSuperpositionPanel * _superposition3;
+
+ long m_notebook_style;
+
+ long m_notebook_theme;
+};
+
+#endif
+
--- /dev/null
+
+//----------------------------------------------------------------------------------------------------------------
+// Class definition include
+//----------------------------------------------------------------------------------------------------------------
+#include "wxMaracasSuperpositionPanel.h"
+
+//----------------------------------------------------------------------------------------------------------------
+// Other includes
+//----------------------------------------------------------------------------------------------------------------
+
+ //------------------------------------------------------------------------------------------------------------
+ // Constructors & Destructors
+ //------------------------------------------------------------------------------------------------------------
+
+ wxMaracasSuperpositionPanel :: wxMaracasSuperpositionPanel ( std::vector<vtkImageData*> imgs, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
+ :wxPanel(parent, -1, pos, size, style)
+ {
+ _images = imgs;
+ int gapH = 20;
+ int gapV = 10;
+ createSuperpositionPanel();
+
+ outSizer = new wxFlexGridSizer(1, 1, gapH, gapV);
+ outSizer -> AddGrowableCol(0);
+ outSizer -> AddGrowableRow(0);
+ outSizer->Add( theViewPanel, 1, wxGROW);
+
+ this->SetSizer( outSizer );
+ this->SetAutoLayout( true );
+ this->Layout();
+ }
+
+
+ wxMaracasSuperpositionPanel :: ~wxMaracasSuperpositionPanel()
+ {
+
+ }
+
+ //------------------------------------------------------------------------------------------------------------
+ // Creational and initialization methods
+ //------------------------------------------------------------------------------------------------------------
+
+ void wxMaracasSuperpositionPanel :: createSuperpositionPanel()
+ {
+
+ std::vector<int> * numViews = new std::vector<int> ();
+ numViews->push_back(0);
+ theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[0], numViews );
+ SetVisibleAxis(false);
+
+ theViewPanel->SetBackgroundColour(wxColour(0,0,0));
+
+ theViewPanel->SetSize(800, 900);
+ theViewPanel->GetWindow(1)->SetSize(800, 900);
+ }
+
+ //------------------------------------------------------------------------------------------------------------
+
+ wxVtkBaseView* wxMaracasSuperpositionPanel :: GetWxVtkBaseView()
+ {
+ return theViewPanel->GetwxVtkBaseView(1);
+ }
+
+
+ wxVtkMPR2DView * wxMaracasSuperpositionPanel::GetwxVtkMPR2DView()
+ {
+ return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
+ }
+
+ vtkImageData * wxMaracasSuperpositionPanel::GetshowingVID()
+ {
+ return _images[0];
+ }
+
+ int wxMaracasSuperpositionPanel::GetImageDataSizeZ()
+ {
+ int ext[6];
+ GetshowingVID()->GetExtent(ext);
+ int sizeZ = ext[5]-ext[4]+1;
+
+ return sizeZ;
+ }
+
+ void wxMaracasSuperpositionPanel :: RefreshInterface()
+ {
+ GetWxVtkBaseView()->Refresh();
+ }
+
+ void wxMaracasSuperpositionPanel :: ChangeImage(vtkImageData* img)
+ {
+ theViewPanel->SetImage(img);
+ }
+
+ //------------------------------------------------------------------------------------------------------------
+ // Other functional methods
+ //------------------------------------------------------------------------------------------------------------
+
+ void wxMaracasSuperpositionPanel::SetVisibleAxis(bool ok)
+ {
+ GetwxVtkMPR2DView()->SetVisibleAxis(ok);
+ }
+
+ //------------------------------------------------------------------------------------------------------------
+ int wxMaracasSuperpositionPanel::GetX()
+ {
+ return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
+ }
+ //------------------------------------------------------------------------------------------------------------
+ int wxMaracasSuperpositionPanel::GetY()
+ {
+ return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
+ }
+ //------------------------------------------------------------------------------------------------------------
+ int wxMaracasSuperpositionPanel::GetZ()
+ {
+ return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
+ }
+
+ //------------------------------------------------------------------------------------------------------------
+ void wxMaracasSuperpositionPanel::Refresh()
+ {
+ GetwxVtkMPR2DView()->GetRenWin()->Render();
+ }
\ No newline at end of file
--- /dev/null
+#ifndef __wxMaracasSuperpositionPanelH__
+#define __wxMaracasSuperpositionPanelH__
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <wx/scrolwin.h>
+
+//------------------------------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------------------------------
+
+#include "wxMaracas_N_ViewersWidget.h"
+#include "vtkImageData.h"
+#include "wxVtkBaseView.h"
+
+//------------------------------------------------------------------------------------------------------------
+// Class definition
+//------------------------------------------------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT wxMaracasSuperpositionPanel : public wxPanel
+{
+
+public:
+
+ wxMaracasSuperpositionPanel( std::vector<vtkImageData*> imgs, wxWindow *parent, const wxPoint& pos=wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,long style= wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, int vertStart=1, int vertEnd=1,
+ int horzStart=1, int horzEnd=1 );
+
+
+ ~wxMaracasSuperpositionPanel();
+
+//------------------------------------------------------------------------------------------------------------
+// Creational and initialization methods
+//------------------------------------------------------------------------------------------------------------
+
+ void createSuperpositionPanel();
+
+//------------------------------------------------------------------------------------------------------------
+// Other functional methods
+//------------------------------------------------------------------------------------------------------------
+
+ void getSpacing( double * spacing );
+
+ wxVtkBaseView* GetWxVtkBaseView();
+ wxVtkMPR2DView * GetwxVtkMPR2DView();
+ vtkImageData * GetshowingVID();
+ int GetImageDataSizeZ();
+ void RefreshInterface();
+ void ChangeImage(vtkImageData* img);
+
+ void SetVisibleAxis(bool ok);
+ int GetX();
+ int GetY();
+ int GetZ();
+ void Refresh();
+
+
+private:
+
+ std::vector<vtkImageData*> _images;
+
+ /*
+ * Represents the panel for viewing
+ */
+ wxMaracas_N_ViewersWidget * theViewPanel;
+
+ /*
+ * Represents the outer sizer of the IRMViewPanel
+ */
+ wxFlexGridSizer* outSizer;
+
+ double last_spacing[3];
+
+};
+
+#endif /*__wxMaracasSuperpositionPanelH__*/