Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
vtkMaskedGlyph2D.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 "vtkMaskedGlyph2D.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 vtkMaskedGlyph2D::SetInput(vtkDataSet *input)
43 {
44  this->MaskPoints->SetInputData(input);
45  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
46 }
47 
49 {
50  this->MaskPoints->SetRandomMode(mode);
51 }
52 
54 {
55  return this->MaskPoints->GetRandomMode();
56 }
57 
58 int vtkMaskedGlyph2D::RequestData(vtkInformation *info,
59  vtkInformationVector **inInfoVec,
60  vtkInformationVector *outInfoVec)
61 {
62  if (this->UseMaskPoints)
63  {
64  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
65  vtkIdType numPts = this->MaskPoints->GetPolyDataInput(0)->GetNumberOfPoints();
66  this->MaskPoints->SetMaximumNumberOfPoints(MaximumNumberOfPoints);
67  this->MaskPoints->SetOnRatio(numPts / MaximumNumberOfPoints);
68  this->MaskPoints->Update();
69  }
70  else
71  {
72  this->Superclass::SetInputData(this->MaskPoints->GetInput());
73  }
74 
75  return this->Superclass::RequestData(info, inInfoVec, outInfoVec);
76 }
77 
78 void vtkMaskedGlyph2D::PrintSelf(ostream &os, vtkIndent indent)
79 {
80  this->Superclass::PrintSelf(os, indent);
81  // os << indent << "InputScalarsSelection: "
82  // << (this->InputScalarsSelection ? this->InputScalarsSelection : "(none)")
83  // << endl;
84 
85  // os << indent << "InputVectorsSelection: "
86  // << (this->InputVectorsSelection ? this->InputVectorsSelection : "(none)")
87  // << endl;
88 
89  // os << indent << "InputNormalsSelection: "
90  // << (this->InputNormalsSelection ? this->InputNormalsSelection : "(none)")
91  // << endl;
92 
93  os << indent << "MaximumNumberOfPoints: " << this->GetMaximumNumberOfPoints() << endl;
94 
95  os << indent << "UseMaskPoints: " << (this->UseMaskPoints ? "on" : "off") << endl;
96 }
vtkMaskPoints * MaskPoints
vtkStandardNewMacro(vtkMaskedGlyph2D)
void PrintSelf(ostream &os, vtkIndent indent) override
virtual int RequestData(vtkInformation *info, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec) override
static void info(const char *fmt,...)
Definition: svm.cpp:100
virtual void SetInput(vtkDataSet *input)
void SetRandomMode(int mode)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.