_mwxwidget->setColorTransferFunction(bbGetInputColorFunction());
}
- if(bbGetInputWindowLevel()!=-1)
- {
- _mwxwidget->setWindowLevel(bbGetInputWindowLevel());
- }
- if(bbGetInputColorLevel()!=-1)
+ if( (bbGetInputColorLevel()!=-1) && (bbGetInputWindowLevel()!=-1))
{
if(bbGetInputColorLevel() == 0)
{
- std::cout<<"colorlevel "<<bbGetInputColorLevel()<<std::endl;
- _mwxwidget->setColorLevel(0.1);
+ _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , 0.1 );
}else{
- _mwxwidget->setColorLevel(bbGetInputColorLevel());
+ _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , bbGetInputColorLevel() );
}
}
}// mwxwidget != NULL
#include "volumerendererdata.h"
#include "vtkObjectFactory.h"
-vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.9 $");
+vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.10 $");
vtkStandardNewMacro(VolumeRendererData);
VolumeRendererData::VolumeRendererData()
void VolumeRendererData::ShowVolume(bool checked){
- printf("EED VolumeRendererData::ShowVolume 1 \n");
try{
- printf("EED VolumeRendererData::ShowVolume 2 \n");
if(checked){
- printf("EED VolumeRendererData::ShowVolume 3 \n");
invariant();
- printf("EED VolumeRendererData::ShowVolume 4 \n");
- cout<<"JPRG::VolumeRendererData::ShowVolume"<<endl;
if(!VolRendManager){
VolRendManager = new VolumeRendererManager();
VolRendManager->addVolume(ImageData, Interactor);
}
-void VolumeRendererData::invariant(){
- if(!ImageData){
+void VolumeRendererData::invariant()
+{
+ if(!ImageData)
+ {
throw "Image data not set";
}
- if(!Renderer){
+ if(!Renderer)
+ {
throw "renderer not initialized";
}
}
-void VolumeRendererData::OpacityChanged(vector<double> greyvalues, vector<double> values){
+void VolumeRendererData::OpacityChanged(vector<double> greyvalues, vector<double> values)
+{
//invariant();
-
-
- printf("EED VolumeRendererData::OpacityChanged 1\n");
- if(VolRendManager==NULL)
- {
- printf("EED VolumeRendererData::OpacityChanged 2\n");
- } else{
+ if(VolRendManager!=NULL)
+ {
ShowVolume(true);
- printf("EED VolumeRendererData::OpacityChanged 3\n");
VolRendManager->setVolumeOpacity(greyvalues,values);
- }
-
- printf("EED VolumeRendererData::OpacityChanged 4\n");
+ }
}
+
void VolumeRendererData::BoundingBoxChanged(bool checked){
// invariant();
VolRendManager->DisableBoundingBox();
}
}
+
}
+
void VolumeRendererData::changeCompositeMIPFunction(int function){
invariant();
if(VolRendManager)
+ {
VolRendManager->changeCompositeMIPFunction(0, function);
+ }
}
/**
void VolumeRendererData::changeInterpolationType(int type){
invariant();
if(VolRendManager)
+ {
VolRendManager->changeInterpolationType(type);
+ }
}
bool manualInteractorWindowLevel::OnMouseMove() // virtual
{
-
if (_stateWindowLevel==true)
{
int tmpPx,tmpPy;
{
colorWin=100000;
}
-
- if (colorLev<0)
- {
- colorLev=0;
- }
+
+//EED 2 Nov 2012 This lets see negative values with the interaction of Window-Level Color
+// if (colorLev<0)
+// {
+// colorLev=0;
+// }
+
if (colorLev>100000)
{
colorLev=100000;
}
- vtkImageViewer2 *vtkimageviewer2;
- vtkimageviewer2=((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2();
- vtkimageviewer2->SetColorWindow(colorWin);
- vtkimageviewer2->SetColorLevel(colorLev);
+
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ vtkBaseData *vtkbasedata = wxvtk2Dbaseview->GetVtkBaseData();
+
+//EED Borrame
+// vtkImageViewer2 *vtkimageviewer2 = wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
+// vtkimageviewer2->SetColorWindow(colorWin);
+// vtkimageviewer2->SetColorLevel(colorLev);
+
+ vtkbasedata->SetColorWindow(colorWin);
+ vtkbasedata->SetColorLevel(colorLev);
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+
// vtkimageviewer2->Render();
}
return true;
//-------------------------------------------------------------------
vtkImageData* vtkBaseData::GetImageData()
{
- if(_marImageData){
+ if(_marImageData)
+ {
return _marImageData->GetImageDataT(_t);
}else{
return 0;
void vtkBaseData::Configure() // virtual
{
+ vtkImageData* imageData = _marImageData->GetImageData();
+ if(imageData !=NULL)
+ {
+ double range[2];
+ imageData->GetScalarRange(range);
+ if (range[1]<20000){
+ //EED Borrame
+ //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( (range[1]-range[0])/2 );
+ //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( (range[1]+range[0])/4 );
+ SetColorWindow( (range[1]-range[0])/2 );
+ SetColorLevel( (range[1]+range[0])/4 );
+ } else {
+ //EED Borrame
+ //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
+ //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
+ SetColorWindow( 1000 );
+ SetColorLevel( 500 );
+
+ } // range
+ } // img
}
//-------------------------------------------------------------------
_z=z;
}
}
+
//-------------------------------------------------------------------
double vtkBaseData::GetZ()
{
return _z;
}
+
//-------------------------------------------------------------------
int vtkBaseData::GetT()
{
return _t;
}
+
//-------------------------------------------------------------------
void vtkBaseData::SetT(double t)
{
_t=(int)t;
}
+//-------------------------------------------------------------------
+void vtkBaseData::SetColorWindow(double colorWindow)
+{
+ _colorWindow = colorWindow;
+}
+
+//-------------------------------------------------------------------
+void vtkBaseData::SetColorLevel(double colorLevel)
+{
+ _colorLevel=colorLevel;
+}
+
+//-------------------------------------------------------------------
+double vtkBaseData::GetColorWindow()
+{
+ return _colorWindow;
+}
+
+//-------------------------------------------------------------------
+double vtkBaseData::GetColorLevel()
+{
+ return _colorLevel;
+}
+
int GetT();
void SetT(double t);
-
+
+ void SetColorWindow(double colorWindow);
+ void SetColorLevel(double colorLevel);
+ double GetColorWindow();
+ double GetColorLevel();
+
protected:
marImageData *_marImageData;
double _z;
int _t;
+
+ double _colorWindow;
+ double _colorLevel;
};
#endif /*VTKBASEDATA_H_*/
{
// Volume
-
-
/** if(_newvol != NULL)
{
_newvol->Delete();
_volumeProperty->Delete();
}*/
-
-
_tfun = vtkPiecewiseFunction::New();
_ctfun = vtkColorTransferFunction::New();
this->_vtkmprbasedata->GetImageData()->GetScalarRange(range);
double max = range[1];
- printf("EED::vtkClipping3DDataViewer::Configure_Volume max=%f \n",max);
-
/*
adding the poinst of the transference function
*/
// EED 13/03/2011
-
-
// _volumeMapper = vtkVolumeRayCastMapper::New();
_volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
-
-
_volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
-
// _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
-
+
//
-
_volumeMapper->SetClippingPlanes( _volumePlanes );
_volumeMapper->AutoAdjustSampleDistancesOn();
_volumeProperty->SetScalarOpacity( _tfun );
// EED 31/03/2008
-
_volumeProperty->DisableGradientOpacityOn();
-
-// _
-
-
-// _
-
-
// _volumeProperty->SetInterpolationTypeToNearest();
// _volumeProperty->ShadeOff();
// _volumeProperty->SetAmbient(0.3);
_newvol->SetMapper(_volumeMapper );
_newvol->SetProperty(_volumeProperty );
- _observerV = boxSurfaceObserver::New();
+ _observerV = boxSurfaceObserver::New();
_observerV->SetPlanes( _volumePlanes );
_observerV->SetActor( _newvol );
_observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
void vtkClipping3DDataViewer::Configure_VolumeBox()
{
- cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() start"<<endl;
-
_volumerendererdata->SetImageData(_vtkmprbasedata->GetImageData());
vector<double> *gv = this->GetGreyValuesTransferenceFVector();
vector<double> *op = this->GetIntensityValuesTransferenceFVector();
- printf("EED::vtkClipping3DDataViewer::Configure_VolumeBox _ctfun=%p \n",_ctfun);
-
-
_volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun));
_volumerendererdata->OpacityChanged(*gv, *op);
//_wxvtkclipping3Dview->VisibleVolumeActor( false );
//_volumerendererdata->ShowVolume(event.IsChecked() );
//_volumerendererdata->BoundingBoxChanged(event.IsChecked() );
-
- cout<<"EED::JPRG::vtkClipping3DDataViewer::Configure_VolumeBox() end"<<endl;
}
void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer)
double range[2];
- double max;
+ double delta;
- if(_vtkmprbasedata->GetImageData()){
+ if(_vtkmprbasedata->GetImageData())
+ {
_vtkmprbasedata->GetImageData()->GetScalarRange(range);
- max = range[1];
+ delta = range[1]-range[0];
_ctFunVectorPoint.clear();
- _ctFunVectorPoint.push_back(max*0/4);
- _ctFunVectorPoint.push_back(max*1/4);
- _ctFunVectorPoint.push_back(max*2/4);
- _ctFunVectorPoint.push_back(max*3/4);
- _ctFunVectorPoint.push_back(max*4/4);
+ _ctFunVectorPoint.push_back( range[0] + delta*0/4 );
+ _ctFunVectorPoint.push_back( range[0] + delta*1/4 );
+ _ctFunVectorPoint.push_back( range[0] + delta*2/4 );
+ _ctFunVectorPoint.push_back( range[0] + delta*3/4 );
+ _ctFunVectorPoint.push_back( range[0] + delta*4/4 );
_ctFunVectorRed.clear();
_ctFunVectorRed.push_back(0.0);
_ctFunVectorBlue.push_back(0.0);
- if(_ctfun==NULL){
+ if(_ctfun==NULL)
+ {
_ctfun = vtkColorTransferFunction::New();
}
_ctfun->RemoveAllPoints();
void vtkMPR3DDataViewer::SetPositionX(int pos){
int x1,x2,y1,y2,z1,z2;
_vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
- if(_saggital){
+ if(_saggital)
+ {
_saggital->SetDisplayExtent( pos , pos , y1 ,y2 , z1 , z2 );
}
}
void vtkMPR3DDataViewer::SetPositionY(int pos){
int x1,x2,y1,y2,z1,z2;
_vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
- if(_coronal){
+ if(_coronal)
+ {
_coronal->SetDisplayExtent(x1,x2, pos,pos, z1,z2);
}
}
void vtkMPR3DDataViewer::SetPositionZ(int pos){
int x1,x2,y1,y2,z1,z2;
_vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
- if(_axial){
+ if(_axial)
+ {
_axial->SetDisplayExtent(x1,x2, y1,y2, pos,pos);
}
}
}
void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
- if(_saggitalColors){
+ if(_saggitalColors)
+ {
_saggitalColors->SetLookupTable(colortable);
_coronalColors->SetLookupTable(colortable);
_axialColors->SetLookupTable(colortable);
_transformOrientation = NULL;
_marImageData = NULL;
}
+
//-------------------------------------------------------------------
vtkMPRBaseData::~vtkMPRBaseData()
{
if (_marImageData) delete _marImageData;
if (_transformOrientation) _transformOrientation ->Delete();
}
+
//-------------------------------------------------------------------
void vtkMPRBaseData::Configure()
{
+ //EED 03nov2012
+ vtkBaseData::Configure();
+
vtkImageData* img = _marImageData->GetImageData();
- if(img !=NULL){
+ if(img !=NULL)
+ {
img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
- //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
-
+ //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
}
- if(_transformOrientation==NULL){
+
+ if(_transformOrientation==NULL)
+ {
_transformOrientation=vtkTransform::New();
}
+
_transformOrientation->Identity();
}
+
//-------------------------------------------------------------------
void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2)
{
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
Language: C++
- Date: $Date: 2012/10/11 10:45:16 $
- Version: $Revision: 1.22 $
+ Date: $Date: 2012/11/14 07:30:52 $
+ Version: $Revision: 1.23 $
Copyright: (c) 2002, 2003
License:
// return wxwindow1->GetZ();
}
-void wxMaracas_N_ViewersWidget :: invariant(){
- if(mvtkmprbasedata == 0){
+//-----------------------------------------------------------------------------------
+void wxMaracas_N_ViewersWidget :: invariant()
+{
+ if(mvtkmprbasedata == 0)
+ {
throw "The image has not been set in the viewer";
}
}
-void wxMaracas_N_ViewersWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
- if (wxwindow1!=NULL) {
+//-----------------------------------------------------------------------------------
+void wxMaracas_N_ViewersWidget::setColorTransferFunction(vtkColorTransferFunction* colortable)
+{
+ if (wxwindow1!=NULL)
+ {
wxwindow1->setColorTransferFunction(colortable);
}
- if (wxwindow2!=NULL) {
+
+ if (wxwindow2!=NULL)
+ {
wxwindow2->setColorTransferFunction(colortable);
}
- if (wxwindow3!=NULL) {
+
+ if (wxwindow3!=NULL)
+ {
wxwindow3->setColorTransferFunction(colortable);
}
- if (wxwindow4!=NULL) {
+
+ if (wxwindow4!=NULL)
+ {
wxwindow4->setColorTransferFunction(colortable);
}
}
-void wxMaracas_N_ViewersWidget::setWindowLevel(double level){
- if (wxwindow1!=NULL) {
- wxwindow1->setWindowLevel(level);
- }
- if (wxwindow2!=NULL) {
- wxwindow2->setWindowLevel(level);
- }
- if (wxwindow3!=NULL) {
- wxwindow3->setWindowLevel(level);
- }
- if (wxwindow4!=NULL) {
- wxwindow4->setWindowLevel(level);
- }
-}
-void wxMaracas_N_ViewersWidget::setColorLevel(double level){
- if (wxwindow1!=NULL) {
- wxwindow1->setColorLevel(level);
+//-----------------------------------------------------------------------------------
+void wxMaracas_N_ViewersWidget::SetColorWindowLevel(double colorWindow, double colorLevel)
+{
+ if (wxwindow1!=NULL)
+ {
+ wxwindow1->SetColorWindowLevel(colorWindow, colorLevel);
}
- if (wxwindow2!=NULL) {
- wxwindow2->setColorLevel(level);
+
+ if (wxwindow2!=NULL)
+ {
+ wxwindow2->SetColorWindowLevel(colorWindow, colorLevel);
}
- if (wxwindow3!=NULL) {
- wxwindow3->setColorLevel(level);
+
+ if (wxwindow3!=NULL)
+ {
+ wxwindow3->SetColorWindowLevel(colorWindow, colorLevel);
}
- if (wxwindow4!=NULL) {
- wxwindow4->setColorLevel(level);
+
+ if (wxwindow4!=NULL)
+ {
+ wxwindow4->SetColorWindowLevel(colorWindow, colorLevel);
}
+ RefreshView();
}
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.h,v $
Language: C++
- Date: $Date: 2010/10/23 12:01:32 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2012/11/14 07:30:52 $
+ Version: $Revision: 1.13 $
Copyright: (c) 2002, 2003
License:
double GetZ();
void setColorTransferFunction(vtkColorTransferFunction* colortable);
-
- void setWindowLevel(double level);
- void setColorLevel(double level);
+ void SetColorWindowLevel(double colorWindow, double colorLevel);
//------------------------------------------------------------------------------------------------------------
// Attributes
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $
Language: C++
- Date: $Date: 2012/10/11 10:45:16 $
- Version: $Revision: 1.36 $
+ Date: $Date: 2012/11/14 07:30:52 $
+ Version: $Revision: 1.37 $
Copyright: (c) 2002, 2003
License:
if (mvtkmprbasedata!=NULL)
{
mvtkmprbasedata->Configure();
- /*
- x = mvtkmprbasedata->GetMaxPositionX()/2;
- y = mvtkmprbasedata->GetMaxPositionY()/2;
- z = mvtkmprbasedata->GetMaxPositionZ()/2;
- */
if(mvtkmprbasedata->GetImageData() != NULL)
{
}
- //-------------------------------------------------------------------------
-
- void wxMaracas_ViewerWidget::Refresh(bool eraseBackground ,const wxRect* rect ) // virtual eraseBackground=true , rect=NULL
- {
- wxPanel::Refresh(false);
- }
+//-------------------------------------------------------------------------
+void wxMaracas_ViewerWidget::Refresh(bool eraseBackground ,const wxRect* rect ) // virtual eraseBackground=true , rect=NULL
+{
+ wxPanel::Refresh(false);
+}
//-------------------------------------------------------------------------
void wxMaracas_ViewerWidget::RefreshView()
// return mvtk2Dbaseview->GetVtkBaseData()->GetZ();
}
- void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
- if(mvtkmpr2Dview_X!=NULL){
- mvtkmpr2Dview_X->setColorTransferFunction(colortable);
- }
- if(mvtkmpr2Dview_Y!=NULL){
- mvtkmpr2Dview_Y->setColorTransferFunction(colortable);
- }
- if(mvtkmpr2Dview_Z!=NULL){
- mvtkmpr2Dview_Z->setColorTransferFunction(colortable);
- }
- if(mwxvtkmpr3Dview!=NULL){
- mwxvtkmpr3Dview->setColorTransferFunction(colortable);
- }
+//-------------------------------------------------------------------------------------------
+void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable)
+{
+ if(mvtkmpr2Dview_X!=NULL)
+ {
+ mvtkmpr2Dview_X->setColorTransferFunction(colortable);
}
-
- void wxMaracas_ViewerWidget::setWindowLevel(double level){
- if(mvtkmpr2Dview_X!=NULL){
- mvtkmpr2Dview_X->setWindowLevel(level);
- }
- if(mvtkmpr2Dview_Y!=NULL){
- mvtkmpr2Dview_Y->setWindowLevel(level);
- }
- if(mvtkmpr2Dview_Z!=NULL){
- mvtkmpr2Dview_Z->setWindowLevel(level);
- }
- /*if(mwxvtkmpr3Dview!=NULL){
- mwxvtkmpr3Dview->setWindowLevel(level);
- }*/
+
+ if(mvtkmpr2Dview_Y!=NULL)
+ {
+ mvtkmpr2Dview_Y->setColorTransferFunction(colortable);
+ }
+
+ if(mvtkmpr2Dview_Z!=NULL)
+ {
+ mvtkmpr2Dview_Z->setColorTransferFunction(colortable);
+ }
+
+ if(mwxvtkmpr3Dview!=NULL)
+ {
+ mwxvtkmpr3Dview->setColorTransferFunction(colortable);
}
+}
+
+//-------------------------------------------------------------------------------------------
+void wxMaracas_ViewerWidget::SetColorWindowLevel(double colorWindow, double colorLevel)
+{
+ mvtkmprbasedata->SetColorWindow(colorWindow);
+ mvtkmprbasedata->SetColorLevel(colorLevel);
+//EED Borrame
+/*
+ RefreshView();
+ if(mvtk2Dbaseview!=NULL)
+ {
+ mvtk2Dbaseview->SetColorWindow(level);
+ }
+
+ if(mvtkmpr2Dview_X!=NULL)
+ {
+ mvtkmpr2Dview_X->SetColorWindow(level);
+ }
+
+ if(mvtkmpr2Dview_Y!=NULL)
+ {
+ mvtkmpr2Dview_Y->SetColorWindow(level);
+ }
+
+ if(mvtkmpr2Dview_Z!=NULL)
+ {
+ mvtkmpr2Dview_Z->SetColorWindow(level);
+ }
+
+ if(mwxvtkmpr3Dview!=NULL)
+ {
+ mwxvtkmpr3Dview->SetColorWindow(level);
+ }
+ */
+}
+
+
- void wxMaracas_ViewerWidget::setColorLevel(double level){
- if(mvtkmpr2Dview_X!=NULL){
- mvtkmpr2Dview_X->setColorLevel(level);
- }
- if(mvtkmpr2Dview_Y!=NULL){
- mvtkmpr2Dview_Y->setColorLevel(level);
- }
- if(mvtkmpr2Dview_Z!=NULL){
- mvtkmpr2Dview_Z->setColorLevel(level);
- }
- /*if(mwxvtkmpr3Dview!=NULL){
- mwxvtkmpr3Dview->setColorLevel(level);
- }*/
- }
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.h,v $
Language: C++
- Date: $Date: 2011/06/29 09:37:52 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2012/11/14 07:30:52 $
+ Version: $Revision: 1.12 $
Copyright: (c) 2002, 2003
License:
void setColorTransferFunction(vtkColorTransferFunction* colortable);
- void setWindowLevel(double level);
-
- void setColorLevel(double level);
+ void SetColorWindowLevel(double colorWindow, double colorLevel);
+
private:
int mType;
imageData->GetExtent (x1,x2,y1,y2,z1,z2);
SetImageToVtkViewer(imageData);
_imageViewer2XYZ->SetExtentDimension(x1,x2,y1,y2,z1,z2);
+
+/*EED Borrame, now is syncroniced in vtkBaseData for all windows
double range[2];
imageData->GetScalarRange(range);
if (range[1]<20000){
_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
}
+*/
+
// EED 31 Janvier 2007
//vtkImageActor *vtkimageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor ();
//vtkimageactor->InterpolateOff ();
}
//-------------------------------------------------------------------
+void wxVtk2DBaseView::UpdateColorWindowLevel()
+{
+ //EED 24oct2010
+ //EED 02nov2012
+
+// vtkImageViewer2 *vtkimageviewer2 = _imageViewer2XYZ->GetVtkImageViewer2();
+
+
+ vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel();
+ imagemaptowindowlevel->SetWindow( _vtkbasedata->GetColorWindow() );
+ imagemaptowindowlevel->SetLevel( _vtkbasedata->GetColorLevel() );
+
+// EED Borrame
+// vtkimageviewer2->SetColorWindow( _vtkbasedata->GetColorWindow() );
+// vtkimageviewer2->SetColorLevel( _vtkbasedata->GetColorLevel() );
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
+}
+//-------------------------------------------------------------------
void wxVtk2DBaseView::Refresh()
{
- int z = (int)(GetVtkBaseData()->GetZ());
- _imageViewer2XYZ->SetZSlice( z );
-
-//EED 24oct2010
- _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
-
- wxVtkBaseView::Refresh();
+ int z = (int)(GetVtkBaseData()->GetZ());
+ _imageViewer2XYZ->SetZSlice( z );
+ //EED 01nov2012
+ UpdateColorWindowLevel();
+ wxVtkBaseView::Refresh();
}
//-------------------------------------------------------------------
-
void wxVtk2DBaseView::SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview)
{
SetInteractorStyleBaseView(interactorstylebaseview);
{
return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer();
}
+
//---------------------------------------------------------------------------
vtkRenderWindow* wxVtk2DBaseView::GetRenWin() // virtual
{
void wxVtk2DBaseView::GetSpacing(double spc[3]) // virtual
{
vtkImageData *imageData = GetVtkBaseData()->GetImageData();
- if(imageData){
+ if(imageData)
+ {
imageData->GetSpacing(spc);
}else{
spc[0] = 0;
//-------------------------------------------------------------------
void wxVtk2DBaseView::setColorTransferFunction(vtkColorTransferFunction* colortable)
{
- if(_imageViewer2XYZ!=NULL){
+ if(_imageViewer2XYZ!=NULL)
+ {
_imageViewer2XYZ->setColorTransferFunction(colortable);
this->Refresh();
}
}
//-------------------------------------------------------------------
-void wxVtk2DBaseView::setWindowLevel(double level)
+void wxVtk2DBaseView::SetColorWindow(double level)
{
// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow(level);
-
- vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel();
- imagemaptowindowlevel->SetWindow(level);
+ _vtkbasedata->SetColorWindow(level);
this->Refresh();
}
//-------------------------------------------------------------------
-void wxVtk2DBaseView::setColorLevel(double level)
+void wxVtk2DBaseView::SetColorLevel(double level)
{
// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel(level);
- vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel();
- imagemaptowindowlevel->SetLevel(level);
+ _vtkbasedata->SetColorLevel(level);
this->Refresh();
}
void setColorTransferFunction(vtkColorTransferFunction* colortable);
- void setWindowLevel(double level);
-
- void setColorLevel(double level);
+ void SetColorWindow(double level);
+ void SetColorLevel(double level);
+
virtual int GetDirection();
void SetImageToVtkViewer(vtkImageData *imageData);
+
+ //EED 01nov2012
+ void UpdateColorWindowLevel();
private:
void wxVtk3DBaseView::SetStereo(int type)
{
//EED 02/06/2012
- printf("EED wxVtk3DBaseView::SetStereo start\n");
-
+
if (_renWin!=NULL)
{
- printf("EED wxVtk3DBaseView::SetStereo 2\n");
if (type==0)
{
_renWin->SetStereoRender(0); // OFF
} // if type
} // _renWin
- printf("EED wxVtk3DBaseView::SetStereo end\n");
-
}
//-------------------------------------------------------------------
void wxVtk3DBaseView::Configure()
{
- printf("EED wxVtk3DBaseView::Configure A\n");
if (_configure==false)
{
- printf("EED wxVtk3DBaseView::Configure B\n");
_configure=true;
//wxVtkBaseView::Configure();
_aRenderer = vtkRenderer::New();
// between the planes is actually rendered.
_wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange();
- cout<<"EED::JPRG::wxVtkClipping3DView::SetVtkClipping3DDataViewer::GetRenderer()::"<<this->GetWxvtk3Dbaseview()->GetRenderer()<<endl;
- //cout<<"JPRG::wxVtkClipping3DView::SetVtkClipping3DDataViewer::GetWxVTKRenderWindowInteractor()::"<<this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()<<endl;
-
_vtkclipping3Ddataviewer->SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer());
_vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor());
//-------------------------------------------------------------------
void wxVtkMPR2DView::Configure()
{
- printf("EED wxVtkMPR2DView::Configure");
-
wxVtk2DBaseView::Configure();
-
-
int x1,x2,y1,y2,z1,z2;
GetVtkmprbasedata() -> GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-
double spc[3];
vtkImageData* img = GetVtkmprbasedata()->GetImageData();
if(_interactorstylemprview==NULL)
z2 = (int)(z2*spc[2]);
_visibleAxis = true;
-
-
-
}
// Axe A
_ptsA->SetNumberOfPoints(2);
_ptsA->SetPoint(0, -1000 , -1000 , -1000 );
_ptsA->SetPoint(1, 1000 , 1000 , 1000 );
-
_pdA = vtkPolyData::New();
-
_lineAMapper = vtkPolyDataMapper::New();
-
_lineAMapper->SetInput(_pdA);
_lineAMapper->ImmediateModeRenderingOn();
_lineAActor->SetMapper(_lineAMapper);
_lineBActor->GetProperty()->SetLineWidth(0.5);
_lineBMapper = vtkPolyDataMapper::New();
_lineBActor->SetMapper(_lineBMapper);
-
_ptsB = vtkPoints::New();
_ptsB->SetNumberOfPoints(2);
_ptsB->SetPoint(0, -1000 , -1000 , -1000 );
_ptsB->SetPoint(1, 1000 , 1000 , 1000 );
-
// _lineBActor->GetProperty()->BackfaceCullingOn();
}
_pdB->SetPoints( _ptsB );
_pdB->SetLines( linesB );
linesB->Delete(); //do not delete lines ??
-
-
_lineBMapper->SetInput(_pdB);
_lineBMapper->ImmediateModeRenderingOn();
-
-
if(_imageViewer2XYZ){
_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
}
-
}
void wxVtkMPR2DView::SetVisibleAxis(bool ok)
//-------------------------------------------------------------------
void wxVtkMPR2DView::Refresh()
{
-
- printf("wxVtkMPR2DView::Refresh start\n");
-
//wxVtk2DBaseView::Refresh();
-
-
- //vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2(); // JPRx
- //vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); // JPRx
-
-
int x1 = 0,x2 = 0,y1 = 0,y2 = 0,z1 = 0,z2 = 0;
int x = 0, y = 0, z = 0;
int xx = 0, yy = 0, zz = 0;
double xx1,yy1,zz1,xx2,yy2,zz2;
-
- //GetVtkmprbasedata()->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-
-
vtkImageData* img = GetVtkmprbasedata()->GetImageData();
if(img!=NULL){
origin = img->GetOrigin();
_backZ=zz;
}
-//EED 24oct2010
-_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
-
+//EED 01nov2012
+ UpdateColorWindowLevel();
wxVtkBaseView::Refresh();
-
- printf("wxVtkMPR2DView::Refresh end\n");
-
}
}
//-------------------------------------------------------------------
#include "vtkProbeFilter.h"
#include "vtkStructuredPoints.h"
#include "vtkMetaImageWriter.h"
-#include "vtkDataSetMapper.h"
#include "vtkImageChangeInformation.h"
#include "vtkPointData.h"
#include "vtkWindowLevelLookupTable.h"
#include "vtkmyPWCallback_3DPointWidget.h"
#include "vtkProperty.h"
#include "vtkCellPicker.h"
-
+#include "vtkInteractorStyleBaseView.h"
+#include <vtkImageReslice.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
+
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+class vtkWindowLevelImagePlaneWidgetCallback : public vtkCommand
+{
+ public:
+ static vtkWindowLevelImagePlaneWidgetCallback *New()
+ {
+ return new vtkWindowLevelImagePlaneWidgetCallback;
+ }
+
+ void Execute( vtkObject *caller, unsigned long ev, void *callData )
+ {
+ bool needRefresh=false;
+ double slicePosition;
+ vtkImagePlaneWidget* ipw =dynamic_cast< vtkImagePlaneWidget* >( caller );
+ if ( ev == vtkCommand::WindowLevelEvent)
+ {
+ double info[2];
+ ipw->GetWindowLevel(info);
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetColorWindow(info[0]);
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetColorLevel(info[1]);
+ needRefresh=true;
+ } // if ev
+
+ if ( ev == vtkCommand::InteractionEvent)
+ {
+ needRefresh=true;
+ if (ipw->GetCursorDataStatus())
+ {
+ double xyzv[4];
+ ipw->GetCursorData(xyzv);
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX(xyzv[0]);
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY(xyzv[1]);
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ(xyzv[2]);
+ } else {
+
+
+ vtkImageData *image = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ double spc[3];
+ if(image)
+ {
+ image->GetSpacing(spc);
+ }
+
+ double normal[3];
+ slicePosition = ipw->GetSlicePosition();
+ ipw->GetNormal(normal);
+
+ // FreePlaneX
+ if ((normal[0]==1)&&(normal[1]==0)&&(normal[2]==0))
+ {
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( slicePosition/spc[0] );
+ }
+ // FreePlaneY
+ if ((normal[0]==0)&&(normal[1]==1)&&(normal[2]==0))
+ {
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( slicePosition/spc[1] );
+ }
+ // FreePlaneZ
+ if ((normal[0]==0)&&(normal[1]==0)&&(normal[2]==1))
+ {
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( slicePosition/spc[2] );
+ }
+ }// ipw->GetCursorDataStatus
+ }// ev
+
+ if (needRefresh)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
+ isbv->SetParent_refresh_waiting();
+ isbv->EvaluateToRefresh();
+ }
+
+ } // Execute
+
+ vtkWindowLevelImagePlaneWidgetCallback(){}
+ wxVtkMPR3DView *_wxvtkmpr3Dview;
+};
+
+
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+
+
wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview )
{
_wxvtk3Dbaseview = wxvtk3Dbaseview;
_probe = NULL;
_contourMapper = NULL;
- _planeWidgetX = 0;
- _planeWidgetY = 0;
- _planeWidgetZ = 0;
+ _planeWidgetX = NULL;
+ _planeWidgetY = NULL;
+ _planeWidgetZ = NULL;
//EED Fev 3 2010
//Free Planes
}
{
vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
- printf("EED wxMaracas_ViewerWidget::ConfigureVTK \n");
_wxvtk3Dbaseview->Configure();
_wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
_probe->SetSource( imageData );
_contourMapper->SetScalarRange( imageData->GetScalarRange() );
-
ConfigureFreePlanes();
}
picker->UnRegister(NULL);
+ // ColorWindow ColorLevel Callback
+ vtkWindowLevelImagePlaneWidgetCallback *wlipwc = vtkWindowLevelImagePlaneWidgetCallback::New();
+ wlipwc->_wxvtkmpr3Dview = this;
+ _planeWidgetX->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
+ _planeWidgetY->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
+ _planeWidgetZ->AddObserver(vtkCommand::WindowLevelEvent, wlipwc );
+
+ // Cursor Callback
+ _planeWidgetX->AddObserver(vtkCommand::InteractionEvent, wlipwc );
+ _planeWidgetY->AddObserver(vtkCommand::InteractionEvent, wlipwc );
+ _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc );
}
//-------------------------------------------------------------------
vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker)
{
- vtkProperty* prop1 = 0;
- vtkImagePlaneWidget* planeWidget = 0;
- planeWidget = vtkImagePlaneWidget::New();
+ vtkProperty* prop1 = 0;
+ vtkImagePlaneWidget* planeWidget = 0;
+ planeWidget = vtkImagePlaneWidget::New();
planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
planeWidget->EnabledOff();
- vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ 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){
+ if(image)
+ {
planeWidget->SetInput( image );
image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax);
image->GetSpacing(xSpacing, ySpacing, zSpacing);
return planeWidget;
}
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::SetFreePlanesOrtho()
+{
+ _planeWidgetX->SetPlaneOrientationToXAxes();
+ _planeWidgetY->SetPlaneOrientationToYAxes();
+ _planeWidgetZ->SetPlaneOrientationToZAxes();
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
+ isbv->SetParent_refresh_waiting();
+ isbv->EvaluateToRefresh();
+}
+
//-------------------------------------------------------------------
void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok)
{
- if(_planeWidgetX){
+ if(_planeWidgetX)
+ {
if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn();
if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn();
if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn();
//-------------------------------------------------------------------
void wxVtkMPR3DView::FreePlaneInteraction(bool ok)
{
- if(_planeWidgetX){
+ if(_planeWidgetX)
+ {
if (ok==true)
{
_planeWidgetX->InteractionOn();
_planeWidgetY->InteractionOff();
_planeWidgetZ->InteractionOff();
}
- }
+ } // if _planeWidgetX
}
+
//-------------------------------------------------------------------
void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortable)
{
//double nx=1,ny=0,nz=0; // JPRx
Refresh();
- double x=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetX();
- double y=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetY();
- double z=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetZ();
+ double x=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+ double y=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+ double z=GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
+
+ SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() );
+ SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() );
+
+ double normal[3];
+ // FreePlaneX
+ _planeWidgetX->GetNormal(normal);
+ if ((normal[0]==1)&&(normal[1]==0)&&(normal[2]==0))
+ {
+ _planeWidgetX->SetSlicePosition( x*spc[0] );
+ }
+ // FreePlaneY
+ _planeWidgetY->GetNormal(normal);
+ if ((normal[0]==0)&&(normal[1]==1)&&(normal[2]==0))
+ {
+ _planeWidgetY->SetSlicePosition( y*spc[1] );
+ }
+ // FreePlaneZ
+ _planeWidgetZ->GetNormal(normal);
+ if ((normal[0]==0)&&(normal[1]==0)&&(normal[2]==1))
+ {
+ _planeWidgetZ->SetSlicePosition( z*spc[2] );
+ }
+
x=x*spc[0];
y=y*spc[1];
z=z*spc[2];
if(_pointWidget){
_pointWidget->SetPosition( x,y,z );
-
-
double in[3];
double normal[3];
vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
in[0]=1; in[1]=0; in[2]=0;
transform->TransformPoint(in,normal);
_planeWidget->SetNormal( normal[0],normal[1],normal[2] );
-
-
_planeWidget->SetCenter( x,y,z );
_planeWidget->UpdatePlacement();
_planeWidget->GetPolyData(_vtkplane);
}
}
+
//-------------------------------------------------------------------
wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent, bool align)
{
this->_planeWidget->SetNormal(1,0,0);
}
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::SetColorWindow(double colorWindow)
+{
+ double colorLevel = _planeWidgetX->GetLevel();
+ _planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
+}
-
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::SetColorLevel(double colorLevel)
+{
+ double colorWindow = _planeWidgetX->GetWindow();
+ _planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
+}
//-------------------------------------------------------------------
// EED 25 Janvier 2007 testLoic
// interact with data
renWin->Render();
iren->Start();
+}
-}
vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
void FreePlaneVisible(int plane, bool ok);
void FreePlaneInteraction(bool ok);
+ void SetFreePlanesOrtho();
+ void SetColorWindow(double colorWindow);
+ void SetColorLevel(double colorLevel);
+
private:
wxVtk3DBaseView *_wxvtk3Dbaseview;
// Point Widget (3D)
vtkPointWidget *_pointWidget;
//vtkmyPWCallback_3DPointWidget *_myCallback;
- vtkProbeFilter *_probe;
- vtkPolyDataMapper *_contourMapper;
+ vtkProbeFilter *_probe;
+ vtkPolyDataMapper *_contourMapper;
//Free planes
vtkImagePlaneWidget *_planeWidgetX;
wxButton *btnColorTable = new wxButton (panel, -1, _T("Edit Color Table") );
*/
- ckBoxX = new wxCheckBox(panel,-1,_T("X "));
- _positionX = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
- ckBoxY = new wxCheckBox(panel,-1,_T("Y "));
- _positionY = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
- ckBoxZ = new wxCheckBox(panel,-1,_T("Z "));
- _positionZ = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
- wxButton *btnColorTable = new wxButton (panel, -1, _T("Color Table") );
-
- _ckBoxXYZ = new wxCheckBox(panel,-1,_T("Show XYZ axis "));
- _ckBoxPlane = new wxCheckBox(panel,-1,_T("Show Planes"));
-
- _ckFreePlaneX= new wxCheckBox(panel,-1,_T("free X"));;
- _ckFreePlaneY= new wxCheckBox(panel,-1,_T("free Y"));;
- _ckFreePlaneZ= new wxCheckBox(panel,-1,_T("free Z"));;
- _ckFreePlaneInteraction= new wxCheckBox(panel,-1,_T("Interaction "));;
+ _ckBoxX = new wxCheckBox(panel,-1,_T("X "));
+ _positionX = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
+ _ckBoxY = new wxCheckBox(panel,-1,_T("Y "));
+ _positionY = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
+ _ckBoxZ = new wxCheckBox(panel,-1,_T("Z "));
+ _positionZ = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
+
+ _ckBoxXYZ = new wxCheckBox(panel,-1,_T("XYZ axis "));
+ _ckBoxPlane = new wxCheckBox(panel,-1,_T("Plane"));
+////EED 05Nov2012 _ckBox_BW_Color_Plane = new wxCheckBox(panel,-1,_T("GL/Color"));
+ wxButton *btnColorTable = new wxButton (panel, -1, _T("Color table") );
+ wxButton *btnFreePlanesOrtho= new wxButton (panel, -1, _T("Orthogonal planes GL") );
+
+ _ckFreePlaneX= new wxCheckBox(panel,-1,_T("X "));;
+ _ckFreePlaneY= new wxCheckBox(panel,-1,_T("Y "));;
+ _ckFreePlaneZ= new wxCheckBox(panel,-1,_T("Z "));;
+ _ckFreePlaneInteraction= new wxCheckBox(panel,-1,_T("Interaction planes GL"));;
//EED: If-else statements added 30 Nov 2009
- _ckFreePlaneX->SetValue(true);
+ _ckFreePlaneX->SetValue(false);
_ckFreePlaneY->SetValue(false);
_ckFreePlaneZ->SetValue(false);
_ckFreePlaneInteraction->SetValue(true);
- ckBoxX->SetValue(false);
- ckBoxY->SetValue(false);
- ckBoxZ->SetValue(false);
+ _ckBoxX->SetValue(false);
+ _ckBoxY->SetValue(false);
+ _ckBoxZ->SetValue(false);
_ckBoxXYZ->SetValue(false);
+////EED 05Nov2012 _ckBox_BW_Color_Plane->SetValue(true);
_ckBoxPlane->SetValue(false);
_positionX->SetSize(400,20);
- Connect(ckBoxX->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX );
- Connect(_positionX->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX );
- Connect(ckBoxY->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY );
- Connect(_positionY->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY );
- Connect(ckBoxZ->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ );
- Connect(_positionZ->GetId(), wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ );
- Connect(btnColorTable->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnEditColorTable );
-
- Connect(_ckBoxXYZ->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ );
- Connect(_ckBoxPlane->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisiblePlane );
-
- Connect(_ckFreePlaneX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneX );
- Connect(_ckFreePlaneY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneY );
- Connect(_ckFreePlaneZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneZ );
+ Connect(_ckBoxX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX );
+ Connect(_positionX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX );
+ Connect(_ckBoxY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY );
+ Connect(_positionY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY );
+ Connect(_ckBoxZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ );
+ Connect(_positionZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ );
+
+ Connect(btnColorTable->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnEditColorTable );
+ Connect(_ckBoxXYZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ );
+ Connect(_ckBoxPlane->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisiblePlane );
+////EED 05Nov2012 Connect(_ckBox_BW_Color_Plane->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::On_BW_Color_Plane );
+
+ Connect(_ckFreePlaneX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneX);
+ Connect(_ckFreePlaneY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneY);
+ Connect(_ckFreePlaneZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneZ);
+ Connect(btnFreePlanesOrtho->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnFreePlanesOrtho );
Connect(_ckFreePlaneInteraction->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleFreePlaneInteraction );
- Connect(_cbStereo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnSetStereo );
+ Connect(_cbStereo->GetId() , wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnSetStereo );
wxFlexGridSizer *sizer;
wxFlexGridSizer *sizerH4;
wxFlexGridSizer *sizerH5;
wxFlexGridSizer *sizerH6;
- wxFlexGridSizer *sizerH7;
+
if(align)
{
sizer = new wxFlexGridSizer(4);
-
- sizerH4 = new wxFlexGridSizer(2);
+ sizerH4 = new wxFlexGridSizer(3);
+
+ sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( new wxStaticText(panel, -1,_T("GL")) , 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( new wxStaticText(panel, -1,_T("Color ")) , 1, wxALL|wxEXPAND, 0);
+
sizerH4->Add( _positionX ,1,wxGROW , 0 );
- sizerH4->Add( ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH4->Add( _ckFreePlaneX, 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( _ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+
sizerH4->Add( _positionY ,1,wxGROW, 0 );
- sizerH4->Add( ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH4->Add( _ckFreePlaneY, 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( _ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+
sizerH4->Add( _positionZ ,1,wxGROW, 0 );
- sizerH4->Add( ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH4->Add( _ckFreePlaneZ, 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( _ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+
+
+
+
sizerH5 = new wxFlexGridSizer(1);
sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
- //sizerH5->Add( new wxStaticText(panel, -1,_T(" ")), 1, wxALL|wxEXPAND, 0);
+////EED 05Nov2012 sizerH5->Add( _ckBox_BW_Color_Plane , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( btnFreePlanesOrtho , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _cbStereo, 1, wxALL|wxEXPAND, 0);
+
+ sizer->Add( sizerH4, 1, wxALL|wxGROW, 2);
+ sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2);
- sizerH6 = new wxFlexGridSizer(1);
- sizerH6->Add( _ckFreePlaneX, 1, wxALL|wxEXPAND, 0);
- sizerH6->Add( _ckFreePlaneY, 1, wxALL|wxEXPAND, 0);
- sizerH6->Add( _ckFreePlaneZ, 1, wxALL|wxEXPAND, 0);
- sizerH6->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0);
} else {
sizer = new wxFlexGridSizer(1);
sizerH6 = new wxFlexGridSizer(10);
sizerH4->Add( _positionX , 1, wxGROW , 0 );
- sizerH4->Add( ckBoxX , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH4->Add( _ckBoxX , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
sizerH4->Add( _positionY , 1, wxGROW , 0 );
- sizerH4->Add( ckBoxY , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH4->Add( _ckBoxY , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
sizerH4->Add( _positionZ , 1, wxGROW , 0 );
- sizerH4->Add( ckBoxZ , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH4->Add( _ckBoxZ , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
sizerH4->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
- sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
+////EED 05Nov2012 sizerH5->Add( _ckBox_BW_Color_Plane , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
sizerH6 = new wxFlexGridSizer(10);
sizerH6->Add( _ckFreePlaneX , 1, wxALL|wxEXPAND, 0);
sizerH6->Add( _ckFreePlaneZ , 1, wxALL|wxEXPAND, 0);
sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
sizerH6->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0);
+ sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH6->Add( btnFreePlanesOrtho , 0 , wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 );
+ sizerH6->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH6->Add( _cbStereo, 1, wxALL|wxEXPAND, 0);
+
+ sizer->Add( sizerH4, 1, wxALL|wxGROW, 2);
+ sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2);
+ sizer->Add( sizerH6, 1, wxALL|wxEXPAND,2);
}
- sizerH7 = new wxFlexGridSizer(1);
- sizerH7->Add( _cbStereo, 1, wxALL|wxEXPAND, 0);
//EED 28 sep 2006
// sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
// sizerH5->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
- sizer->Add( sizerH4, 1, wxALL|wxGROW, 2);
- sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2);
- sizer->Add( sizerH6, 1, wxALL|wxEXPAND,2);
- sizer->Add( sizerH7, 1, wxALL|wxEXPAND,2);
panel->SetSize(400,50);
panel->SetAutoLayout(true);
}
-
-
-
//-------------------------------------------------------------------
-
void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
{
vtkMPRBaseData* basedata = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData();
if(basedata != NULL){
- /*int maxX = basedata->GetMaxPositionX();
- int maxY = basedata->GetMaxPositionY();
- int maxZ = basedata->GetMaxPositionZ();*/
vtkImageData* img = basedata->GetImageData();
int x0,x1,y0,y1,z0,z1;
- /*int maxX = x1-x0;//basedata->GetMaxPositionX();
- int maxY = y1-y0;//basedata->GetMaxPositionY();
- int maxZ = z1-z0;//basedata->GetMaxPositionZ();*/
-
- //std::cout<<"wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() maxX="<<maxX<<" maxY="<<maxY<<" maxZ="<<maxZ<<std::endl;
- /*_positionX->SetRange(0,maxX);
- _positionY->SetRange(0,maxY);
- _positionZ->SetRange(0,maxZ);*/
+
if(img){
img->GetExtent(x0,x1,y0,y1,z0,z1);
_positionX->SetRange(x0,x1);
_positionY->SetValue((y0+y1)/2);
_positionZ->SetValue((z0+z1)/2);
-printf("EED wxVtkMPR3DViewCntrlPanel::UpdateControlPanel -- 12April2012 This make a floting window in MacOs and Linux with for windows \n");
//EED 12April2012 This make a floting window in MacOs and Linux with for windows
// _positionX->Update();
// _positionY->Update();
// _positionZ->Update();
// this->Update();
- }
+ }//img
- }
+ }//basedata
}
}
*/
+//-------------------------------------------------------------------
+//void wxVtkMPR3DViewCntrlPanel::On_BW_Color_Plane(wxCommandEvent& event)
+//{
+// printf ("EED wxVtkMPR3DViewCntrlPanel::On_BW_Color_Plane ...... NOT Implemented\n ");
+//}
+
+
//-------------------------------------------------------------------
void wxVtkMPR3DViewCntrlPanel::OnEditColorTable(wxCommandEvent& event)
{
+ vtkImageData *imagedata = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+
+ if ( imagedata->GetScalarType()!=VTK_UNSIGNED_SHORT )
+ {
+ wxMessageDialog windowMessage1(NULL,_T("This option is just available for UNSIGNED SHORT images."), _T("Alert !"), wxOK);
+ windowMessage1.ShowModal();
+ return;
+ }
+
vtkColorTransferFunction *ctfun = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetvtkColorTransferFunction();
std::vector<double> *ctfunVectorPoint = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorPoint();
std::vector<double> *ctfunVectorRed = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorRed();
int i=0,xi,r,g,b;
- vtkImageData *imagedata = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Color table"),imagedata,2);
_wxvtkmpr3Dview->FreePlaneInteraction( event.IsChecked() );
}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnFreePlanesOrtho(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->SetFreePlanesOrtho();
+}
+
//-------------------------------------------------------------------
void wxVtkMPR3DViewCntrlPanel::OnSetStereo(wxCommandEvent& event)
{
_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
}
+
+
//-------------------------------------------------------------------
bool wxVtkMPR3DViewCntrlPanel::GetVisibleX()
{
- return ckBoxX->GetValue();
+ return _ckBoxX->GetValue();
}
//-------------------------------------------------------------------
bool wxVtkMPR3DViewCntrlPanel::GetVisibleY()
{
- return ckBoxY->GetValue();
+ return _ckBoxY->GetValue();
}
//-------------------------------------------------------------------
bool wxVtkMPR3DViewCntrlPanel::GetVisibleZ()
{
- return ckBoxZ->GetValue();
+ return _ckBoxZ->GetValue();
}
//-------------------------------------------------------------------
return _ckBoxXYZ->GetValue();
}
+//-------------------------------------------------------------------
+////EED 05Nov2012
+//bool wxVtkMPR3DViewCntrlPanel::Get_BW_Color_Plane()
+//{
+// return _ckBox_BW_Color_Plane;
+//}
+
//-------------------------------------------------------------------
bool wxVtkMPR3DViewCntrlPanel::GetVisiblePlane()
{
//-------------------------------------------------------------------
void wxVtkMPR3DViewCntrlPanel::SetVisibleX(bool value)
{
- ckBoxX->SetValue(value);
+ _ckBoxX->SetValue(value);
_wxvtkmpr3Dview->VisibleImageActor(0, value );
_wxvtkmpr3Dview->Refresh();
//-------------------------------------------------------------------
void wxVtkMPR3DViewCntrlPanel::SetVisibleY(bool value)
{
- ckBoxY->SetValue(value);
+ _ckBoxY->SetValue(value);
_wxvtkmpr3Dview->VisibleImageActor(1, value );
_wxvtkmpr3Dview->Refresh();
//-------------------------------------------------------------------
void wxVtkMPR3DViewCntrlPanel::SetVisibleZ(bool value)
{
- ckBoxZ->SetValue(value);
+ _ckBoxZ->SetValue(value);
_wxvtkmpr3Dview->VisibleImageActor(2, value );
_wxvtkmpr3Dview->Refresh();
void OnVisibleAxisXYZ(wxCommandEvent& event);
void OnVisiblePlane(wxCommandEvent& event);
void OnEditColorTable(wxCommandEvent& event);
+////EED 05Nov2012 void On_BW_Color_Plane(wxCommandEvent& event);
void OnVisibleFreePlaneX(wxCommandEvent& event);
void OnVisibleFreePlaneY(wxCommandEvent& event);
void OnVisibleFreePlaneZ(wxCommandEvent& event);
void OnVisibleFreePlaneInteraction(wxCommandEvent& event);
void OnSetStereo(wxCommandEvent& event);
+ void OnFreePlanesOrtho(wxCommandEvent& event);
-
-
virtual void Refresh();
void UpdateControlPanel();
bool GetVisibleZ();
bool GetVisibleXYZ();
bool GetVisiblePlane();
+////EED 05Nov2012 bool Get_BW_Color_Plane();
void SetVisibleX(bool value);
void SetVisibleY(bool value);
void SetVisibleZ(bool value);
wxSlider *_positionZ;
//CPR: Added 30 nov 2009
- wxCheckBox *ckBoxX;
- wxCheckBox *ckBoxY;
- wxCheckBox *ckBoxZ;
-
+ wxCheckBox *_ckBoxX;
+ wxCheckBox *_ckBoxY;
+ wxCheckBox *_ckBoxZ;
+
+ //EED 03 nov 2012
+////EED 05Nov2012 wxCheckBox *_ckBox_BW_Color_Plane;
+
wxCheckBox *_ckBoxXYZ;
wxCheckBox *_ckBoxPlane;