//mwxwidget->UpdateLayout(img);
}
- if (firsttime==true) // EED 21 aout 2010
- {
- firsttime=false;
- mwxwidget->ConfigureVTK();
- }
+// if (firsttime==true) // EED 21 aout 2010
+// {
+// firsttime=false;
+// mwxwidget->ConfigureVTK();
+// }
+
mwxwidget->RefreshView();
currenttype = type;
//-------------------------------------------------------------
void ViewerNV::bbUserSetDefaultValues()
{
- firsttime=true;
+// firsttime=true;
mwxwidget = NULL;
bbSetInputIn(NULL);
std::vector<int> point;
private:
- bool firsttime;
+// bool firsttime;
vtkImageData* currentimg;
std::vector<int> currenttype;
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
Language: C++
- Date: $Date: 2010/08/25 17:51:12 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2010/10/23 12:01:32 $
+ Version: $Revision: 1.20 $
Copyright: (c) 2002, 2003
License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+
+ 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.
=========================================================================*/
EVT_MENU( 12122, wxMaracas_N_ViewersWidget::OnDClickLeft )
END_EVENT_TABLE( );
-
+
//------------------------------------------------------------------------------------------------------------
// Constructors & Destructors
//------------------------------------------------------------------------------------------------------------
wxwindow4 = NULL;
_currentwxw = NULL;
mvtkmprbasedata = NULL;
-
+
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(sizer);
this->SetAutoLayout(true);
-
-
+
+
if(imagedata!=NULL && nTypeView!=NULL ){
this->SetType(nTypeView);
this->UpdateLayout(imagedata);
}
-
+
}
/**
* @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer
- * @post The layout of the viewer is initialized, if no image is provided at first, a default image is
+ * @post The layout of the viewer is initialized, if no image is provided at first, a default image is
* used
* @param wxWindow* parent of the window
- * @param std::vector<int>* vector of the type for the viewer
+ * @param std::vector<int>* vector of the type for the viewer
* @param vtkImageData* imagedata of the viewer
*/
wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget(wxWindow *parent, std::vector<int> *nTypeView, vtkImageData* imagedata)
wxwindow4 = NULL;
_currentwxw = NULL;
mvtkmprbasedata = NULL;
-
+
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(sizer);
this->SetAutoLayout(true);
-
+
this->SetType(nTypeView);
-
+
/*if(imagedata==NULL){
double spc[3];
spc[0] = 1;
extent[3] = 1;
extent[4] = 0;
extent[5] = 0;
-
+
imagedata = vtkImageData::New();
imagedata->SetSpacing(spc);
imagedata->SetExtent(extent);
imagedata->SetScalarTypeToUnsignedChar();
imagedata->AllocateScalars();
}*/
-
+
this->UpdateLayout(imagedata);
}
//-------------------------------------------------------------------------
-
+
wxMaracas_N_ViewersWidget::~wxMaracas_N_ViewersWidget()
{
if (mvtkmprbasedata!=NULL)
//-------------------------------------------------------------------------
- void wxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event)
+ void wxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event)
{
RefreshView();
}
//----------------------------------------------------------------------------
- void wxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event)
+ void wxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event)
{
RefreshView();
}
}
void wxMaracas_N_ViewersWidget::RefreshView()
- {
+ {
+
if (wxwindow1!=NULL) {wxwindow1->RefreshView(); }
if (wxwindow2!=NULL) {wxwindow2->RefreshView(); }
if (wxwindow3!=NULL) {wxwindow3->RefreshView(); }
}
//-------------------------------------------------------------------------
- wxMaracas_ViewerWidget *wxMaracas_N_ViewersWidget::GetWindow(int iWin)
+ wxMaracas_ViewerWidget *wxMaracas_N_ViewersWidget::GetWindow(int iWin)
{
wxMaracas_ViewerWidget *tmpWin=NULL;
if (iWin==1)
//-------------------------------------------------------------------------
wxVtkBaseView *wxMaracas_N_ViewersWidget::GetwxVtkBaseView(int iWin)
- {
+ {
wxVtkBaseView *wxvtkbaseview=NULL;
wxMaracas_ViewerWidget *tmpWin=GetWindow(iWin);
if (tmpWin!=NULL){ wxvtkbaseview = tmpWin->GetwxVtkBaseView(); }
return wxvtkbaseview;
}
-
+
//-------------------------------------------------------------------------
void wxMaracas_N_ViewersWidget::Refresh(bool eraseBackground, const wxRect* rect )
{
//-------------------------------------------------------------------------
void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata)
{
-
wxWindow *wxwindow = NULL;
- wxSizer *sizer = this->GetSizer();
-
+ wxSizer *sizer = this->GetSizer();
+
if (mvtkmprbasedata!=NULL)
{
delete mvtkmprbasedata;
}
-
- marImageData *marimagedata = new marImageData( imagedata );
- mvtkmprbasedata = new vtkMPRBaseData();
+
+ marImageData *marimagedata = new marImageData( imagedata );
+ mvtkmprbasedata = new vtkMPRBaseData();
mvtkmprbasedata->SetMarImageData(marimagedata);
-
+
if(_currentwxw != NULL){
_currentwxw->Show(false);
delete _currentwxw;
- //sizer->Remove(currentwxwindow);
+ //sizer->Remove(currentwxwindow);
//delete currentwxwindow;
}
if (nTypeView->size()==1)
{
wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0], mvtkmprbasedata);
-
- wxwindow1->ConfigureVTK();
wxwindow = wxwindow1;
}else if (nTypeView->size()==2) {
wxSplitterWindow *spliter = new wxSplitterWindow( this , -1);
spliter->SetMinimumPaneSize(1);
wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0], mvtkmprbasedata);
wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1], mvtkmprbasedata);
- wxwindow1->ConfigureVTK();
- wxwindow2->ConfigureVTK();
spliter -> SplitVertically( wxwindow1 , wxwindow2 );
- wxwindow = spliter;
+ wxwindow = spliter;
}else if (nTypeView->size()==3)
{
wxSplitterWindow *spliter = new wxSplitterWindow( this , -1);
wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0], mvtkmprbasedata);
wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1], mvtkmprbasedata);
wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2], mvtkmprbasedata);
- wxwindow1->ConfigureVTK();
- wxwindow2->ConfigureVTK();
- wxwindow3->ConfigureVTK();
spliter -> SplitVertically( wxwindow1 , spliterA );
spliterA-> SplitHorizontally( wxwindow2 , wxwindow3 );
wxwindow = spliter;
spliter->SetMinimumPaneSize(1);
spliterA->SetMinimumPaneSize(1);
spliterB->SetMinimumPaneSize(1);
+
+ spliter -> SplitVertically( spliterA , spliterB );
wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0], mvtkmprbasedata);
wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1], mvtkmprbasedata);
+ spliterA-> SplitHorizontally( wxwindow1 , wxwindow2 );
wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2], mvtkmprbasedata);
wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3], mvtkmprbasedata);
- wxwindow1->ConfigureVTK();
- wxwindow2->ConfigureVTK();
- wxwindow3->ConfigureVTK();
- wxwindow4->ConfigureVTK();
- spliter -> SplitVertically( spliterA , spliterB );
- spliterA-> SplitHorizontally( wxwindow1 , wxwindow2 );
spliterB-> SplitHorizontally( wxwindow3 , wxwindow4 );
wxwindow = spliter;
}
-
+
+
//panel->SetDimension()
sizer->Add( wxwindow , 1, wxGROW);
sizer->Layout();
- //_currentwxw = wxwindow;
+ //_currentwxw = wxwindow;
//_currentwxw->Show(true);
-
+
//this->Layout();
//this->Refresh();
+
+
+// I don't undestand how this works and not the opposite ...
+ if (wxwindow4!=NULL) {wxwindow4->ConfigureVTK(); }
+ if (wxwindow3!=NULL) {wxwindow3->ConfigureVTK(); }
+ if (wxwindow2!=NULL) {wxwindow2->ConfigureVTK(); }
+ if (wxwindow1!=NULL) {wxwindow1->ConfigureVTK(); }
}
//-----------------------------------------------------------------------------------
void wxMaracas_N_ViewersWidget::SetImage( vtkImageData *image )
- {
+ {
if (wxwindow1!=NULL) { wxwindow1->SetImage(image); }
- if (wxwindow2!=NULL) { wxwindow2->SetImage(image); }
+ if (wxwindow2!=NULL) { wxwindow2->SetImage(image); }
if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
ConfigureVTK();
-
+
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
double wxMaracas_N_ViewersWidget :: GetX()
-{
+{
invariant();
return mvtkmprbasedata->GetX();
// return wxwindow1->GetX();
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.h,v $
Language: C++
- Date: $Date: 2010/08/04 18:45:27 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2010/10/23 12:01:32 $
+ Version: $Revision: 1.12 $
Copyright: (c) 2002, 2003
License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+
+ 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.
=========================================================================*/
{
public:
-
+
//------------------------------------------------------------------------------------------------------------
// Constructors & Destructors
//------------------------------------------------------------------------------------------------------------
/**
* @pre A wxWindow* object must be provided as a parent for the viewer
- * @post The layout of the viewer is initialize, if there is no image or type set,
+ * @post The layout of the viewer is initialize, if there is no image or type set,
only the panel of the viwer is created with no vtk objects
* @param wxWindow* parent of the window
* @param vtkImageData* imagedata of the viewer
* @param std::vector<int>* vector of the type for the viewer
- * @deprecated This method will be eliminated in future versions,
- * @deprecated the viewers will start with a default image if it is not specified,
- * @deprecated this is in order to create the layout of the viewer,
- * @deprecated the vtkInteractors* and the object vtkRenderer* use second constructor
+ * @deprecated This method will be eliminated in future versions,
+ * @deprecated the viewers will start with a default image if it is not specified,
+ * @deprecated this is in order to create the layout of the viewer,
+ * @deprecated the vtkInteractors* and the object vtkRenderer* use second constructor
*/
wxMaracas_N_ViewersWidget(wxWindow *parent, vtkImageData* imagedata = NULL, std::vector<int> *nTypeView = NULL);
/**
* @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer
- * @post The layout of the viewer is initialized, if no image is provided at first, a default image is
+ * @post The layout of the viewer is initialized, if no image is provided at first, a default image is
* used
* @param wxWindow* parent of the window
- * @param std::vector<int>* vector of the type for the viewer
+ * @param std::vector<int>* vector of the type for the viewer
* @param vtkImageData* imagedata of the viewer
*/
wxMaracas_N_ViewersWidget(wxWindow *parent, std::vector<int> *nTypeView, vtkImageData* imagedata = NULL);
*/
~wxMaracas_N_ViewersWidget();
-
+
//------------------------------------------------------------------------------------------------------------
// Methods
//------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
private:
-
+
+ wxPanel *wxw1;
+ wxPanel *wxw2;
+ wxPanel *wxw3;
+ wxPanel *wxw4;
wxMaracas_ViewerWidget *wxwindow1;
wxMaracas_ViewerWidget *wxwindow2;
wxMaracas_ViewerWidget *wxwindow3;
std::vector<int> *nTypeView;
- vtkMPRBaseData* mvtkmprbasedata;
-
+ vtkMPRBaseData* mvtkmprbasedata;
+
void invariant();
DECLARE_EVENT_TABLE( );
};
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $
Language: C++
- Date: $Date: 2010/08/25 17:51:12 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2010/10/23 12:01:32 $
+ Version: $Revision: 1.31 $
Copyright: (c) 2002, 2003
License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+
+ 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.
=========================================================================*/
wxWindow *wxwindow = NULL, *window3D = 0;
wxSplitterWindow *panelClipping3D= 0;
// wxPanel *panelControl = 0;
-// wxFlexGridSizer *sizerCtrol = 0;
+// wxFlexGridSizer *sizerCtrol = 0;
wxPanel *controlPanelMPR3D = 0;
wxPanel *controlPanelClippingSurf3D = 0;
//RaC 03-2010 Adding a tab
if (vtkmprbasedata==NULL)
{
- minternalVtkmprbasedata = true;
- mvtkmprbasedata = new vtkMPRBaseData();
- marImageData *marimagedata = new marImageData( imagedata );
+ minternalVtkmprbasedata = true;
+ mvtkmprbasedata = new vtkMPRBaseData();
+ marImageData *marimagedata = new marImageData( imagedata );
mvtkmprbasedata->SetMarImageData(marimagedata);
} else {
minternalVtkmprbasedata = false;
- mvtkmprbasedata = vtkmprbasedata;
+ mvtkmprbasedata = vtkmprbasedata;
}
mvtk2Dbaseview = NULL;
{
mvtk2Dbaseview = new wxVtk2DBaseView(panel);
mvtk2Dbaseview->SetVtkBaseData(mvtkmprbasedata);
- wxwindow = mvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+ wxwindow = mvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
}else if (type==0)
{
mvtkmpr2Dview_Z = new wxVtkMPR2DView(panel,2);
mvtkmpr2Dview_Z->SetVtkBaseData(mvtkmprbasedata);
- wxwindow = mvtkmpr2Dview_Z->GetWxVTKRenderWindowInteractor();
+ wxwindow = mvtkmpr2Dview_Z->GetWxVTKRenderWindowInteractor();
}else if (type==1)
{
mvtkmpr2Dview_X = new wxVtkMPR2DView(panel,0);
mvtkmpr2Dview_X->SetVtkBaseData(mvtkmprbasedata);
- wxwindow = mvtkmpr2Dview_X->GetWxVTKRenderWindowInteractor();
+ wxwindow = mvtkmpr2Dview_X->GetWxVTKRenderWindowInteractor();
}else if (type==2)
{
mvtkmpr2Dview_Y = new wxVtkMPR2DView(panel,1);
mvtkmpr2Dview_Y->SetVtkBaseData(mvtkmprbasedata);
- wxwindow = mvtkmpr2Dview_Y->GetWxVTKRenderWindowInteractor();
+ wxwindow = mvtkmpr2Dview_Y->GetWxVTKRenderWindowInteractor();
}else if (type==3)
{
mwidgetMesure = new wxWidgetMesure2D_Plane_in_MPR(panel);
mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panelClipping3D );
mwxvtkclipping3Dview = new wxVtkClipping3DView(mwxvtk3Dbaseview_Clipping3D);
- vtkClipping3DDataViewer *vtkclipping3Ddataviewer = new vtkClipping3DDataViewer();
+ vtkClipping3DDataViewer *vtkclipping3Ddataviewer = new vtkClipping3DDataViewer();
vtkclipping3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata);
vtkclipping3Ddataviewer->Configure();
mwxvtkclipping3Dview->SetVtkClipping3DDataViewer(vtkclipping3Ddataviewer);
mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
- vtkMPR3DDataViewer *vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
+ vtkMPR3DDataViewer *vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata);
vtkmpr3Ddataviewer->Configure();
mwxvtkmpr3Dview->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer);
notebook->AddPage(controlPanelMPR3D, _T("Planes") );
// Second Tab
- controlPanelClippingSurf3D = mwxvtkclipping3Dview->CreateSurfControlPanel(notebook);
+ controlPanelClippingSurf3D = mwxvtkclipping3Dview->CreateSurfControlPanel(notebook);
notebook->AddPage(controlPanelClippingSurf3D, _T("Surface") );
-
+
//Third tab
//RaC 03-2010 Moving the volume functionnality to other tab. The changes were realized only in the wxVtkClipping3DViewCntrlPanel class
controlPanelClippingVol3D = mwxvtkclipping3Dview->CreateVolControlPanel(notebook);
panelClipping3D->SplitHorizontally( notebook , window3D , 10 );
//panelClipping3D->SetMinimumPaneSize( 15 );
- panelClipping3D->SetMinimumPaneSize( 70 ); // JPR
-
+ panelClipping3D->SetMinimumPaneSize( 70 ); // JPR
+
/* EED 04 / Febrary / 2010
- panelControl = new wxPanel(panelClipping3D,-1);
+ panelControl = new wxPanel(panelClipping3D,-1);
controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, false);
controlPanelClipping3D = mwxvtkclipping3Dview->CreateControlPanel(panelControl);
// mbtnCutImageData = new wxCheckBox(panelControl,-1,_T("Cut Module"));
panelClipping3D -> SetMinimumPaneSize( 5 );
*/
wxwindow=panelClipping3D;
-
+
} else if (type==6) {
panelClipping3D = new wxSplitterWindow( panel , -1);
mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panelClipping3D );
mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
- vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
-
+ vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
+
wxWindow *window3D = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
- wxPanel *panelControl = new wxPanel(panelClipping3D,-1);
- wxPanel *controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, false);
+ wxPanel *panelControl = new wxPanel(panelClipping3D,-1);
+ wxPanel *controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, true);
wxFlexGridSizer *sizerCtrol = new wxFlexGridSizer(1);
sizerCtrol->Add(controlPanelMPR3D, 1, wxALL|wxEXPAND, 2);
panelClipping3D->SplitHorizontally( panelControl , window3D , 10 );
wxwindow=panelClipping3D;
- vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata);
+ vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata);
//vtkmpr3Ddataviewer->Configure();
mwxvtkmpr3Dview->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer);
-
+
}else if (type==7)
{
- mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panel );
+ mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panel );
wxwindow = (wxWindow*) mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
}
sizer = new wxBoxSizer(wxVERTICAL);
- sizer->Add( wxwindow, 1, wxGROW);
+ sizer->Add( wxwindow, 1, wxGROW);
panel->SetSizer(sizer);
panel->SetAutoLayout(true);
sizer->Layout();
if (minternalVtkmprbasedata==true)
{
if (mvtkmprbasedata) { delete mvtkmprbasedata;}
- }
+ }
if (mvtk2Dbaseview) { delete mvtk2Dbaseview; }
if (mvtkmpr2Dview_X) { delete mvtkmpr2Dview_X;}
ext[5]=0;
*/
int ext[] = {0, 0, 0, 0, 0, 0}; //JPR
-
+
/*double org[3],spc[3];
org[0]=0;
org[1]=0;
/*
x = mvtkmprbasedata->GetMaxPositionX()/2;
y = mvtkmprbasedata->GetMaxPositionY()/2;
- z = mvtkmprbasedata->GetMaxPositionZ()/2;
- */
+ z = mvtkmprbasedata->GetMaxPositionZ()/2;
+ */
if(mvtkmprbasedata->GetImageData() != NULL)
{
mvtkmprbasedata->SetZ( 0 );
}
}
-
+
if ( mvtk2Dbaseview !=NULL ) { mvtk2Dbaseview->Configure(); }
if ( mvtkmpr2Dview_X !=NULL ) { mvtkmpr2Dview_X->Configure(); }
if ( mvtkmpr2Dview_Y !=NULL ) { mvtkmpr2Dview_Y->Configure(); }
if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetActiveLink(true); }
if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetMesureScale( 1 ); }
if ( mwxsphereview !=NULL ) { mwxsphereview->Configure(); }
-
- if (mwxvtk3Dbaseview_Clipping3D !=NULL)
+ if (mwxvtk3Dbaseview_Clipping3D !=NULL)
{
- mwxvtk3Dbaseview_Clipping3D->Configure();
+ mwxvtk3Dbaseview_Clipping3D->Configure();
}
if (vtkmpr3Ddataviewer !=NULL)
- {
- vtkmpr3Ddataviewer->Configure();
+ {
+ vtkmpr3Ddataviewer->Configure();
}
-
-
if (mwxvtkmpr3Dview !=NULL)
- {
-
+ {
mwxvtkmpr3Dview->Configure();
mwxvtkmpr3Dview->ResetCamera(ext,org,spc);
}
- if (mwxvtkclipping3Dview !=NULL)
- {
- mwxvtkclipping3Dview->Configure();
+ if (mwxvtkclipping3Dview !=NULL)
+ {
+ mwxvtkclipping3Dview->Configure();
}
-
- if (mwxvtkclipping3Dview !=NULL) { mwxvtkclipping3Dview->Configure(); }
-
//if(vtkmpr3Ddataviewer!=NULL){vtkmpr3Ddataviewer->Configure();}
// RefreshView();
//if (mwxvtkmpr3Dview !=NULL) {
// mwxvtkmpr3Dview->ResetCamera();
//}
+
}
//-------------------------------------------------------------------------
wxVtkBaseView *wxMaracas_ViewerWidget::GetwxVtkBaseView()
{
wxVtkBaseView *wxvtkbaseview=NULL;
- if (mvtk2Dbaseview!=NULL){
- wxvtkbaseview = mvtk2Dbaseview;
+ if (mvtk2Dbaseview!=NULL){
+ wxvtkbaseview = mvtk2Dbaseview;
}
- if (mvtkmpr2Dview_X!=NULL){
+ if (mvtkmpr2Dview_X!=NULL){
wxvtkbaseview = mvtkmpr2Dview_X;
}
- if (mvtkmpr2Dview_Y!=NULL){
+ if (mvtkmpr2Dview_Y!=NULL){
wxvtkbaseview = mvtkmpr2Dview_Y;
}
- if (mvtkmpr2Dview_Z!=NULL){
- wxvtkbaseview = mvtkmpr2Dview_Z;
+ if (mvtkmpr2Dview_Z!=NULL){
+ wxvtkbaseview = mvtkmpr2Dview_Z;
}
if (mvtkplane2Dview!=NULL){
- wxvtkbaseview = mvtkplane2Dview;
+ wxvtkbaseview = mvtkplane2Dview;
}
- if (mwxsphereview!=NULL){
+ if (mwxsphereview!=NULL){
wxvtkbaseview = mwxsphereview;
}
- if (mwxvtk3Dbaseview_Clipping3D!=NULL){
+ if (mwxvtk3Dbaseview_Clipping3D!=NULL){
wxvtkbaseview = mwxvtk3Dbaseview_Clipping3D;
}
return wxvtkbaseview ;
// return mvtk2Dbaseview->GetVtkBaseData()->GetZ();
}
- void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
+ void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
if(mvtkmpr2Dview_X!=NULL){
mvtkmpr2Dview_X->setColorTransferFunction(colortable);
}
{
_wxvtk3Dbaseview = wxvtk3Dbaseview;
_vtkmpr3Ddataviewer = NULL;
- _wxvtkmpr3DviewCntrlPanel = NULL;
+ _wxvtkmpr3DviewCntrlPanel = NULL;
//_myCallback = NULL;
_pointWidget = NULL;
_planeWidget = NULL;
_vtkplane = NULL;
_probe = NULL;
_contourMapper = NULL;
-
+
_planeWidgetX = 0;
_planeWidgetY = 0;
_planeWidgetZ = 0;
//EED Fev 3 2010
- //Free Planes
+ //Free Planes
}
{
VisiblePointWidget( false );
VisiblePlaneWidget( false );
-
+
if(_pointWidget!=NULL){
_pointWidget->Delete();
}
if(_planeWidget!=NULL){
_planeWidget->Delete();
}
-
+
if(_vtkplane!=NULL){
- _vtkplane->Delete();
+ _vtkplane->Delete();
_probe->Delete();
- _contourMapper->Delete();
- _contourPlaneActor->Delete();
+ _contourMapper->Delete();
+ _contourPlaneActor->Delete();
}
-
+
}
//-------------------------------------------------------------------
void wxVtkMPR3DView::RemoveActor(vtkActor* actor)
-{
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor);
+{
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor);
}
//-------------------------------------------------------------------
void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc)
{
if(ext == NULL){
- _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
- _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
+ _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
+ _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
}else{
- /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
+ /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
double y = (spc[1])*(origin[1]+(double)ext[3]);
double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
/*double x0=(spc[0])*((double)ext[0]+origin[0]);
double y1=(spc[1])*((double)ext[3]);
double z0=(spc[2])*((double)ext[4]);
double z1=(spc[2])*((double)ext[5]);
-
+
_wxvtk3Dbaseview->GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
//_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
- _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
+ _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
}
}
//-------------------------------------------------------------------
-void wxVtkMPR3DView::Configure(){
-
-
+void wxVtkMPR3DView::Configure()
+{
vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
_wxvtk3Dbaseview->Configure();
_wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
-
-//EED 27 Mai 2009
-// _wxvtk3Dbaseview->GetRenderer()->Clear();
-
- // Actors are added to the renderer.
+
+//EED 27 Mai 2009
+// _wxvtk3Dbaseview->GetRenderer()->Clear();
+
+ // Actors are added to the renderer.
vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital
// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial
// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal
- // An initial camera view is created. The Dolly() method moves
- // the camera towards the FocalPoint, thereby enlarging the image.
+ // An initial camera view is created. The Dolly() method moves
+ // the camera towards the FocalPoint, thereby enlarging the image.
_wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
this->ResetCamera();
-
+
// Set a background color for the renderer and set the size of the
// render window (expressed in pixels).
_wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 );
- _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
+//EED 23oct2010 _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
// Note that when camera movement occurs (as it does in the Dolly()
// method), the clipping planes often need adjusting. Clipping planes
- // consist of two planes: near and far along the view direction. The
+ // consist of two planes: near and far along the view direction. The
// near plane clips out objects in front of the plane; the far plane
// clips out objects behind the plane. This way only what is drawn
// between the planes is actually rendered.
//}
vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New();
_myCallback->SetWxVtkMPR3DView(this);
-
-
+
+
if(imageData){
if(_pointWidget==NULL){
_pointWidget = vtkPointWidget::New();
}
_pointWidget->SetInput( imageData );
_myCallback->SetVtkPointWidget(_pointWidget);
- _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
+ _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
_pointWidget->AllOff();
_pointWidget->PlaceWidget();
-
+
_pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
-
-
+
if(_planeWidget==NULL)
{
_planeWidget = vtkPlaneWidget::New();
}
_planeWidget->SetInput( imageData );
-
+
_myCallback->SetVtkPlaneWidget(_planeWidget);
_planeWidget->NormalToXAxisOn();
_planeWidget->SetResolution(50);
_planeWidget->SetRepresentationToOutline();
-
+
int dim[3];
-
+
imageData->GetDimensions(dim);
int px=(dim[0]/2);
int py=(dim[1]/2);
int pz=(dim[2]/2);
int dd=20;
_planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd );
-
+
if(_vtkplane==NULL){
_vtkplane = vtkPolyData::New();
-
+
_probe = vtkProbeFilter::New();
_probe->SetInput(_vtkplane);
_contourMapper = vtkPolyDataMapper::New();
-
+
_contourMapper->SetInput( _probe->GetPolyDataOutput() );
_contourPlaneActor = vtkActor::New();
_planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
_planeWidget->Off();
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );
}
_planeWidget->GetPolyData(_vtkplane);
_probe->SetSource( imageData );
_contourMapper->SetScalarRange( imageData->GetScalarRange() );
-
-
+
+
ConfigureFreePlanes();
}
-
-// _pointWidget->SetPosition( x,y,z );
-
+
+// _pointWidget->SetPosition( x,y,z );
+
//EED01 29Mars2009
-// MACOS probleme vtk-window out of wx-window
+// MACOS probleme vtk-window out of wx-window
// _pointWidget->On();
-
-
-
// PlaneWidget
-
-
-
-
-
-
-
-
}
//-------------------------------------------------------------------
vtkCellPicker* picker = vtkCellPicker::New();
picker->SetTolerance(0.005);
- // The 3 image plane widgets
+ // The 3 image plane widgets
_planeWidgetX = GetPlaneWidget('x', 1, 0, 0, picker);
_planeWidgetY = GetPlaneWidget('y', 1, 1, 0, picker);
- _planeWidgetZ = GetPlaneWidget('z', 0, 0, 1, picker);
-
+ _planeWidgetZ = GetPlaneWidget('z', 0, 0, 1, picker);
+
_planeWidgetY->SetLookupTable(_planeWidgetX->GetLookupTable());
_planeWidgetZ->SetLookupTable(_planeWidgetX->GetLookupTable());
-
+
picker->UnRegister(NULL);
-
+
}
//-------------------------------------------------------------------
vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker)
{
- vtkProperty* prop1 = 0;
+ vtkProperty* prop1 = 0;
vtkImagePlaneWidget* planeWidget = 0;
planeWidget = vtkImagePlaneWidget::New();
- planeWidget->EnabledOff();
planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
+ planeWidget->EnabledOff();
vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
int xMin = 0, xMax = 0, yMin = 0, yMax = 0, zMin = 0, zMax = 0;
double xSpacing = 0, ySpacing = 0, zSpacing = 0;
if(image){
planeWidget->SetInput( image );
- image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax);
+ image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax);
image->GetSpacing(xSpacing, ySpacing, zSpacing);
}
-
-
-
-
-
if (activationkey=='x')
{
- planeWidget->SetPlaneOrientationToXAxes();
+ planeWidget->SetPlaneOrientationToXAxes();
planeWidget->SetSlicePosition((xMax+xMin)/2.*xSpacing);
}
-
+
if (activationkey=='y')
{
planeWidget->SetPlaneOrientationToYAxes();
planeWidget->SetSlicePosition((yMax+yMin)/2.*ySpacing);
}
-
+
if (activationkey=='z')
{
planeWidget->SetPlaneOrientationToZAxes();
planeWidget->SetSlicePosition((zMax+zMin)/2.*zSpacing);
}
-
+
planeWidget->DisplayTextOn();
planeWidget->SetPicker(picker);
planeWidget->SetKeyPressActivationValue(activationkey);
//-------------------------------------------------------------------
void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortable)
{
- GetVtkMPR3DDataViewer ()->setColorTransferFunction(colortable);
+ GetVtkMPR3DDataViewer ()->setColorTransferFunction(colortable);
}
//-------------------------------------------------------------------
{
double spc[3];
vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
+
if(image){
image->GetSpacing(spc);
}else{
z=z*spc[2];
if(_pointWidget){
- _pointWidget->SetPosition( x,y,z );
+ _pointWidget->SetPosition( x,y,z );
- double in[3];
+ double in[3];
double normal[3];
vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
in[0]=1; in[1]=0; in[2]=0;
return _wxvtkmpr3DviewCntrlPanel;
}
//-------------------------------------------------------------------
-vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer()
+vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer()
{
- return _vtkmpr3Ddataviewer;
+ return _vtkmpr3Ddataviewer;
}
//-------------------------------------------------------------------
wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
*/
if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
if (visible==false){
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
} else {
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
}
_vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible);
}
vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
if(value == true)
{
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
}
else
{
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor );
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor );
}
}
//-------------------------------------------------------------------
void wxVtkMPR3DView::InitOrientationPointWidget()
{
- this->_planeWidget->SetNormal(1,0,0);
+ this->_planeWidget->SetNormal(1,0,0);
}
stPoints -> Update();
vtkImageChangeInformation *change = vtkImageChangeInformation ::New();
- change -> SetInput( stPoints );
+ change -> SetInput( stPoints );
change -> Update(); //important
double _range[2];
_bwlookup->SetValueRange( 0 , 1 );
_bwlookup->SetAlphaRange( 1 , 1 );
_bwlookup->Build( );
-
+
vtkLookupTable * _collookup = vtkLookupTable::New( );
_collookup->SetNumberOfColors( 256 );
_collookup->SetTableRange( 0 , 255 );
renderer->SetActiveCamera(camera);
renderer->ResetCamera();
renderer->SetBackground(1,1,1);
-
+
renWin->SetSize(300,300);
// interact with data
vtkPlane *slicePlane = vtkPlane::New();
this->_planeWidget->GetPlane( slicePlane );
-
+
vtkCutter* sliceCutter = vtkCutter::New();
vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
sliceCutter->SetInput( vtkimagedata );
contourMapper->SetScalarRange( range );
// contourMapper->SetLookupTable( lut );
-
+
vtkActor *contourActor = vtkActor::New();
contourActor->SetMapper( contourMapper );
renderer->SetActiveCamera(camera);
renderer->ResetCamera();
renderer->SetBackground(1,1,1);
-
+
renWin->SetSize(300,300);
// interact with data