ITK  5.4.0 Insight Toolkit
SphinxExamples/src/Core/Common/CreateAPointSet/Code.py
1 #!/usr/bin/env python
2
3 # ==========================================================================
4 #
6 #
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
12 #
13 # Unless required by applicable law or agreed to in writing, software
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # ==========================================================================*/
20
21 import itk
22
23 PixelType = itk.F
24 Dimension = 3
25
26 PointSetType = itk.PointSet[PixelType, Dimension]
27 PointSet = PointSetType.New()
28
29 points = PointSet.GetPoints()
30
31 # Create points
32 p0 = itk.Point[PixelType, Dimension]()
33 p1 = itk.Point[PixelType, Dimension]()
34 p2 = itk.Point[PixelType, Dimension]()
35
36 p0[0] = 0.0
37 p0[1] = 0.0
38 p0[2] = 0.0
39 p1[0] = 0.1
40 p1[1] = 0.0
41 p1[2] = 0.0
42 p2[0] = 0.0
43 p2[1] = 0.1
44 p2[2] = 0.0
45
46 points.InsertElement(0, p0)
47 points.InsertElement(1, p1)
48 points.InsertElement(2, p2)
itk::PointSet
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:82
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53