wxMaracasSurfaceRenderingManagerDataMhd Class Reference

#include <wxMaracasSurfaceRenderingManagerDataMhd.h>

Inheritance diagram for wxMaracasSurfaceRenderingManagerDataMhd:
Inheritance graph
[legend]
Collaboration diagram for wxMaracasSurfaceRenderingManagerDataMhd:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxMaracasSurfaceRenderingManagerDataMhd (vtkImageData *imagedata, std::string dataname="", vtkRenderWindowInteractor *interactor=0)
 ~wxMaracasSurfaceRenderingManagerDataMhd ()
void setVtkImageData (vtkImageData *imagedata)
void changeIsoValue (double value)
void checkInvariant ()
int getMaxGreyLevel ()
void contourExtractor (int isovalue)
void UpdateSurface ()
void setProp3D (vtkProp3D *prop3D)
void changeOpacity (int value)
vtkProp3D * getProp3D ()
int getId ()
void setId (int propid)
std::string getDataname ()
void setDataname (std::string dataname)
void changeColor (double red, double green, double blue)
void addRemoveSurfaceBox (bool visible)
void initializeBoxWidget (vtkRenderWindowInteractor *interactor)

Protected Attributes

vtkProp3D * _prop3D
std::string _dataname
vtkBoxWidget * _boxWidgetS1

Private Member Functions

int getMaxLevel (vtkImageData *img)

Private Attributes

vtkImageData * _imagedata
int _maxgreylevel
vtkMarchingCubes * _cubesFilter
vtkCleanPolyData * _cleanFilter
vtkPolyDataMapper * _dataMapper
vtkClipPolyData * _tissueClipper
vtkPlanes * _tissuePlanes

Detailed Description

Definition at line 15 of file wxMaracasSurfaceRenderingManagerDataMhd.h.


Constructor & Destructor Documentation

wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd ( vtkImageData *  imagedata,
std::string  dataname = "",
vtkRenderWindowInteractor *  interactor = 0 
)

Definition at line 6 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

References wxMaracasSurfaceRenderingManagerData::_boxWidgetS1, _cleanFilter, _cubesFilter, _dataMapper, wxMaracasSurfaceRenderingManagerData::_dataname, _imagedata, _maxgreylevel, wxMaracasSurfaceRenderingManagerData::_prop3D, _tissueClipper, _tissuePlanes, changeIsoValue(), getMaxLevel(), boxSurfaceObserver::New(), boxSurfaceObserver::SetActor(), boxSurfaceObserver::SetPlanes(), and setVtkImageData().

00007 : wxMaracasSurfaceRenderingManagerData(NULL, dataname)
00008 {
00009 
00010         this->setVtkImageData(imagedata);
00011         _dataname = dataname;
00012         
00013         _maxgreylevel = getMaxLevel(imagedata);
00014         _prop3D=NULL;                   
00015 
00016         _cubesFilter = vtkMarchingCubes::New(); 
00017         _cubesFilter->SetInput(this->_imagedata);               
00018         _cubesFilter->ComputeGradientsOn ();
00019         _cubesFilter->ComputeScalarsOn ();
00020         _cubesFilter->SetNumberOfContours( 1 );
00021         _cleanFilter = vtkCleanPolyData::New();         
00022         _cleanFilter->SetInput ( _cubesFilter->GetOutput() );
00023 
00024         _dataMapper = vtkPolyDataMapper::New( );
00025         _dataMapper->ScalarVisibilityOff( );
00026         _dataMapper->ImmediateModeRenderingOn();
00027         vtkActor* dataActor = vtkActor::New();
00028 
00029         //if(_boxWidgetS1){
00030         if(interactor){
00031 
00032                 _boxWidgetS1 = vtkBoxWidget::New();
00033                 _boxWidgetS1->SetInteractor( interactor );
00034                 _boxWidgetS1->SetPlaceFactor(1.25); 
00035 
00036                 _boxWidgetS1->SetInput( this->_imagedata );
00037                 _boxWidgetS1->PlaceWidget();    
00038                 boxSurfaceObserver* observer = boxSurfaceObserver::New();               
00039 
00040                 vtkStripper* striper = vtkStripper::New();
00041             striper->SetInput( _cleanFilter->GetOutput() );
00042                 //striper->SetInput( _cubesFilter->GetOutput() );
00043                 
00044                 striper->Update();
00045                 _boxWidgetS1->SetInput(striper->GetOutput());
00046                 _boxWidgetS1->PlaceWidget();
00047 
00048                 _boxWidgetS1->HandlesOn ();
00049                 _boxWidgetS1->On();
00050 
00051                 _tissuePlanes  = vtkPlanes::New();
00052    
00053                 int x1,x2,y1,y2,z1,z2;
00054                 this->_imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
00055                 _tissuePlanes->SetBounds  (x1,x2,y1,y2,z1,z2);
00056 
00057 
00058                 
00059                 _boxWidgetS1->GetPlanes( _tissuePlanes );
00060                 
00061                 _tissueClipper = vtkClipPolyData::New();
00062                 _tissueClipper->SetInput( striper->GetOutput() );
00063                 _tissueClipper->SetClipFunction( _tissuePlanes );
00064                 _tissueClipper->InsideOutOn( );
00065                 _dataMapper->SetInput( _tissueClipper->GetOutput() );
00066                 observer->SetPlanes( _tissuePlanes );
00067                 observer->SetActor( dataActor );
00068                 _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent          , observer );
00069 
00070 
00071                 _boxWidgetS1->HandlesOn ();
00072                 _boxWidgetS1->On();
00073         }else{          
00074                 _dataMapper->SetInput(_cleanFilter->GetOutput());                               
00075         }
00076         
00077         dataActor->SetMapper(_dataMapper);      
00078         this->_prop3D = dataActor;
00079 
00080         
00081         
00082 
00083         this->changeIsoValue(this->_maxgreylevel);      
00084 
00085 
00086 }

