21 #include <vtkPolyDataMapper.h>
22 #include <vtkArrowSource.h>
23 #include <vtkLineSource.h>
24 #include <vtkImageData.h>
25 #include <vtkPolyData.h>
26 #include <vtkPointData.h>
27 #include <vtkLookupTable.h>
48 return m_Glyph3DActor;
56 if ( m_Glyph3DMapper != NULL )
57 m_Glyph3DMapper->Delete();
58 if ( m_Glyph3DGenerator != NULL )
59 m_Glyph3DGenerator->Delete();
70 GetDataNode()->GetVisibility(visible, renderer,
"visible");
74 if ( m_Glyph3DActor != NULL )
75 m_Glyph3DActor->VisibilityOff();
80 if ( m_Glyph3DActor != NULL )
81 m_Glyph3DActor->VisibilityOn();
98 if ( mitkImage.GetPointer() == NULL )
100 itkWarningMacro( <<
"VectorImage is null !" );
107 if ( mitkImage->GetPixelType().GetNumberOfComponents() <= 1 )
109 itkWarningMacro( <<
"VectorImage has only one scalar component!" );
113 vtkImageData* vtkImage = mitkImage->GetVtkImageData();
118 vtkPointData* pointData = vtkImage->GetPointData();
119 if ( pointData == NULL )
121 itkWarningMacro( <<
"vtkImage->GetPointData() returns NULL!" );
124 if ( pointData->GetNumberOfArrays() == 0 )
126 itkWarningMacro( <<
"vtkImage->GetPointData()->GetNumberOfArrays() is 0!" );
129 else if ( pointData->GetArrayName( 0 ) == NULL )
131 vtkImage->GetPointData() ->GetArray( 0 ) ->SetName(
"vector" );
134 if ( vtkImage->GetNumberOfPoints() != 0 )
142 if ( m_GlyphType == LineGlyph )
145 lineSource->Update();
146 glyph = lineSource->GetOutput();
148 else if ( m_GlyphType == ArrowGlyph )
151 arrowSource->Update();
152 glyph = arrowSource->GetOutput();
158 itkWarningMacro( <<
"unknown glyph type!" );
160 lineSource->Update();
161 glyph = lineSource->GetOutput();
163 m_RandomMode =
false;
164 m_UseMaskPoints =
false;
165 m_MaximumNumberOfPoints = 80*80*80;
169 m_Glyph3DGenerator->SetSourceData( glyph );
170 m_Glyph3DGenerator->SetInput( vtkImage );
172 m_Glyph3DGenerator->SetInputArrayToProcess (1, 0,0, vtkDataObject::FIELD_ASSOCIATION_POINTS ,
"vector");
175 m_Glyph3DGenerator->OrientOn();
176 m_Glyph3DGenerator->SetVectorModeToUseVector();
177 m_Glyph3DGenerator->SetScaleFactor( 0.00392156862745 );
178 m_Glyph3DGenerator->SetScaleModeToScaleByVector();
179 m_Glyph3DGenerator->SetUseMaskPoints( m_UseMaskPoints );
180 m_Glyph3DGenerator->SetRandomMode( m_RandomMode );
181 m_Glyph3DGenerator->SetMaximumNumberOfPoints( m_MaximumNumberOfPoints );
182 m_Glyph3DGenerator->Update();
183 m_Glyph3DMapper->SetInputConnection( m_Glyph3DGenerator->GetOutputPort() );
184 m_Glyph3DActor->SetMapper( m_Glyph3DMapper );
186 if (GetDataNode()->GetProperty(
"LookupTable"))
189 m_Glyph3DMapper->Update();
190 mitkLookupTable->SetVtkLookupTable(dynamic_cast<vtkLookupTable*>(m_Glyph3DMapper->GetLookupTable()));
192 GetDataNode()->SetProperty(
"LookupTable", LookupTableProp );
197 if (mitkLutProp.IsNotNull())
198 m_Glyph3DMapper->
SetLookupTable( mitkLutProp->GetLookupTable()->GetVtkLookupTable() );
Base class for mapper specific rendering ressources.
Organizes the rendering process.
static vtkMaskedGlyph3D * New()
unsigned int m_MaximumNumberOfPoints
VectorImageVtkGlyphMapper3D()
vtkPolyDataMapper * m_Glyph3DMapper
void SetLookupTable(const mitk::LookupTable::Pointer aLookupTable)
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode) const
The LookupTableProperty class Property to associate mitk::LookupTable to an mitk::DataNode.
vtkActor * m_Glyph3DActor
vtkMaskedGlyph3D * m_Glyph3DGenerator
Image class for storing images.
virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
virtual ~VectorImageVtkGlyphMapper3D()
void UpdateGenerateDataTime()
virtual vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.