VMTK
Loading...
Searching...
No Matches
vtkvmtkReferenceSystemUtilities.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3Program: VMTK
4Module: $RCSfile: vtkvmtkReferenceSystemUtilities.cxx,v $
5Language: C++
6Date: $Date: 2005/07/28 16:11:52 $
7Version: $Revision: 1.1 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notices for more information.
19
20=========================================================================*/
21
23#include "vtkPolyData.h"
24#include "vtkPointData.h"
25#include "vtkObjectFactory.h"
26
27
29
30vtkIdType vtkvmtkReferenceSystemUtilities::GetReferenceSystemPointId(vtkPolyData* referenceSystems, const char* groupIdsArrayName, vtkIdType groupId)
31{
32 vtkDataArray* groupIdsArray = referenceSystems->GetPointData()->GetArray(groupIdsArrayName);
33 int numberOfPoints = referenceSystems->GetNumberOfPoints();
34
35 vtkIdType pointId = -1;
36 for (int i=0; i<numberOfPoints; i++)
37 {
38 vtkIdType current_groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
39 if (current_groupId == groupId)
40 {
41 pointId = i;
42 break;
43 }
44 }
45 return pointId;
46}
Utility functions for looking up branch reference system points by group id.
static vtkIdType GetReferenceSystemPointId(vtkPolyData *referenceSystems, const char *groupIdsArrayName, vtkIdType groupId)
vtkStandardNewMacro(vtkvmtkReferenceSystemUtilities)