_prop3D = prop3Dvect;
_dataname = dataname;
-
+ _boxWidgetS1=NULL;
initializeBoxWidget(interactor);
wxMaracasSurfaceRenderingManagerData::~wxMaracasSurfaceRenderingManagerData(){
_prop3D->Delete();
+ if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); }
}
void wxMaracasSurfaceRenderingManagerData::initializeBoxWidget(vtkRenderWindowInteractor* interactor){
if(interactor!= NULL){
- _boxWidgetS1 = vtkBoxWidget::New();
- _boxWidgetS1->SetInteractor( interactor );
- _boxWidgetS1->SetPlaceFactor(1.25);
-
- //_boxWidgetS1->SetInput( );
- _boxWidgetS1->PlaceWidget();
- //_boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) );
- _boxWidgetS1->HandlesOn ();
- _boxWidgetS1->Off();
+
}
}
#include "vtkStripper.h"
wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname, vtkRenderWindowInteractor* interactor)
-: wxMaracasSurfaceRenderingManagerData(NULL, dataname, interactor)
+: wxMaracasSurfaceRenderingManagerData(NULL, dataname)
{
this->setVtkImageData(imagedata);
_maxgreylevel = getMaxLevel(imagedata);
_prop3D=NULL;
- _cubesFilter = vtkMarchingCubes::New();
- _cleanFilter = vtkCleanPolyData::New();
- _dataMapper = vtkPolyDataMapper::New();
- vtkActor* dataActor = vtkActor::New();
-
- _cubesFilter->SetInput(this->_imagedata);
+ _cubesFilter = vtkMarchingCubes::New();
+ _cubesFilter->SetInput(this->_imagedata);
_cubesFilter->ComputeGradientsOn ();
_cubesFilter->ComputeScalarsOn ();
_cubesFilter->SetNumberOfContours( 1 );
+ _cleanFilter = vtkCleanPolyData::New();
_cleanFilter->SetInput ( _cubesFilter->GetOutput() );
- _dataMapper->SetInput(_cleanFilter->GetOutput());
- _dataMapper->ScalarVisibilityOff();
- _dataMapper->ImmediateModeRenderingOn();
- dataActor->SetMapper(_dataMapper);
- this->_prop3D = dataActor;
+ _dataMapper = vtkPolyDataMapper::New( );
+ _dataMapper->ScalarVisibilityOff( );
+ _dataMapper->ImmediateModeRenderingOn();
if(_boxWidgetS1){
+
+ _boxWidgetS1 = vtkBoxWidget::New();
+ _boxWidgetS1->SetInteractor( interactor );
+ _boxWidgetS1->SetPlaceFactor(1.25);
+
+ _boxWidgetS1->SetInput( this->_imagedata );
+ _boxWidgetS1->PlaceWidget();
+ //_boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) );
+ _boxWidgetS1->HandlesOn ();
+ _boxWidgetS1->Off();
+
vtkStripper* striper = vtkStripper::New();
striper->SetInput( _cleanFilter->GetOutput() );
+ //striper->SetInput( _cubesFilter->GetOutput() );
+
+ striper->Update();
_boxWidgetS1->SetInput(striper->GetOutput());
_boxWidgetS1->PlaceWidget();
+
+ _tissuePlanes = vtkPlanes::New();
+
+ int x1,x2,y1,y2,z1,z2;
+ this->_imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
+ _tissuePlanes->SetBounds (x1,x2,y1,y2,z1,z2);
+
+ _boxWidgetS1->GetPlanes( _tissuePlanes );
+
+ _tissueClipper = vtkClipPolyData::New();
+ _tissueClipper->SetInput( striper->GetOutput() );
+ _tissueClipper->SetClipFunction( _tissuePlanes );
+ _tissueClipper->InsideOutOn( );
+ _dataMapper->SetInput( _tissueClipper->GetOutput() );
+
+ }else{
+ _dataMapper->SetInput(_cleanFilter->GetOutput());
+
}
+ vtkActor* dataActor = vtkActor::New();
+ dataActor->SetMapper(_dataMapper);
+ this->_prop3D = dataActor;