vtkMaracasImageViewer2Callback Class Reference

#include <wxVTKRenderWindowInteractorEditContour.h>

List of all members.

Public Member Functions

 vtkMaracasImageViewer2Callback ()
 ~vtkMaracasImageViewer2Callback ()
virtual char const * GetClassName () const
void Execute (vtkObject *caller, unsigned long event, void *vtkNotUsed(callData))

Static Public Member Functions

static
vtkMaracasImageViewer2Callback
New ()

Public Attributes

vtkImageViewer2 * IV
double InitialWindow
double InitialLevel


Detailed Description

Definition at line 48 of file wxVTKRenderWindowInteractorEditContour.h.


Constructor & Destructor Documentation

vtkMaracasImageViewer2Callback::vtkMaracasImageViewer2Callback (  )  [inline]

Definition at line 51 of file wxVTKRenderWindowInteractorEditContour.h.

Referenced by New().

00051 {} ;

Here is the caller graph for this function:

vtkMaracasImageViewer2Callback::~vtkMaracasImageViewer2Callback (  )  [inline]

Definition at line 52 of file wxVTKRenderWindowInteractorEditContour.h.

00052 {} ;


Member Function Documentation

static vtkMaracasImageViewer2Callback* vtkMaracasImageViewer2Callback::New (  )  [inline, static]

Definition at line 53 of file wxVTKRenderWindowInteractorEditContour.h.

References vtkMaracasImageViewer2Callback().

Referenced by wxImageViewerWidget::ConstructVTK(), and wxVtk2DBaseView::SetInteractorStyleImage().

00053                                                {
00054      return new vtkMaracasImageViewer2Callback(); 
00055   }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual char const* vtkMaracasImageViewer2Callback::GetClassName (  )  const [inline, virtual]

Definition at line 57 of file wxVTKRenderWindowInteractorEditContour.h.

00057 { return "vtkMaracasImageViewer2Callback";}

void vtkMaracasImageViewer2Callback::Execute ( vtkObject *  caller,
unsigned long  event,
void *  vtkNotUsed(callData) 
) [inline]

Definition at line 59 of file wxVTKRenderWindowInteractorEditContour.h.

References InitialLevel, InitialWindow, and IV.

00062     {
00063       if (this->IV->GetInput() == NULL)
00064         {
00065         return;
00066         }
00067 
00068       // Reset
00069 
00070       if (event == vtkCommand::ResetWindowLevelEvent)
00071         {
00072         this->IV->GetInput()->UpdateInformation();
00073         this->IV->GetInput()->SetUpdateExtent
00074           (this->IV->GetInput()->GetWholeExtent());
00075         this->IV->GetInput()->Update();
00076         double *range = this->IV->GetInput()->GetScalarRange();
00077         this->IV->SetColorWindow(range[1] - range[0]);
00078         this->IV->SetColorLevel(0.5 * (range[1] + range[0]));
00079         this->IV->Render();
00080         return;
00081         }
00082 
00083       // Start
00084 
00085       if (event == vtkCommand::StartWindowLevelEvent)
00086         {
00087         this->InitialWindow = this->IV->GetColorWindow();
00088         this->InitialLevel = this->IV->GetColorLevel();
00089         return;
00090         }
00091       
00092       // Adjust the window level here
00093 
00094       vtkInteractorStyleImage *isi = 
00095         static_cast<vtkInteractorStyleImage *>(caller);
00096 
00097       int *size = this->IV->GetRenderWindow()->GetSize();
00098       double window = this->InitialWindow;
00099       double level = this->InitialLevel;
00100       
00101       // Compute normalized delta
00102 
00103       double dx = 4.0 * 
00104         (isi->GetWindowLevelCurrentPosition()[0] - 
00105          isi->GetWindowLevelStartPosition()[0]) / size[0];
00106       double dy = 4.0 * 
00107         (isi->GetWindowLevelStartPosition()[1] - 
00108          isi->GetWindowLevelCurrentPosition()[1]) / size[1];
00109       
00110       // Scale by current values
00111 
00112       if (fabs(window) > 0.01)
00113         {
00114         dx = dx * window;
00115         }
00116       else
00117         {
00118         dx = dx * (window < 0 ? -0.01 : 0.01);
00119         }
00120       if (fabs(level) > 0.01)
00121         {
00122         dy = dy * level;
00123         }
00124       else
00125         {
00126         dy = dy * (level < 0 ? -0.01 : 0.01);
00127         }
00128       
00129       // Abs so that direction does not flip
00130 
00131       if (window < 0.0) 
00132         {
00133         dx = -1*dx;
00134         }
00135       if (level < 0.0) 
00136         {
00137         dy = -1*dy;
00138         }
00139       
00140       // Compute new window level
00141 
00142       double newWindow = dx + window;
00143       double newLevel;
00144       newLevel = level - dy;
00145       
00146       // Stay away from zero and really
00147 
00148       if (fabs(newWindow) < 0.01)
00149         {
00150         newWindow = 0.01*(newWindow < 0 ? -1 : 1);
00151         }
00152       if (fabs(newLevel) < 0.01)
00153         {
00154         newLevel = 0.01*(newLevel < 0 ? -1 : 1);
00155         }
00156       
00157       this->IV->SetColorWindow(newWindow);
00158       this->IV->SetColorLevel(newLevel);
00159       this->IV->Render();
00160     }


Member Data Documentation

vtkImageViewer2* vtkMaracasImageViewer2Callback::IV

Definition at line 162 of file wxVTKRenderWindowInteractorEditContour.h.

Referenced by wxImageViewerWidget::ConstructVTK(), Execute(), and wxVtk2DBaseView::SetInteractorStyleImage().

double vtkMaracasImageViewer2Callback::InitialWindow

Definition at line 163 of file wxVTKRenderWindowInteractorEditContour.h.

Referenced by Execute().

double vtkMaracasImageViewer2Callback::InitialLevel

Definition at line 164 of file wxVTKRenderWindowInteractorEditContour.h.

Referenced by Execute().


The documentation for this class was generated from the following file:
Generated on Wed Jul 29 16:36:15 2009 for creaMaracasVisu_lib by  doxygen 1.5.3