25 #include <vtkAssembly.h> 26 #include <vtkDataSetMapper.h> 27 #include <vtkFeatureEdges.h> 28 #include <vtkHedgeHog.h> 29 #include <vtkImageData.h> 30 #include <vtkLinearTransform.h> 31 #include <vtkPolyData.h> 32 #include <vtkPolyDataMapper.h> 33 #include <vtkProp3DCollection.h> 34 #include <vtkProperty.h> 35 #include <vtkTransformPolyDataFilter.h> 36 #include <vtkTubeFilter.h> 48 m_Edges = vtkFeatureEdges::New();
75 vtkPolyData *emptyPolyData = vtkPolyData::New();
77 emptyPolyData->Delete();
101 backfaceProperty->SetColor(0.0, 0.0, 0.0);
103 backfaceProperty->Delete();
144 it->second.m_Actor->ReleaseGraphicsResources(
nullptr);
187 if ((imageMapper !=
nullptr))
226 bool drawEdges =
true;
232 if (input.IsNotNull() && (input->GetPlaneGeometry() !=
nullptr))
238 if ((surfacecreatorprop.IsNull()) || (surfacecreatorprop->GetSmartPointer().IsNull()) ||
240 dynamic_cast<PlaneGeometryDataToSurfaceFilter *>(surfacecreatorprop->GetSmartPointer().GetPointer()))
251 if (
GetDataNode()->GetIntProperty(
"xresolution", res, renderer))
255 if (
GetDataNode()->GetIntProperty(
"yresolution", res, renderer))
260 double tubeRadius = 1.0;
263 if (input->GetPlaneGeometry()->HasReferenceGeometry())
265 const BaseGeometry *referenceGeometry = input->GetPlaneGeometry()->GetReferenceGeometry();
267 BoundingBox::PointType boundingBoxMin, boundingBoxMax;
268 boundingBoxMin = referenceGeometry->
GetBoundingBox()->GetMinimum();
269 boundingBoxMax = referenceGeometry->
GetBoundingBox()->GetMaximum();
273 for (
unsigned int i = 0; i < 3; ++i)
275 boundingBoxMin[i] -= 0.5;
276 boundingBoxMax[i] -= 0.5;
295 tubeRadius = sqrt(
m_SurfaceCreator->GetBoundingBox()->GetDiagonalLength2()) / 450.0;
311 bool displayNormals =
false;
312 bool colorTwoSides =
false;
313 bool invertNormals =
false;
319 if (displayNormals || colorTwoSides)
322 float frontColor[3] = {0.0, 0.0, 1.0};
323 node->
GetColor(frontColor, renderer,
"front color");
324 float backColor[3] = {1.0, 0.0, 0.0};
325 node->
GetColor(backColor, renderer,
"back color");
344 m_BackNormalsActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
366 m_BackgroundActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
367 m_BackgroundActor->GetBackfaceProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
371 m_BackgroundActor->GetProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
372 m_BackgroundActor->GetBackfaceProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
387 mitk::DataStorage::SetOfObjects::ConstPointer all =
m_DataStorage.
Lock()->GetSubset(predicateAllImages);
389 for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
393 this->
ProcessNode(node, renderer, surface, layerSortedActors);
398 LayerSortedActorList::iterator actorIt;
399 for (actorIt = layerSortedActors.begin(); actorIt != layerSortedActors.end(); ++actorIt)
407 m_Cleaner->SetInputData(surfacePolyData);
416 if (colorProperty.IsNotNull())
418 const Color &color = colorProperty->GetColor();
419 m_EdgeActor->GetProperty()->SetColor(color.GetRed(), color.GetGreen(), color.GetBlue());
423 m_EdgeActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
431 if (representationProperty !=
nullptr)
449 std::string cname(node->
GetMapper(1)->GetNameOfClass());
450 if (!cname.compare(
"CompositeMapper"))
458 if ((node->
IsVisible(renderer)) && imageMapper)
463 if (rendererProp.IsNotNull())
466 dynamic_cast<BaseRenderer *
>(rendererProp->GetWeakPointer().GetPointer());
470 if (planeRenderer.IsNotNull())
474 imageMapper->Update(planeRenderer);
479 vtkActor *imageActor;
480 vtkDataSetMapper *dataSetMapper =
nullptr;
484 dataSetMapper = vtkDataSetMapper::New();
487 texture->RepeatOff();
489 imageActor = vtkActor::New();
490 imageActor->SetMapper(dataSetMapper);
491 imageActor->SetTexture(texture);
492 imageActor->GetProperty()->SetOpacity(
501 dataSetMapper->UnRegister(
nullptr);
502 texture->UnRegister(
nullptr);
513 dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
514 texture = imageActor->GetTexture();
519 if ((dataSetMapper !=
nullptr) && (dataSetMapper->GetInput() != surface->
GetVtkPolyData()))
524 dataSetMapper->Update();
536 texture->SetColorModeToDirectScalars();
539 imageActor->SetProperty(localStorage->
m_Actor->GetProperty());
540 imageActor->GetProperty()->SetAmbient(0.5);
543 bool textureInterpolation = node->
IsOn(
"texture interpolation", renderer);
544 texture->SetInterpolate(textureInterpolation);
550 layerSortedActors.insert(std::pair<int, vtkActor *>(layer, imageActor));
564 m_ObserverID = sender->AddObserver(itk::DeleteEvent(), command);
576 m_Actor->ReleaseGraphicsResources(
nullptr);
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
vtkActor * m_FrontNormalsActor
Actor to hold the normals arrows.
Class for storing surfaces (vtkPolyData).
virtual bool GetImageGeometry() const
Is this an ImageGeometry?
Data management class that handles 'was created by' relations.
itk::SmartPointer< T > Lock() const
virtual vtkPolyData * GetVtkPolyData(unsigned int t=0) const
PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
The DataStorage defines which part of the data tree is traversed for renderering. ...
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
vtkSmartPointer< vtkActor > m_Actor
Actor of a 2D render window.
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
static vtkNeverTranslucentTexture * New()
vtkTransformPolyDataFilter * m_NormalsTransformer
Transforms the suface before applying the glyph filter.
Organizes the rendering process.
void GenerateDataForRenderer(BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
DataCollection - Class to facilitate loading/accessing structured data.
void ImageMapperDeletedCallback(itk::Object *caller, const itk::EventObject &event)
Property containing a smart-pointer.
vtkPolyDataMapper * m_BackgroundMapper
Mapper for black plane background.
vtkPolyDataMapper * m_BackNormalsMapper
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
std::multimap< int, vtkActor * > LayerSortedActorList
Property containing a smart-pointer.
bool GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for int properties (instances of IntProperty)
void Initialize(vtkActor *actor, itk::Object *sender, itk::Command *command)
MemberCommandType::Pointer m_ImageMapperDeletedCommand
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
The ColorProperty class RGB color property.
Mapper to resample and display 2D slices of a 3D image.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
vtkAssembly * m_Prop3DAssembly
general PropAssembly to hold the entire scene
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 ...
mitk::DataStorage::Pointer m_DataStorage
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
vtkSmartPointer< vtkMitkLevelWindowFilter > m_LevelWindowFilter
This filter is used to apply the level window to Grayvalue and RBG(A) images.
bool IsExpired() const noexcept
PlaneGeometryDataVtkMapper3D()
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...
vtkHedgeHog * m_BackHedgeHog
virtual const PlaneGeometryData * GetInput()
Get the PlaneGeometryData to map.
vtkPolyDataMapper * m_EdgeMapper
Mapper for 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...
Data class containing PlaneGeometry objects.
vtkHedgeHog * m_FrontHedgeHog
Generates lines for surface normals.
vtkLinearTransform * GetVtkTransform(int t=0) const
Get the transformation applied prior to displaying the data as a vtkTransform.
void ProcessNode(DataNode *node, BaseRenderer *renderer, Surface *surface, LayerSortedActorList &layerSortedActors)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
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...
mitk::PropertyList * GetPropertyList(const mitk::BaseRenderer *renderer=nullptr) const
Get the PropertyList of the renderer. If renderer is nullptr, the BaseRenderer-independent PropertyLi...
mitk::Mapper * GetMapper(MapperSlotId id) const
vtkFeatureEdges * m_Edges
Edge extractor for tube-shaped frame.
BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer
vtkTubeFilter * m_EdgeTuber
Source to create the tube-shaped frame.
double GetDiagonalLength() const
Get the length of the diagonal of the bounding-box in mm.
~PlaneGeometryDataVtkMapper3D() override
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.
int GetTimestep() const
Returns the current time step as calculated from the renderer.
mitk::BaseProperty * GetProperty(const std::string &propertyKey) const
Get a property by its name.
unsigned long m_ObserverID
vtkActor * m_BackNormalsActor
void UpdateVtkTransform(mitk::BaseRenderer *renderer) override
Set the vtkTransform of the m_Prop3D for the current time step of renderer.
virtual int GetVtkRepresentation()
vtkActor * m_BackgroundActor
Actor for black plane background.
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()