00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "vtkMaskedGlyph2D.h" 00019 00020 #include "vtkMaskPoints.h" 00021 #include "vtkObjectFactory.h" 00022 #include "vtkPolyData.h" 00023 00024 vtkStandardNewMacro(vtkMaskedGlyph2D); 00025 vtkCxxRevisionMacro(vtkMaskedGlyph2D, ""); 00026 00027 vtkMaskedGlyph2D::vtkMaskedGlyph2D() 00028 { 00029 this->SetColorModeToColorByScalar(); 00030 this->SetScaleModeToScaleByVector(); 00031 this->MaskPoints = vtkMaskPoints::New(); 00032 this->MaximumNumberOfPoints = 5000; 00033 this->UseMaskPoints = 1; 00034 } 00035 00036 vtkMaskedGlyph2D::~vtkMaskedGlyph2D() 00037 { 00038 if(this->MaskPoints) 00039 { 00040 this->MaskPoints->Delete(); 00041 } 00042 } 00043 00044 void vtkMaskedGlyph2D::SetInput(vtkDataSet *input) 00045 { 00046 this->MaskPoints->SetInput(input); 00047 this->Superclass::SetInput(this->MaskPoints->GetOutput()); 00048 } 00049 00050 void vtkMaskedGlyph2D::SetRandomMode(int mode) 00051 { 00052 this->MaskPoints->SetRandomMode(mode); 00053 } 00054 00055 int vtkMaskedGlyph2D::GetRandomMode() 00056 { 00057 return this->MaskPoints->GetRandomMode(); 00058 } 00059 00060 void vtkMaskedGlyph2D::Execute() 00061 { 00062 if (this->UseMaskPoints) 00063 { 00064 this->Superclass::SetInput(this->MaskPoints->GetOutput()); 00065 vtkIdType numPts = this->MaskPoints->GetPolyDataInput(0)->GetNumberOfPoints(); 00066 this->MaskPoints->SetMaximumNumberOfPoints(MaximumNumberOfPoints); 00067 this->MaskPoints->SetOnRatio(numPts / MaximumNumberOfPoints); 00068 this->MaskPoints->Update(); 00069 } 00070 else 00071 { 00072 this->Superclass::SetInput(this->MaskPoints->GetInput()); 00073 } 00074 00075 this->Superclass::Execute(); 00076 } 00077 00078 void vtkMaskedGlyph2D::PrintSelf(ostream& os, vtkIndent indent) 00079 { 00080 this->Superclass::PrintSelf(os,indent); 00081 //os << indent << "InputScalarsSelection: " 00082 // << (this->InputScalarsSelection ? this->InputScalarsSelection : "(none)") 00083 // << endl; 00084 00085 //os << indent << "InputVectorsSelection: " 00086 // << (this->InputVectorsSelection ? this->InputVectorsSelection : "(none)") 00087 // << endl; 00088 00089 //os << indent << "InputNormalsSelection: " 00090 // << (this->InputNormalsSelection ? this->InputNormalsSelection : "(none)") 00091 // << endl; 00092 00093 os << indent << "MaximumNumberOfPoints: " << this->GetMaximumNumberOfPoints() 00094 << endl; 00095 00096 os << indent << "UseMaskPoints: " << (this->UseMaskPoints?"on":"off") << endl; 00097 }