IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
point_xyzi.py
Go to the documentation of this file.
1from __future__ import annotations
2
3from typing import TYPE_CHECKING
4
5if TYPE_CHECKING:
6 import numpy as np
7
9
10
12 """!
13 @brief
14 Represents a point in 3D space.
15
16 @ingroup ids_peak_icv_python_types_geometry
17 @since ids_peak_icv 1.1
18 """
19
20 def __init__(self, x: float, y: float, z: float, intensity: float) -> None:
21 """!
22 @brief
23 Creates a point with x, y, z and intensity float channels.
24
25 @param x: x coordinate
26 @param y: y coordinate
27 @param z: z coordinate
28 @param intensity: intensity meta data
29
30 @since ids_peak_icv 1.1
31 """
32 PointXYZ.__init__(self, x, y, z)
33 self.intensityintensity = intensity
34
35 def __eq__(self, other: object) -> bool:
36 """!
37 @brief
38 Check if two points of type PointXYZI are equal.
39
40 @param other: Another PointXYZI object OR List of coordinates [x, y, z, i] OR Tuple of coordinates (x, y, z, i)
41
42 @return True if points are equal, False otherwise
43
44 @since ids_peak_icv 1.1
45 """
46
47 if isinstance(other, PointXYZI):
48 return PointXYZ.__eq__(self, other) and self.intensityintensity == other.intensity
49 if isinstance(other, list) or isinstance(other, tuple):
50 if len(other) != 4:
51 return False
52 return bool(self.xxx == other[0] and self.y == other[1] and self.z == other[2] and self.intensityintensity == other[3])
53
54 return False
55
56 def __ne__(self, other: object) -> bool:
57 """!
58 @brief
59 Check if two points of type peak_icv_point_xyz are not equal.
60
61 @param other: Another peak_icv_point_xyz
62
63 @return True if points are not equal, False otherwise
64
65 @since ids_peak_icv 1.1
66 """
67 return not self.__eq____eq__(other)
68
69 def __gt__(self, other: object) -> bool:
70 """!
71 @brief
72 Check if a point of type PointXYZI is greater than another point of type peak_icv_point_xyz.
73
74 @param other: Another PointXYZI
75
76 @return True if point of type PointXYZI is greater than, False otherwise
77
78 @since ids_peak_icv 1.1
79 """
80
81 def gt_point(x: np.float32, y: np.float32, z: np.float32, intensity: float) -> bool:
82 if self.xxx > x:
83 return True
84 elif self.xxx < x:
85 return False
86 else:
87 if self.y > y:
88 return True
89 elif self.y < y:
90 return False
91 else:
92 if self.z > z:
93 return True
94 elif self.z < z:
95 return False
96 else:
97 return bool(self.intensityintensity > intensity)
98
99 if isinstance(other, PointXYZI):
100 return gt_point(other.x, other.y, other.z, other.intensity)
101
102 if isinstance(other, list) or isinstance(other, tuple):
103 if len(other) != 4:
104 return False
105 return gt_point(other[0], other[1], other[2], other[3])
106
107 return False
108
109 def __lt__(self, other: object) -> bool:
110 return (not self.__gt____gt__(other)) and self.__ne____ne__(other)
111
112 def __str__(self) -> str:
113 """!
114 @brief
115 Get a string representation of the PointXYZI.
116
117 @return String representation of the PointXYZI
118
119 @since ids_peak_icv 1.1
120 """
121 return f"({self.x:.3f}, {self.y:.3f}, {self.z:.3f}, {self.intensity})"
bool __eq__(self, object other)
Check if two points of type PointXYZ are equal.
Definition point_xyz.py:30
bool __ne__(self, object other)
Check if two points of type PointXYZ are not equal.
Definition point_xyz.py:55
bool __gt__(self, object other)
Check if a point of type PointXYZ is greater than another point of type PointXYZ.
Definition point_xyz.py:68
bool __eq__(self, object other)
Check if two points of type PointXYZI are equal.
Definition point_xyzi.py:35
None __init__(self, float x, float y, float z, float intensity)
Creates a point with x, y, z and intensity float channels.
Definition point_xyzi.py:20
str __str__(self)
Get a string representation of the PointXYZI.
bool __ne__(self, object other)
Check if two points of type peak_icv_point_xyz are not equal.
Definition point_xyzi.py:56
bool __gt__(self, object other)
Check if a point of type PointXYZI is greater than another point of type peak_icv_point_xyz.
Definition point_xyzi.py:69