29 #include <vtkAssembly.h>
30 #include <vtkDataSetMapper.h>
31 #include <vtkFeatureEdges.h>
32 #include <vtkHedgeHog.h>
33 #include <vtkImageData.h>
34 #include <vtkLinearTransform.h>
35 #include <vtkPolyData.h>
36 #include <vtkPolyDataMapper.h>
37 #include <vtkProp3DCollection.h>
38 #include <vtkProperty.h>
39 #include <vtkTransformPolyDataFilter.h>
40 #include <vtkTubeFilter.h>
81 emptyPolyData->Delete();
105 backfaceProperty->SetColor(0.0, 0.0, 0.0);
107 backfaceProperty->Delete();
148 it->second.m_Actor->ReleaseGraphicsResources(0);
191 if ((imageMapper != NULL))
233 bool drawEdges =
true;
239 if (input.IsNotNull() && (input->GetPlaneGeometry() != NULL))
245 if ((surfacecreatorprop.IsNull()) || (surfacecreatorprop->GetSmartPointer().IsNull()) ||
247 dynamic_cast<PlaneGeometryDataToSurfaceFilter *>(surfacecreatorprop->GetSmartPointer().GetPointer()))
258 if (
GetDataNode()->GetIntProperty(
"xresolution", res, renderer))
262 if (
GetDataNode()->GetIntProperty(
"yresolution", res, renderer))
267 double tubeRadius = 1.0;
270 if (input->GetPlaneGeometry()->HasReferenceGeometry())
272 const BaseGeometry *referenceGeometry = input->GetPlaneGeometry()->GetReferenceGeometry();
275 boundingBoxMin = referenceGeometry->
GetBoundingBox()->GetMinimum();
276 boundingBoxMax = referenceGeometry->
GetBoundingBox()->GetMaximum();
280 for (
unsigned int i = 0; i < 3; ++i)
282 boundingBoxMin[i] -= 0.5;
283 boundingBoxMax[i] -= 0.5;
302 tubeRadius = sqrt(
m_SurfaceCreator->GetBoundingBox()->GetDiagonalLength2()) / 450.0;
318 bool displayNormals =
false;
319 bool colorTwoSides =
false;
320 bool invertNormals =
false;
326 if (displayNormals || colorTwoSides)
329 float frontColor[3] = {0.0, 0.0, 1.0};
330 node->
GetColor(frontColor, renderer,
"front color");
331 float backColor[3] = {1.0, 0.0, 0.0};
332 node->
GetColor(backColor, renderer,
"back color");
351 m_BackNormalsActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
373 m_BackgroundActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
374 m_BackgroundActor->GetBackfaceProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
378 m_BackgroundActor->GetProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
379 m_BackgroundActor->GetBackfaceProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
396 for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
400 this->
ProcessNode(node, renderer, surface, layerSortedActors);
405 LayerSortedActorList::iterator actorIt;
406 for (actorIt = layerSortedActors.begin(); actorIt != layerSortedActors.end(); ++actorIt)
414 m_Cleaner->SetInputData(surfacePolyData);
423 if (colorProperty.IsNotNull())
425 const Color &color = colorProperty->GetColor();
426 m_EdgeActor->GetProperty()->SetColor(color.GetRed(), color.GetGreen(), color.GetBlue());
430 m_EdgeActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
438 if (representationProperty != NULL)
456 std::string cname(node->
GetMapper(1)->GetNameOfClass());
457 if (!cname.compare(
"CompositeMapper"))
465 if ((node->
IsVisible(renderer)) && imageMapper)
470 if (rendererProp.IsNotNull())
473 dynamic_cast<BaseRenderer *
>(rendererProp->GetWeakPointer().GetPointer());
477 if (planeRenderer.IsNotNull())
481 imageMapper->
Update(planeRenderer);
486 vtkActor *imageActor;
487 vtkDataSetMapper *dataSetMapper = NULL;
493 dataSetMapper->ImmediateModeRenderingOn();
496 texture->RepeatOff();
499 imageActor->SetMapper(dataSetMapper);
500 imageActor->SetTexture(texture);
501 imageActor->GetProperty()->SetOpacity(
510 dataSetMapper->UnRegister(NULL);
511 texture->UnRegister(NULL);
522 dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
523 texture = imageActor->GetTexture();
528 if ((dataSetMapper != NULL) && (dataSetMapper->GetInput() != surface->
GetVtkPolyData()))
533 dataSetMapper->Update();
545 texture->MapColorScalarsThroughLookupTableOff();
548 imageActor->SetProperty(localStorage->
m_Actor->GetProperty());
549 imageActor->GetProperty()->SetAmbient(0.5);
552 bool textureInterpolation = node->
IsOn(
"texture interpolation", renderer);
553 texture->SetInterpolate(textureInterpolation);
559 layerSortedActors.insert(std::pair<int, vtkActor *>(layer, imageActor));
573 m_ObserverID = sender->AddObserver(itk::DeleteEvent(), command);
579 if (m_Sender != NULL)
581 m_Sender->RemoveObserver(m_ObserverID);
585 m_Actor->ReleaseGraphicsResources(0);
vtkActor * m_FrontNormalsActor
Actor to hold the normals arrows.
Class for storing surfaces (vtkPolyData).
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is NULL, the BaseRenderer-independent PropertyList ...
mitk::BaseProperty * GetProperty(const std::string &propertyKey) const
Get a property by its name.
Data management class that handles 'was created by' relations.
PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
The DataStorage defines which part of the data tree is traversed for renderering. ...
virtual vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
vtkSmartPointer< vtkActor > m_Actor
Actor of a 2D render window.
virtual vtkPolyData * GetVtkPolyData(unsigned int t=0) const
static vtkNeverTranslucentTexture * New()
virtual void Update(mitk::BaseRenderer *renderer) override
Checks whether this mapper needs to update itself and generate data.
bool GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for int properties (instances of IntProperty)
vtkTransformPolyDataFilter * m_NormalsTransformer
Transforms the suface before applying the glyph filter.
Organizes the rendering process.
virtual void GenerateDataForRenderer(BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
LocalStorage * GetLocalStorage(mitk::BaseRenderer *renderer)
Get the LocalStorage corresponding to the current renderer.
DataCollection - Class to facilitate loading/accessing structured data.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void ImageMapperDeletedCallback(itk::Object *caller, const itk::EventObject &event)
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
Property containing a smart-pointer.
vtkPolyDataMapper * m_BackgroundMapper
Mapper for black plane background.
vtkPolyDataMapper * m_BackNormalsMapper
std::multimap< int, vtkActor * > LayerSortedActorList
Property containing a smart-pointer.
void Initialize(vtkActor *actor, itk::Object *sender, itk::Command *command)
MemberCommandType::Pointer m_ImageMapperDeletedCommand
itk::SmartPointer< const Self > ConstPointer
int GetTimestep() const
Returns the current time step as calculated from the renderer.
bool IsVisible(const mitk::BaseRenderer *renderer, const char *propertyKey="visible", bool defaultIsOn=true) const
Convenience access method for visibility properties (instances of BoolProperty). Return value is the ...
The ColorProperty class RGB color property.
Mapper to resample and display 2D slices of a 3D image.
vtkAssembly * m_Prop3DAssembly
general PropAssembly to hold the entire scene
mitk::DataStorage::Pointer m_DataStorage
SetOfObjects::ConstPointer GetSubset(const NodePredicateBase *condition) const
returns a set of data objects that meet the given condition(s)
vtkSmartPointer< vtkMitkLevelWindowFilter > m_LevelWindowFilter
This filter is used to apply the level window to Grayvalue and RBG(A) images.
PlaneGeometryDataVtkMapper3D()
vtkHedgeHog * m_BackHedgeHog
virtual const PlaneGeometryData * GetInput()
Get the PlaneGeometryData to map.
vtkPolyDataMapper * m_EdgeMapper
Mapper for the tube-shaped frame.
virtual ~PlaneGeometryDataVtkMapper3D()
Data class containing PlaneGeometry objects.
vtkHedgeHog * m_FrontHedgeHog
Generates lines for surface normals.
void ProcessNode(DataNode *node, BaseRenderer *renderer, Surface *surface, LayerSortedActorList &layerSortedActors)
static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper)
Re-issues all drawing commands required to describe the entire scene each time a new frame is require...
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
vtkAssembly * m_ImageAssembly
PropAssembly to hold the planes.
virtual void SetDataStorageForTexture(mitk::DataStorage *storage)
All images found when traversing the (sub-) tree starting at iterator which are resliced by an ImageV...
vtkFeatureEdges * m_Edges
Edge extractor for tube-shaped frame.
mitk::Mapper * GetMapper(MapperSlotId id) const
BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer
vtkTubeFilter * m_EdgeTuber
Source to create the tube-shaped frame.
bool IsOn(const char *propertyKey, const mitk::BaseRenderer *renderer, bool defaultIsOn=true) const
Convenience access method for boolean properties (instances of BoolProperty). Return value is the val...
vtkTransformPolyDataFilter * m_EdgeTransformer
Filter to apply object transform to the extracted edges.
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
double GetDiagonalLength() const
Get the length of the diagonal of the bounding-box in mm.
unsigned long m_ObserverID
vtkActor * m_BackNormalsActor
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override
Set the vtkTransform of the m_Prop3D for the current time step of renderer.
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
virtual int GetVtkRepresentation()
vtkActor * m_BackgroundActor
Actor for black plane background.
mitk::BoundingBox::Pointer ComputeVisibleBoundingBox(const mitk::BaseRenderer *renderer=nullptr, const char *boolPropertyKey=nullptr)
Compute the bounding box of all visible parts of the data tree structure, for general rendering or re...
virtual bool GetImageGeometry() const
Is this an ImageGeometry?
vtkCleanPolyData * m_Cleaner
BaseGeometry Describes the geometry of a data object.
BoundingBox::Pointer m_SurfaceCreatorBoundingBox
vtkPolyDataMapper * m_FrontNormalsMapper
Mapper for normals representation (thin lines)
Class for nodes of the DataTree.
vtkActor * m_EdgeActor
Actor for the tube-shaped frame.
vtkSmartPointer< vtkImageData > m_ReslicedImage
Current slice of a 2D render window.
virtual const BoundingBoxType * GetBoundingBox()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.