wxMaracasIRMViewManager Class Reference

#include <wxMaracasIRMViewManager.h>

List of all members.

Public Member Functions

 wxMaracasIRMViewManager ()
 ~wxMaracasIRMViewManager ()
void setRenderer (vtkRenderer *renderer)
int addProp3D (vtkProp3D *prop3D, std::string dataname) throw (char*)
int addPropMHD (vtkImageData *imagedata, std::string dataname) throw (char*)
void changeOpacity (int propid, int value) throw (char*)
void changeIsoValue (int propid, double value) throw (char*)
vtkProp3D * getProp3D (std::string filename)
vtkImageData * getImageData (std::string filename)
void addRemoveActor (int propid, bool addremove) throw (char*)
void checkInvariant () throw (char*)
wxMaracasIRMViewManagerDatagetViewData (int id) throw (char*)
int getMaxIsoValue (int propid) throw (char*)
void changeColor (int propid, double red, double green, double blue) throw (char*)
void deleteActor (int propid) throw (char *)

Private Attributes

std::vector
< wxMaracasIRMViewManagerData * > 
prop3Dvect
vtkRenderer * _renderer
int _idCount


Detailed Description

Definition at line 30 of file wxMaracasIRMViewManager.h.


Constructor & Destructor Documentation

wxMaracasIRMViewManager::wxMaracasIRMViewManager (  ) 

Start of the manager class

Definition at line 24 of file wxMaracasIRMViewManager.cxx.

References _idCount, and _renderer.

00024                                                 {
00025         _renderer = NULL;
00026         _idCount=0;
00027 }

wxMaracasIRMViewManager::~wxMaracasIRMViewManager (  ) 

Definition at line 28 of file wxMaracasIRMViewManager.cxx.

00028                                                  {
00029 }


Member Function Documentation

int wxMaracasIRMViewManager::addProp3D ( vtkProp3D *  prop3D,
std::string  dataname 
) throw (char*)

Adds a prop3D to the manager and returns the identifier

Definition at line 40 of file wxMaracasIRMViewManager.cxx.

References wxMaracasIRMViewManagerData::getId(), wxMaracasIRMViewManagerData::getProp3D(), and wxMaracasIRMViewManagerData::setId().

Referenced by wxMaracasIRMView::addProp3D().

00040                                                                                          {
00041         checkInvariant();
00042         if(prop3D != NULL){
00043                 wxMaracasIRMViewManagerData* data = new wxMaracasIRMViewManagerData(prop3D, dataname);
00044                 prop3Dvect.push_back(data);             
00045                 _renderer->AddActor(data->getProp3D());
00046                 data->setId(_idCount);
00047                 _idCount++;
00048                 return data->getId();
00049         }else{
00050                 throw "Check vtkProp3D file or input";
00051         }
00052         return -1;
00053 }

Here is the call graph for this function:

Here is the caller graph for this function:

int wxMaracasIRMViewManager::addPropMHD ( vtkImageData *  imagedata,
std::string  dataname 
) throw (char*)

Adds a prop3D to the manager and returns the identifier

Definition at line 54 of file wxMaracasIRMViewManager.cxx.

References wxMaracasIRMViewManagerData::getId(), wxMaracasIRMViewManagerData::getProp3D(), and wxMaracasIRMViewManagerData::setId().

Referenced by wxMaracasIRMView::addPropMHD().