Here is the call graph for this function:

wxMaracasSurfaceRenderingManagerDataMhd::~wxMaracasSurfaceRenderingManagerDataMhd (  ) 

Definition at line 89 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

References _cleanFilter, _cubesFilter, and _dataMapper.

00090 {
00091         _cubesFilter->Delete();
00092         _cleanFilter->Delete();
00093         _dataMapper->Delete();
00094 }


Member Function Documentation

void wxMaracasSurfaceRenderingManagerData::addRemoveSurfaceBox ( bool  visible  )  [inherited]

adds or removes the surface box

Definition at line 45 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_boxWidgetS1.

Referenced by wxMaracasSurfaceRenderingManager::addRemoveSurfaceBox().

00046 {
00047         if(_boxWidgetS1){
00048                 if (visible==true){
00049                         _boxWidgetS1->On();
00050                 } else {
00051                         _boxWidgetS1->Off();
00052                 }
00053         }
00054 }

Here is the caller graph for this function:

void wxMaracasSurfaceRenderingManagerData::changeColor ( double  red,
double  green,
double  blue 
) [inherited]

Changes the color of the actor

Definition at line 66 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_prop3D.

00066                                                                                            {
00067         std::cout<<"chage col"<<red<<green<<blue<<std::endl;
00068     vtkActor* actor = (vtkActor*)this->_prop3D; 
00069         actor->GetProperty()->SetColor(red,green,blue); 
00070 }

void wxMaracasSurfaceRenderingManagerDataMhd::changeIsoValue ( double  value  ) 

changes the isovalue in a prop3D

Definition at line 105 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

References _cleanFilter, _cubesFilter, and _dataMapper.

Referenced by wxMaracasSurfaceRenderingManagerDataMhd().

00105                                                                         {       
00106                 
00107    
00108     _cubesFilter->SetValue(0,value);            
00109         _cubesFilter->Update();    
00110         _cleanFilter->Update();
00111         _dataMapper->Update();  
00112         
00113         
00114         
00115 }

Here is the caller graph for this function:

void wxMaracasSurfaceRenderingManagerData::changeOpacity ( int  value  )  [inherited]

Changes the opacity in a prop3D

Definition at line 58 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_prop3D.

00058                                                                  {
00059         std::cout<<"chage op"<<value<<std::endl;
00060         vtkActor* actor = (vtkActor*)this->_prop3D;     
00061         actor->GetProperty()->SetOpacity((double)value/100.0);
00062 
00063         
00064 
00065 }

void wxMaracasSurfaceRenderingManagerDataMhd::checkInvariant (  ) 

Check if the variables are setted correctly

Reimplemented from wxMaracasSurfaceRenderingManagerData.

void wxMaracasSurfaceRenderingManagerDataMhd::contourExtractor ( int  isovalue  ) 

creates the image

Reimplemented from wxMaracasSurfaceRenderingManagerData.

std::string wxMaracasSurfaceRenderingManagerData::getDataname (  )  [inherited]

