Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
vtkMaskedGlyph3D.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "vtkMaskedGlyph3D.h"
18 
19 #include "vtkMaskPoints.h"
20 #include "vtkObjectFactory.h"
21 #include "vtkPolyData.h"
22 
24 
26 {
27  this->SetColorModeToColorByScalar();
28  this->SetScaleModeToScaleByVector();
30  this->MaximumNumberOfPoints = 5000;
31  this->UseMaskPoints = 1;
32 }
33 
35 {
36  if (this->MaskPoints)
37  {
38  this->MaskPoints->Delete();
39  }
40 }
41 
42 void vtkMaskedGlyph3D::SetInput(vtkDataSet *input)
43 {
44  this->MaskPoints->SetInputData(input);
45  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
46 }
47 
48 void vtkMaskedGlyph3D::SetInputConnection(vtkAlgorithmOutput *input)
49 {
50  this->MaskPoints->SetInputConnection(input);
51  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
52 }
53 
55 {
56  this->MaskPoints->SetRandomMode(mode);
57 }
58 
60 {
61  return this->MaskPoints->GetRandomMode();
62 }
63 
64 int vtkMaskedGlyph3D::RequestData(vtkInformation *request,
65  vtkInformationVector **inputVector,
66  vtkInformationVector *outputVector)
67 {
68  if (this->UseMaskPoints)
69  {
70  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
71  vtkIdType numPts = this->MaskPoints->GetPolyDataInput(0)->GetNumberOfPoints();
72  this->MaskPoints->SetMaximumNumberOfPoints(MaximumNumberOfPoints);
73  this->MaskPoints->SetOnRatio(numPts / MaximumNumberOfPoints);
74  this->MaskPoints->Update();
75  }
76  else
77  {
78  this->Superclass::SetInputData(this->MaskPoints->GetInput());
79  }
80 
81  return this->Superclass::RequestData(request, inputVector, outputVector);
82 }
83 
84 void vtkMaskedGlyph3D::PrintSelf(ostream &os, vtkIndent indent)
85 {
86  this->Superclass::PrintSelf(os, indent);
87 
88  os << indent << "MaximumNumberOfPoints: " << this->GetMaximumNumberOfPoints() << endl;
89 
90  os << indent << "UseMaskPoints: " << (this->UseMaskPoints ? "on" : "off") << endl;
91 }
vtkMaskPoints * MaskPoints
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void SetInputConnection(vtkAlgorithmOutput *input) override
void SetRandomMode(int mode)
virtual void SetInput(vtkDataSet *input)
vtkStandardNewMacro(vtkMaskedGlyph3D)
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.