#include <mitkGradientBackground.h>


Public Types | |
| typedef GradientBackground | Self |
| typedef BaseData | Superclass |
| typedef itk::SmartPointer< Self > | Pointer |
| typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| virtual void | SetRenderWindow (vtkRenderWindow *renderWindow) |
| virtual vtkRenderWindow * | GetRenderWindow () |
| virtual vtkRenderer * | GetVtkRenderer () |
| virtual vtkActor * | GetActor () |
| virtual vtkPolyDataMapper * | GetMapper () |
| virtual void | SetGradientColors (double r1, double g1, double b1, double r2, double g2, double b2) |
| virtual void | SetUpperColor (double r, double g, double b) |
| virtual void | SetLowerColor (double r, double g, double b) |
| virtual void | Enable () |
| virtual void | Disable () |
| virtual bool | IsEnabled () |
| virtual void | SetRequestedRegionToLargestPossibleRegion () |
| virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
| virtual bool | VerifyRequestedRegion () |
| virtual void | SetRequestedRegion (itk::DataObject *) |
Static Public Member Functions | |
| static Pointer | New () |
Protected Member Functions | |
| GradientBackground () | |
| ~GradientBackground () | |
Protected Attributes | |
| vtkRenderWindow * | m_RenderWindow |
| vtkRenderer * | m_Renderer |
| vtkActor * | m_Actor |
| vtkPolyDataMapper * | m_Mapper |
| vtkLookupTable * | m_Lut |
| vtkPolyData * | m_Plane |
Displays a color gradient in the background of a vtkRenderWindow. The gradient ist faked by displaying a non-interactable smoothly shaded plane in a separate layer behind the scene. After setting the renderwindow, the gradient may be activated by calling Enable()
Definition at line 43 of file mitkGradientBackground.h.
| typedef itk::SmartPointer<const Self> mitk::GradientBackground::ConstPointer |
Reimplemented from mitk::BaseData.
Definition at line 47 of file mitkGradientBackground.h.
| typedef itk::SmartPointer<Self> mitk::GradientBackground::Pointer |
Reimplemented from mitk::BaseData.
Definition at line 47 of file mitkGradientBackground.h.
Reimplemented from mitk::BaseData.
Definition at line 47 of file mitkGradientBackground.h.
Reimplemented from mitk::BaseData.
Definition at line 47 of file mitkGradientBackground.h.
| mitk::GradientBackground::GradientBackground | ( | ) | [protected] |
Constructor
Definition at line 39 of file mitkGradientBackground.cpp.
References m_Actor, m_Lut, m_Mapper, m_Plane, m_Renderer, m_RenderWindow, and New().
{
m_RenderWindow = NULL;
m_Renderer = vtkRenderer::New();
m_Actor = vtkActor::New();
m_Mapper = vtkPolyDataMapper::New();
m_Lut = vtkLookupTable::New();
m_Plane = vtkPolyData::New();
vtkPoints* points = vtkPoints::New( );
points->InsertPoint(0,-10,0,0);
points->InsertPoint(1,-10,1,0);
points->InsertPoint(2,10,1,0);
points->InsertPoint(3,10,0,0);
vtkCellArray* cellArray = vtkCellArray::New();
cellArray->InsertNextCell(4);
cellArray->InsertCellPoint(0);
cellArray->InsertCellPoint(1);
cellArray->InsertCellPoint(2);
cellArray->InsertCellPoint(3);
vtkUnsignedIntArray* data = vtkUnsignedIntArray::New();
data->InsertTuple1(0,1);
data->InsertTuple1(1,0);
data->InsertTuple1(2,0);
data->InsertTuple1(3,1);
m_Plane->SetPoints( points );
m_Plane->SetPolys( cellArray );
m_Plane->GetPointData()->SetScalars( data );
points->Delete();
cellArray->Delete();
data->Delete();
m_Lut->SetNumberOfColors( 2 );
m_Lut->Build();
m_Lut->SetTableValue( m_Lut->GetIndex(0), 1, 1, 1 );
m_Lut->SetTableValue( m_Lut->GetIndex(1), 0, 0, 0 );
m_Mapper->SetInput( m_Plane );
m_Mapper->SetLookupTable( m_Lut );
//m_Mapper->ImmediateModeRenderingOn();
m_Actor->SetMapper( m_Mapper );
m_Renderer->AddActor( m_Actor );
m_Renderer->InteractiveOff();
m_Renderer->GetActiveCamera()->ParallelProjectionOn();
m_Renderer->ResetCamera();
m_Renderer->GetActiveCamera()->SetParallelScale(0.5);
}
| mitk::GradientBackground::~GradientBackground | ( | ) | [protected] |
Destructor
Definition at line 94 of file mitkGradientBackground.cpp.
{
if ( m_RenderWindow != NULL )
if ( this->IsEnabled() )
this->Disable();
if ( m_Plane != NULL )
m_Plane->Delete();
if( m_Lut != NULL )
m_Lut->Delete();
if ( m_Mapper != NULL )
m_Mapper->Delete();
if ( m_Actor!=NULL )
m_Actor->Delete();
if ( m_Renderer != NULL )
m_Renderer->Delete();
}
| void mitk::GradientBackground::Disable | ( | ) | [virtual] |
Disables drawing of the color gradient background. If you want to enable it, call the Enable() function.
Definition at line 199 of file mitkGradientBackground.cpp.
References mitk::VtkLayerController::GetInstance(), and mitk::VtkLayerController::RemoveRenderer().
{
if ( this->IsEnabled() )
{
mitk::VtkLayerController::GetInstance(m_RenderWindow)->RemoveRenderer(m_Renderer);
}
}
| void mitk::GradientBackground::Enable | ( | ) | [virtual] |
Enables drawing of the color gradient background. If you want to disable it, call the Disable() function.
Definition at line 190 of file mitkGradientBackground.cpp.
References mitk::VtkLayerController::GetInstance(), and mitk::VtkLayerController::InsertBackgroundRenderer().
{
mitk::VtkLayerController::GetInstance(m_RenderWindow)->InsertBackgroundRenderer(m_Renderer,true);
}
| vtkActor * mitk::GradientBackground::GetActor | ( | ) | [virtual] |
Returns the actor associated with the color gradient
Definition at line 148 of file mitkGradientBackground.cpp.
{
return m_Actor;
}
| virtual const char* mitk::GradientBackground::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::BaseData.
| vtkPolyDataMapper * mitk::GradientBackground::GetMapper | ( | ) | [virtual] |
Returns the mapper associated with the color gradient.
Definition at line 157 of file mitkGradientBackground.cpp.
{
return m_Mapper;
}
| vtkRenderWindow * mitk::GradientBackground::GetRenderWindow | ( | ) | [virtual] |
Returns the vtkRenderWindow, which is used for displaying the gradient background
Definition at line 130 of file mitkGradientBackground.cpp.
{
return m_RenderWindow;
}
| vtkRenderer * mitk::GradientBackground::GetVtkRenderer | ( | ) | [virtual] |
Returns the renderer responsible for rendering the color gradient into the vtkRenderWindow
Definition at line 140 of file mitkGradientBackground.cpp.
{
return m_Renderer;
}
| bool mitk::GradientBackground::IsEnabled | ( | ) | [virtual] |
Checks, if the gradient background is currently enabled (visible)
Definition at line 213 of file mitkGradientBackground.cpp.
References mitk::VtkLayerController::GetInstance().
{
if ( m_RenderWindow == NULL )
return false;
else
return ( mitk::VtkLayerController::GetInstance(m_RenderWindow)->IsRendererInserted(m_Renderer));
}
| static Pointer mitk::GradientBackground::New | ( | ) | [static] |
| bool mitk::GradientBackground::RequestedRegionIsOutsideOfTheBufferedRegion | ( | ) | [virtual] |
Empty implementation, since the GradientBackground doesn't support the requested region concept
Implements mitk::BaseData.
Definition at line 226 of file mitkGradientBackground.cpp.
{
return false;
}
| void mitk::GradientBackground::SetGradientColors | ( | double | r1, |
| double | g1, | ||
| double | b1, | ||
| double | r2, | ||
| double | g2, | ||
| double | b2 | ||
| ) | [virtual] |
| void mitk::GradientBackground::SetLowerColor | ( | double | r, |
| double | g, | ||
| double | b | ||
| ) | [virtual] |
Definition at line 180 of file mitkGradientBackground.cpp.
| void mitk::GradientBackground::SetRenderWindow | ( | vtkRenderWindow * | renderWindow ) | [virtual] |
Sets the renderwindow, in which the gradient background will be shown. Make sure, you have called this function before calling Enable()
Definition at line 121 of file mitkGradientBackground.cpp.
{
m_RenderWindow = renderWindow;
}
| void mitk::GradientBackground::SetRequestedRegion | ( | itk::DataObject * | ) | [virtual] |
Empty implementation, since the GradientBackground doesn't support the requested region concept
Implements mitk::BaseData.
Definition at line 236 of file mitkGradientBackground.cpp.
{
//nothing to do
}
| void mitk::GradientBackground::SetRequestedRegionToLargestPossibleRegion | ( | ) | [virtual] |
Empty implementation, since the GradientBackground doesn't support the requested region concept
Implements mitk::BaseData.
Definition at line 221 of file mitkGradientBackground.cpp.
{
//nothing to do
}
| void mitk::GradientBackground::SetUpperColor | ( | double | r, |
| double | g, | ||
| double | b | ||
| ) | [virtual] |
Definition at line 174 of file mitkGradientBackground.cpp.
| bool mitk::GradientBackground::VerifyRequestedRegion | ( | ) | [virtual] |
Empty implementation, since the GradientBackground doesn't support the requested region concept
Implements mitk::BaseData.
Definition at line 231 of file mitkGradientBackground.cpp.
{
return true;
}
vtkActor* mitk::GradientBackground::m_Actor [protected] |
Definition at line 148 of file mitkGradientBackground.h.
Referenced by GradientBackground().
vtkLookupTable* mitk::GradientBackground::m_Lut [protected] |
Definition at line 152 of file mitkGradientBackground.h.
Referenced by GradientBackground().
vtkPolyDataMapper* mitk::GradientBackground::m_Mapper [protected] |
Definition at line 150 of file mitkGradientBackground.h.
Referenced by GradientBackground().
vtkPolyData* mitk::GradientBackground::m_Plane [protected] |
Definition at line 154 of file mitkGradientBackground.h.
Referenced by GradientBackground().
vtkRenderer* mitk::GradientBackground::m_Renderer [protected] |
Definition at line 146 of file mitkGradientBackground.h.
Referenced by GradientBackground().
vtkRenderWindow* mitk::GradientBackground::m_RenderWindow [protected] |
Definition at line 144 of file mitkGradientBackground.h.
Referenced by GradientBackground().
1.7.2