Get the filanme

Definition at line 99 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_dataname.

00099                                                            {
00100         return _dataname;
00101 }

int wxMaracasSurfaceRenderingManagerData::getId (  )  [inherited]

return the id from the daat

Definition at line 86 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_id.

Referenced by wxMaracasSurfaceRenderingManager::addProp3D(), and wxMaracasSurfaceRenderingManager::addPropMHD().

00086                                                {
00087         return _id;
00088 }

Here is the caller graph for this function:

int wxMaracasSurfaceRenderingManagerDataMhd::getMaxGreyLevel (  ) 

Returns the grey max level of the image

Definition at line 116 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

References _maxgreylevel.

00116                                                             {
00117         return _maxgreylevel;
00118 }

int wxMaracasSurfaceRenderingManagerDataMhd::getMaxLevel ( vtkImageData *  img  )  [private]

Get's the max grey level of the image

Definition at line 123 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

Referenced by wxMaracasSurfaceRenderingManagerDataMhd().

00123                                                                          {
00124 
00125         int ext[6], i, j, k,max=0;
00126         img->GetExtent(ext);
00127 
00128         for(i = ext[0]; i < ext[1];i++){
00129                 for(j = ext[2]; j < ext[3];j++){
00130                         for(k = ext[4]; k < ext[5];k++){
00131                 unsigned short* ptr = (unsigned short*)img->GetScalarPointer(i,j,k);
00132                                 int temp = (int)*ptr;
00133                                 if(temp > max){
00134                     max = temp;
00135                                 }
00136                         }
00137                 }
00138         }
00139         return max;
00140 
00141 
00142 }

Here is the caller graph for this function:

vtkProp3D * wxMaracasSurfaceRenderingManagerData::getProp3D (  )  [inherited]
void wxMaracasSurfaceRenderingManagerData::initializeBoxWidget ( vtkRenderWindowInteractor *  interactor  )  [inherited]

Definition at line 32 of file wxMaracasSurfaceRenderingManagerData.cxx.

Referenced by wxMaracasSurfaceRenderingManagerData::wxMaracasSurfaceRenderingManagerData().

00032                                                                                                     {
00033         if(interactor!= NULL){
00034         
00035         }
00036 }

Here is the caller graph for this function:

void wxMaracasSurfaceRenderingManagerData::setDataname ( std::string  dataname  )  [inherited]

Set the filanme

Definition at line 105 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_dataname.

00105                                                                         {
00106         _dataname = dataname;
00107 }

void wxMaracasSurfaceRenderingManagerData::setId ( int  propid  )  [inherited]

set data id

Definition at line 92 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_id.

Referenced by wxMaracasSurfaceRenderingManager::addProp3D(), and wxMaracasSurfaceRenderingManager::addPropMHD().

00092                                                           {
00093         _id = propid;
00094 }

Here is the caller graph for this function:

void wxMaracasSurfaceRenderingManagerData::setProp3D ( vtkProp3D *  prop3D  )  [inherited]

Adds a prop3D to the world of the application

Definition at line 41 of file wxMaracasSurfaceRenderingManagerData.cxx.

References wxMaracasSurfaceRenderingManagerData::_prop3D.

00041                                                                      {
00042         _prop3D = prop3D;
00043 }

void wxMaracasSurfaceRenderingManagerDataMhd::setVtkImageData ( vtkImageData *  imagedata  ) 

Adds a prop3D to the world of the application

Sets the VTK image data

Definition at line 148 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

References _imagedata.

Referenced by wxMaracasSurfaceRenderingManagerDataMhd().

00148                                                                                     {
00149         _imagedata = imagedata;
00150 }

Here is the caller graph for this function:

void wxMaracasSurfaceRenderingManagerDataMhd::UpdateSurface (  ) 

Updates surface

Definition at line 96 of file wxMaracasSurfaceRenderingManagerDataMhd.cxx.

References _cleanFilter, _cubesFilter, and _dataMapper.

00097 {
00098         _cubesFilter->Update();    
00099         _cleanFilter->Update();
00100         _dataMapper->Update();  
00101 }


Member Data Documentation

vtkBoxWidget* wxMaracasSurfaceRenderingManagerData::_boxWidgetS1 [protected, inherited]
std::string wxMaracasSurfaceRenderingManagerData::_dataname [protected, inherited]
vtkProp3D* wxMaracasSurfaceRenderingManagerData::_prop3D [protected, inherited]

The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1