}else if (img != _currentimg){
_mwxwidget->SetImage(img);
}
- _mwxwidget->RefreshView();
+// _mwxwidget->RefreshView();
_currenttype = type;
_currentimg = img;
_point.clear();
}
}
_mwxwidget->SetInterpolate( bbGetInputInterpolate() );
-
/* Borrame
if (wvbv1!=NULL)
{
}
*/
-
-
-
-
}// mwxwidget != NULL
}
//-----------------------------------------------------------------
-
-
-bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype){
-
+bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype)
+{
bool ret = true;
-
- if(type.size()==currenttype.size()){
- for(int i = 0; i < (int)(type.size()) && ret; i++){
- if(type[i]!=currenttype[i]){
+ if(type.size()==currenttype.size())
+ {
+ for(int i = 0; i < (int)(type.size()) && ret; i++)
+ {
+ if(type[i]!=currenttype[i])
+ {
ret = false;
- }
- }
+ } // if
+ } // for
}else{
ret=false;
- }
+ } // type size
return ret;
}
-void ViewerNV::updateObservers(){
+void ViewerNV::updateObservers()
+{
vtkRenderWindowInteractor* interactor;
interactor = bbGetOutputInteractor1();
- if(interactor){
- if (bbGetInputObs1()!=NULL){
+ if(interactor)
+ {
+ if (bbGetInputObs1()!=NULL)
+ {
bbGetInputObs1()->SetInteractor(interactor);
bbGetInputObs1()->EnabledOn();
}
bbGetInputObs5()->SetInteractor(interactor);
bbGetInputObs5()->EnabledOn();
}
- }
+ } // if interactor
}
}
//-------------------------------------------------------------------
vtkMPR3DDataViewer::~vtkMPR3DDataViewer()
{
- if(_outlineData) {_outlineData-> Delete();}
- if(_mapOutline) {_mapOutline-> Delete();}
- if(_outline) {_outline-> Delete();}
-
-// if (_bwLut) _bwLut->Delete();
-// if (_hueLut) _hueLut->Delete();
-// if (_satLut) _satLut->Delete();
- if (_ctfun) _ctfun->Delete();
- if (_saggitalColors) _saggitalColors ->Delete();
- if (_saggital) _saggital->Delete();
- if (_axialColors) _axialColors->Delete();
- if (_axial) _axial->Delete();
- if (_coronalColors) _coronalColors->Delete();
- if (_coronal) _coronal->Delete();
-
+ if(_outlineData) {_outlineData -> Delete();}
+ if(_mapOutline) {_mapOutline -> Delete();}
+ if(_outline) {_outline -> Delete();}
+// if (_bwLut) {_bwLut -> Delete();}
+// if (_hueLut) {_hueLut -> Delete();}
+// if (_satLut) {_satLut -> Delete();}
+ if (_ctfun) {_ctfun -> Delete();}
+ if (_saggitalColors) {_saggitalColors -> Delete();}
+ if (_saggital) {_saggital -> Delete();}
+ if (_axialColors) {_axialColors -> Delete();}
+ if (_axial) {_axial -> Delete();}
+ if (_coronalColors) {_coronalColors -> Delete();}
+ if (_coronal) {_coronal -> Delete();}
}
+
//-------------------------------------------------------------------
vtkActor* vtkMPR3DDataViewer::GetOutlineActor()
{
return _outline;
}
+
//-------------------------------------------------------------------
vtkImageActor* vtkMPR3DDataViewer::GetImageActor(int id)
{
{
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- _saggitalColors ->SetInput( _vtkmprbasedata->GetImageData() );
- _axialColors ->SetInput( _vtkmprbasedata->GetImageData() );
- _coronalColors ->SetInput( _vtkmprbasedata->GetImageData() );
- _outlineData ->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+ _saggitalColors -> SetInput( _vtkmprbasedata->GetImageData() );
+ _axialColors -> SetInput( _vtkmprbasedata->GetImageData() );
+ _coronalColors -> SetInput( _vtkmprbasedata->GetImageData() );
+ _outlineData -> SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
#else
- _saggitalColors ->SetInputData( _vtkmprbasedata->GetImageData() );
- _axialColors ->SetInputData( _vtkmprbasedata->GetImageData() );
- _coronalColors ->SetInputData( _vtkmprbasedata->GetImageData() );
- _outlineData ->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+ _saggitalColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+ _axialColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+ _coronalColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+
+//EED 2020-01-27 this is to slow ??? how can we accelerated
+// _saggitalColors -> Update();
+// _axialColors -> Update();
+// _coronalColors -> Update();
+
+ _outlineData -> SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
#endif
}
+
//-------------------------------------------------------------------
void vtkMPR3DDataViewer::Configure()
{
void SetPositionZ(int pos);
void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
vtkMPRBaseData* GetVtkMPRBaseData();
-
vtkColorTransferFunction *GetvtkColorTransferFunction();
std::vector<double > *GetctFunVectorPoint();
std::vector<double > *GetctFunVectorRed();
std::vector<double > *GetctFunVectorGreen();
std::vector<double > *GetctFunVectorBlue();
-
void setColorTransferFunction(vtkColorTransferFunction* colortable);
-
private:
-
bool _visiblePosition[3];
-
// outline
vtkOutlineFilter *_outlineData;
vtkPolyDataMapper *_mapOutline;
vtkActor *_outline;
-
//
vtkColorTransferFunction *_ctfun;
std::vector<double> _ctFunVectorPoint;
std::vector<double> _ctFunVectorRed;
std::vector<double> _ctFunVectorGreen;
std::vector<double> _ctFunVectorBlue;
-
// vtkLookupTable *_bwLut;
// vtkLookupTable *_hueLut;
// vtkLookupTable *_satLut;
-
vtkImageMapToColors *_saggitalColors;
vtkImageActor *_saggital;
vtkImageMapToColors *_axialColors;
vtkImageMapToColors *_coronalColors;
vtkImageActor *_coronal;
vtkMPRBaseData *_vtkmprbasedata;
-
-
};
#endif /*VTKMPR3DDATAVIEWER_H_*/
{
mwxsphereview->SetImage();
}
- if (mwxvtkclipping3Dview!=NULL)
- {
- mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage();
- }
if (mwxvtkmpr3Dview!=NULL)
{
mwxvtkmpr3Dview->SetImage();
}
+ if (mwxvtkclipping3Dview!=NULL)
+ {
+ mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage();
+ }
//EED 26/11/2009
// ConfigureVTK();
// -- Plane widget
_probe->SetSource( imageData );
#else
+
+
+ double colorWindow = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow();
+ double colorLevel = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel();
+
+ double spc[3];
+ vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ if(image)
+ {
+ image->GetSpacing(spc);
+ }else{
+ spc[0] = 0;
+ spc[1] = 0;
+ spc[2] = 0;
+ }
+ double x = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+ double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+ double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
+
_planeWidgetX->SetInputData( imageData );
+ _planeWidgetX->SetWindowLevel(colorWindow,colorLevel,1);
+ _planeWidgetX->SetSlicePosition( x*spc[0] );
_planeWidgetY->SetInputData( imageData );
+ _planeWidgetY->SetWindowLevel(colorWindow,colorLevel,1);
+ _planeWidgetY->SetSlicePosition( y*spc[1] );
_planeWidgetZ->SetInputData( imageData );
+ _planeWidgetZ->SetWindowLevel(colorWindow,colorLevel,1);
+ _planeWidgetZ->SetSlicePosition( z*spc[2] );
+
// -- Plane widget
_probe->SetSourceData( imageData );
#endif
//-------------------------------------------------------------------
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 = NULL;
+ vtkImagePlaneWidget* planeWidget = vtkImagePlaneWidget::New();
planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
planeWidget->EnabledOff();
vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
{
double spc[3];
vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
if(image)
{
image->GetSpacing(spc);
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);
_planeWidgetZ->GetReslice()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
_planeWidgetZ->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
}
-
+
x=x*spc[0];
y=y*spc[1];
z=z*spc[2];
//-------------------------------------------------------------------
//-------------------------------------------------------------------
-void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
+void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible)
+{
/*if(visible == false)
printf("CPR: wxVtkMPR3DView::VisibleImageActor-> visibleActor == false \n");
else
}
*/
if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
- if (visible==false){
+ if (visible==false)
+ {
_wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
} else {
//EED 21/07/2013
}
//-------------------------------------------------------------------
-void wxVtkMPR3DView::SetColorWindow(double colorWindow)
+void wxVtkMPR3DView::SetWindowColorLevel(double colorWindow , double colorLevel)
{
- double colorLevel = _planeWidgetX->GetLevel();
_planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
+ _planeWidgetY->SetWindowLevel(colorWindow,colorLevel);
+ _planeWidgetZ->SetWindowLevel(colorWindow,colorLevel);
}
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::SetColorLevel(double colorLevel)
-{
- double colorWindow = _planeWidgetX->GetWindow();
- _planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
-}
//-------------------------------------------------------------------
// EED 25 Janvier 2007 testLoic
//Free planes
//-------------------------------------------------------------------
- void ConfigureFreePlanes();
- 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);
+ void ConfigureFreePlanes();
+ 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();
+/*Borrame
+ void SetColorWindow(double colorWindow);
+ void SetColorLevel(double colorLevel);
+*/
+ void SetWindowColorLevel(double colorWindow , double colorLevel);
private:
wxVtk3DBaseView *_wxvtk3Dbaseview;