Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "vtkMaskedGlyph2D.h"
14 
15 #include "vtkMaskPoints.h"
16 #include "vtkObjectFactory.h"
17 #include "vtkPolyData.h"
18 
20 
22 {
23  this->SetColorModeToColorByScalar();
24  this->SetScaleModeToScaleByVector();
25  this->MaskPoints = vtkMaskPoints::New();
26  this->MaximumNumberOfPoints = 5000;
27  this->UseMaskPoints = 1;
28 }
29 
31 {
32  if (this->MaskPoints)
33  {
34  this->MaskPoints->Delete();
35  }
36 }
37 
38 void vtkMaskedGlyph2D::SetInput(vtkDataSet *input)
39 {
40  this->MaskPoints->SetInputData(input);
41  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
42 }
43 
45 {
46  this->MaskPoints->SetRandomMode(mode);
47 }
48 
50 {
51  return this->MaskPoints->GetRandomMode();
52 }
53 
54 int vtkMaskedGlyph2D::RequestData(vtkInformation *info,
55  vtkInformationVector **inInfoVec,
56  vtkInformationVector *outInfoVec)
57 {
58  if (this->UseMaskPoints)
59  {
60  this->Superclass::SetInputConnection(this->MaskPoints->GetOutputPort());
61  vtkIdType numPts = this->MaskPoints->GetPolyDataInput(0)->GetNumberOfPoints();
62  this->MaskPoints->SetMaximumNumberOfPoints(MaximumNumberOfPoints);
63  this->MaskPoints->SetOnRatio(numPts / MaximumNumberOfPoints);
64  this->MaskPoints->Update();
65  }
66  else
67  {
68  this->Superclass::SetInputData(this->MaskPoints->GetInput());
69  }
70 
71  return this->Superclass::RequestData(info, inInfoVec, outInfoVec);
72 }
73 
74 void vtkMaskedGlyph2D::PrintSelf(ostream &os, vtkIndent indent)
75 {
76  this->Superclass::PrintSelf(os, indent);
77  // os << indent << "InputScalarsSelection: "
78  // << (this->InputScalarsSelection ? this->InputScalarsSelection : "(none)")
79  // << endl;
80 
81  // os << indent << "InputVectorsSelection: "
82  // << (this->InputVectorsSelection ? this->InputVectorsSelection : "(none)")
83  // << endl;
84 
85  // os << indent << "InputNormalsSelection: "
86  // << (this->InputNormalsSelection ? this->InputNormalsSelection : "(none)")
87  // << endl;
88 
89  os << indent << "MaximumNumberOfPoints: " << this->GetMaximumNumberOfPoints() << endl;
90 
91  os << indent << "UseMaskPoints: " << (this->UseMaskPoints ? "on" : "off") << endl;
92 }
vtkMaskPoints * MaskPoints
vtkStandardNewMacro(vtkMaskedGlyph2D)
void PrintSelf(ostream &os, vtkIndent indent) override
int RequestData(vtkInformation *info, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec) override
static void info(const char *fmt,...)
Definition: svm.cpp:86
virtual void SetInput(vtkDataSet *input)
void SetRandomMode(int mode)
~vtkMaskedGlyph2D() override