00054                                                                                                {
00055 
00056         checkInvariant();
00057         if(imagedata != NULL){
00058                 wxMaracasIRMViewManagerData* data = new wxMaracasIRMViewManagerDataMhd(imagedata, dataname);
00059                 prop3Dvect.push_back(data);             
00060                 _renderer->AddActor(data->getProp3D());
00061                 data->setId(_idCount);
00062                 _idCount++;
00063                 return data->getId();
00064         }else{
00065                 throw "Check ImageData file or input";
00066         }
00067         return -1;
00068 
00069 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracasIRMViewManager::addRemoveActor ( int  propid,
bool  addremove 
) throw (char*)

adds or removes an actor depending of the bool value

Definition at line 73 of file wxMaracasIRMViewManager.cxx.

References wxMaracasIRMViewManagerData::getProp3D().

Referenced by wxMaracasIRMView::addRemoveActor().

00073                                                                                     {
00074         checkInvariant();
00075         
00076         wxMaracasIRMViewManagerData* data = this->getViewData(propid);          
00077         if(data->getProp3D()!=NULL){
00078                 if(addremove){
00079                         _renderer->AddViewProp(data->getProp3D());
00080                 }else{
00081                         _renderer->RemoveViewProp(data->getProp3D());
00082                 }
00083                 _renderer->Render();
00084         }
00085         
00086 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMaracasIRMViewManager::changeColor ( int  propid,
double  red,
double  green,
double  blue 
) throw (char*)

Changes the color of the actor

Definition at line 170 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::changeColor().

00170                                                                                                        {
00171         checkInvariant();       
00172         this->getViewData(propid)->changeColor(red, green, blue);
00173 
00174         _renderer->Render();
00175 }

Here is the caller graph for this function:

void wxMaracasIRMViewManager::changeIsoValue ( int  propid,
double  value 
) throw (char*)

changes the isovalue in a prop3D

Definition at line 103 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::changeIsoValue().

00103                                                                                  {
00104         checkInvariant();       
00105 
00106         wxMaracasIRMViewManagerData* data = this->getViewData(propid);          
00107 
00108         //_renderer->RemoveActor(data->getProp3D());
00109         ((wxMaracasIRMViewManagerDataMhd*)data)->changeIsoValue(value);
00110         //_renderer->AddActor(data->getProp3D());
00111 
00112         _renderer->Render();
00113 }

Here is the caller graph for this function:

void wxMaracasIRMViewManager::changeOpacity ( int  propid,
int  value 
) throw (char*)

Changes the opacity in a prop3D

Definition at line 90 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::changeOpacity().

00090                                                                               {
00091         checkInvariant();       
00092 
00093 
00094         this->getViewData(propid)->changeOpacity(value);
00095         
00096         _renderer->Render();
00097 
00098 }

Here is the caller graph for this function:

void wxMaracasIRMViewManager::checkInvariant (  )  throw (char*)

Check if the variables are setted correctly

Definition at line 146 of file wxMaracasIRMViewManager.cxx.

References _renderer.

00146                                                           {
00147         if(this->_renderer==NULL){
00148                 throw "Renderer not set";
00149         }
00150 }

void wxMaracasIRMViewManager::deleteActor ( int  propid  )  throw (char *)

Definition at line 177 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::deleteActor().

00177                                                                   {
00178         checkInvariant();       
00179 
00180         this->addRemoveActor(propid, false);
00181 
00182         int i,n;
00183         bool exit = false;
00184         for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
00185                 if(prop3Dvect[i]->getId() == propid){                   
00186                         n=i;
00187                         exit = true;
00188                 }
00189         }
00190         if(exit){
00191                 wxMaracasIRMViewManagerData* data = prop3Dvect[n];                      
00192                 int j;
00193                 for(j = i; j < (int)(prop3Dvect.size())-1;j++){
00194                         prop3Dvect[j] = prop3Dvect[j+1];
00195                 }               
00196                 delete data;
00197                 prop3Dvect.pop_back();
00198         }else{
00199                 throw "id not found in the data";
00200         }
00201 
00202         
00203         
00204     
00205 }

Here is the caller graph for this function:

vtkImageData * wxMaracasIRMViewManager::getImageData ( std::string  filename  ) 

loads a MHD file to convert it into an actor

Definition at line 132 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::loadPropMHD().

00132                                                                      {
00133         if(filename.compare("")!= 0){   
00134                 
00135                 
00136                 vtkMetaImageReader* reader =  vtkMetaImageReader::New();        
00137                 reader->SetFileName(filename.c_str());
00138                 reader->Update();
00139                 vtkImageData* img = reader->GetOutput();
00140                 //reader->Delete();
00141                 return img;
00142         }       
00143         return NULL;
00144 }

Here is the caller graph for this function:

int wxMaracasIRMViewManager::getMaxIsoValue ( int  propid  )  throw (char*)

Given the id, return the max iso value from the imagedata

Definition at line 164 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::addPropMHD().

00164                                                                   {
00165         
00166         return ((wxMaracasIRMViewManagerDataMhd*)this->getViewData(propid))->getMaxGreyLevel();
00167 
00168 }

Here is the caller graph for this function:

vtkProp3D * wxMaracasIRMViewManager::getProp3D ( std::string  filename  ) 

loads a prop3D from a nSTL file

Definition at line 115 of file wxMaracasIRMViewManager.cxx.

Referenced by wxMaracasIRMView::loadProp3D().

00115                                                                 {
00116         if(filename.compare("")!= 0){
00117                 vtkSTLReader *STLReader=vtkSTLReader::New();
00118                 STLReader->SetFileName(filename.c_str());
00119                 STLReader->Update();
00120                 vtkPolyDataMapper* dataMapper = vtkPolyDataMapper::New();
00121                 dataMapper->SetInput(STLReader->GetOutput());
00122                 
00123                 vtkActor* dataActor = vtkActor::New();
00124                 dataActor->SetMapper(dataMapper);       
00125                 dataActor->GetProperty()->SetOpacity(1);
00126                 
00127                 return dataActor;
00128         }       
00129         return NULL;
00130 }

Here is the caller graph for this function:

wxMaracasIRMViewManagerData * wxMaracasIRMViewManager::getViewData ( int  id  )  throw (char*)

Given an id search the data in the vector

Definition at line 152 of file wxMaracasIRMViewManager.cxx.

00152                                                                                     {
00153     int i;
00154         for(i = 0; i < (int)(prop3Dvect.size());i++){
00155                 if(prop3Dvect[i]->getId() == id){
00156                         return prop3Dvect[i];
00157                 }
00158         }
00159         throw "id not found in the data";
00160 
00161         return NULL;
00162 }

void wxMaracasIRMViewManager::setRenderer ( vtkRenderer *  renderer  ) 

Sets the renderer to manage the prop3D from the view

Definition at line 34 of file wxMaracasIRMViewManager.cxx.

References _renderer.

Referenced by wxMaracasIRMView::setRenderer().

00034                                                                {
00035         _renderer = renderer;
00036 }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 100 of file wxMaracasIRMViewManager.h.

Referenced by wxMaracasIRMViewManager().

vtkRenderer* wxMaracasIRMViewManager::_renderer [private]

Definition at line 98 of file wxMaracasIRMViewManager.h.

Referenced by checkInvariant(), setRenderer(), and wxMaracasIRMViewManager().

Definition at line 96 of file wxMaracasIRMViewManager.h.


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

Generated on Fri Jun 12 00:08:54 2009 for creaMaracasVisu by  doxygen 1.5.7.1