10.11. pointCloud#
- class itom.pointCloud(type=point.PointInvalid)#
- class itom.pointCloud(pointCloud, indices=None) pointCloud
- class itom.pointCloud(width, height, point=None) pointCloud
- class itom.pointCloud(singlePoint) pointCloud
Creates new point cloud.
Possible point types of this point cloud are:
point.PointXYZpoint.PointXYZIpoint.PointXYZRGBApoint.PointXYZNormalpoint.PointXYZINormalpoint.PointXYZRGBNormal
- Parameters:
- type
int,optional The type of this point cloud.
- pointCloud
pointCloud Creates a point cloud from this
pointCloud.- indicessequence
ofintor iterableofint,optional Only the indices of the given
pointCloudare used to create this cloud object.- width
int Width of the new point cloud.
- height
int Height of the new point cloud (the point cloud is
denseif height > 1).- point
point,optional If a
widthand / orheightis given, this optionalpointis used to initialize every point in the cloud with this value. If the constructor overload with onepointargument is used, this cloud only consists of this one point. If nopointis given, by awidthandheight, an invalid cloud type will be initialized.- singlePoint
point Creates a point cloud with this
singlePoint. The type is also derived from the type of thesinglePoint.
- type
- Returns:
- cloud
pointCloud the initialized point cloud
- cloud
- append(pointCloud) None#
- append(point) None
- append(xyz) None
- append(xyzi) None
- append(xyz, rgba) None
- append(xyz_normal_curvature) None
- append(xyz_i_normal_curvature) None
- append(xyz_normal_curvature, rgba) None
Appends another point cloud or a point, e.g. given by its coordinates etc., to this cloud.
In all cases, the type of the point or pointCloud, or the correct overload must fit to the type of this point cloud. Else a
RuntimeErroris thrown. If this cloud has an invalid type and apointor apointCloudis given, the type of this arguments is used to initialize this point cloud.- Parameters:
- pointCloud
pointCloud is another pointCloud, appended to this cloud. If this cloud was uninitialized yet (
type=pointCloud.PointInvalid), the type of the givenpointCloudis used.- point
point is another
point, appended to this cloud. If this cloud was uninitialized yet (type=pointCloud.PointInvalid), the type of the givenpointis used.- xyzsequence
offloator iterableoffloat Only possible if
type = pointCloud.PointXYZorpointCloud.PointXYZRGBA: A point with the given(x, y, z)tuple, list, sequence, array… is added to this point cloud.- xyzisequence
offloator iterableoffloat Only possible if
type = pointCloud.PointXYZI: A point with the given(x, y, z, intensity)tuple, list, sequence, array… is added to this point cloud.- xyz_normal_curvaturesequence
offloator iterableoffloat Only possible if
type = pointCloud.PointXYZNormalorpointCloud.PointXYZRGBNormal: A point with the given(x, y, z, nx, ny, nz, curvature)tuple, list, sequence, array… is added to this point cloud.- xyz_i_normal_curvaturesequence
offloator iterableoffloat Only possible if
type = pointCloud.PointXYZINormal: A point with the given(x, y, z, intensity, nx, ny, nz, curvature)tuple, list, sequence, array… is added to this point cloud.- rgbasequence
offloator iterableoffloat Only possible if
type = pointCloud.PointXYZRGBAorpointCloud.PointXYZRGBNormal: The added point gets the color defined by this(red, green, blue, alpha)tuple…
- pointCloud
- clear()#
Clears the whole point cloud.
- copy() pointCloud#
Returns a deep copy of this point cloud.
- Returns:
- cloud
pointCloud An exact copy if this point cloud.
- cloud
- dense#
bool: Gets or sets if all points have finite coordinates (True), or if some might contain Inf / NaN values (False).
- erase(indices)#
Erases the points in point clouds indicated by indices.
- Parameters:
Notes
This method is the same than typing
del myPointCloud[indices].
- fields#
list of
str: Gets a list of all available field names of this point cloud.This property returns a list of field names that are contained in this cloud, e.g. [‘x’, ‘y’, ‘z’].
- static fromTopography(topography, intensity=None, deleteNaN=False, color=None) pointCloud#
Creates a point cloud from a given topography dataObject.
Creates a point cloud from the 2.5D data set given by the topography
dataObject. The x and y-components of each point are taken from the regular grid, spanned by the coordinate system oftopography(considering the scaling and offset of the object). The corresponding z-value is the topography’s value itself.- Parameters:
- topography
dataObject M x N, float32dataObjectare the topography values.- intensity
dataObject,optional a
M x N, float32dataObject. If given, apoint.PointXYZIpointCloudis created whose intensity values are determined by this argument (cannot be used together withcolor).- deleteNaNbool,
optional If
True,NaNorInfz-coordiantes in thetopographyobject will not be copied into the point cloud (the point cloud is not organized any more).- color
dataObject,optional a
M x N, rgba32dataObject. If given, apoint.PointXYZRGBApointCloudis created whose color values are determined by this argument (cannot be used together withintensity).
- topography
- Returns:
pointCloudthe newly created
pointCloud(either of typepoint.POINTXYZIorpoint.PointXYZRGBA.
- static fromXYZ(X, Y, Z, deleteNaN=False) pointCloud#
- static fromXYZ(XYZ, deleteNaN=False) pointCloud
Creates a point cloud from three X,Y,Z dataObjects or from one 3xMxN or Mx3 dataObject.
The created point cloud is not organized (
height = 1) anddense, if noNaNorInfvalues are within thepointCloud.denseisTrueforever, ifdeleteNaN = True.- Parameters:
- X
dataObject A
M x Nfloat32dataObjectwith the x-coordinates of all points.- Y
dataObject A
M x Nfloat32dataObjectwith the y-coordinates of all points.- Z
dataObject A
M x Nfloat32dataObjectwith the z-coordinates of all points.- XYZ
dataObject Either a
3 x M x Nfloat32dataObject, where the first plane[0,:,:]contains the x-coordiantes, the 2nd plane[1,:,:]the y-coordinates and the 3rd plane the z-coordinates. Or aM x 3float32dataObject, where each row represents one point, that consists of the x-, y- and z-coordinates.- deleteNaNbool
if
Trueall points, whose coordinate has at least oneNaNcomponent, will be skipped. Else, they are also put to the cloud, however it is notdenseanymore.
- X
- Returns:
pointCloudThe newly created point cloud of the type
point.PointXYZ.
Notes
The
dataObjectX,Y,Z,XYZare recommended to have thedtypefloat32. However, it is possible to pass any real data type, that is then implicitly converted to float32.
- static fromXYZI(X, Y, Z, I, deleteNaN=False) pointCloud#
- static fromXYZI(XYZ, I, deleteNaN=False) pointCloud
Creates a point cloud from four X, Y, Z, I dataObjects or from one 3xMxN or Mx3 dataObject and one I dataObject.
The created point cloud is not organized (
height = 1) anddense, if noNaNorInfvalues are within thepointCloud.denseisTrueforever, ifdeleteNaN = True.- Parameters:
- X
dataObject A
M x Nfloat32dataObjectwith the x-coordinates of all points.- Y
dataObject A
M x Nfloat32dataObjectwith the y-coordinates of all points.- Z
dataObject A
M x Nfloat32dataObjectwith the z-coordinates of all points.- XYZ
dataObject Either a
3 x M x Nfloat32dataObject, where the first plane[0,:,:]contains the x-coordiantes, the 2nd plane[1,:,:]the y-coordinates and the 3rd plane the z-coordinates. Or aM x 3float32dataObject, where each row represents one point, that consists of the x-, y- and z-coordinates.- I
dataObject A
M x Nfloat32dataObjectwith the intensity values of all points.- deleteNaNbool
if
Trueall points, whose coordinate has at least oneNaNcomponent, will be skipped. Else, they are also put to the cloud, however it is notdenseanymore.
- X
- Returns:
pointCloudThe newly created point cloud of the type
point.PointXYZI.
Notes
The
dataObjectX,Y,Z,XYZandIare recommended to have thedtypefloat32. However, it is possible to pass any real data type, that is then implicitly converted to float32.
- static fromXYZRGBA(X, Y, Z, color, deleteNaN=False) pointCloud#
- static fromXYZRGBA(XYZ, color, deleteNaN=False) pointCloud
Creates a point cloud from three X, Y, Z, color dataObjects or from one 3xMxN or Mx3 dataObject and one color dataObject.
The created point cloud is not organized(
height = 1) anddense, if noNaNorInfvalues are within the : class :pointCloud. : attr :denseisTrueforever, ifdeleteNaN = True.- Parameters:
- X
dataObject A
M x Nfloat32 :class :dataObjectwith the x - coordinates of all points.- Y
dataObject A
M x Nfloat32 :class :dataObjectwith the y - coordinates of all points.- Z
dataObject A
M x Nfloat32 :class :dataObjectwith the z - coordinates of all points.- XYZ
dataObject Either a
3 x M x Nfloat32 :class :dataObject, where the first plane[0, :, : ]contains the x - coordinates, the 2nd plane[1, :, : ]the y - coordinates and the 3rd plane the z - coordinates.Or aM x 3float32 :class :dataObject, where each row represents one point, that consists of the x - , y - and z - coordinates.- color
dataObject M x NdataObjectwith the colors for each point, type: rgba32.- deleteNaNbool
if
Trueall points, whose coordinate has at least oneNaNcomponent, will be skipped.Else, they are also put to the cloud, however it is notdenseanymore.
- X
- Returns:
pointCloudThe newly created point cloud of the type
point.PointXYZRGBA.
Notes
The
dataObjectX,Y,Z,XYZare recommended to have thedtypefloat32. However, it is possible to pass any real data type, that is then implicitly converted to float32.
- height#
int: Gets the height of this point cloud if it is organized as regular grid, else 1.The height of a point cloud is equal to
1, if the points in the point cloud are not organized. If the cloud is organized, all points are assumed to lie on a regular grid, such that neighbouring points in the grid are adjacent in space, too. In this case, the height is the number of rows in this grid. The total number of points is thenheight * width.
- insert(index, values)#
Inserts a single point or a sequence of points before position given by index.
By this method, a
pointor a sequence of points is inserted into the existingpointCloud.The new points are inserted before the existing value at the index-th position.
The type of the inserted points must fit to the type of the point cloud.
- Parameters:
- moveXYZ(x=0.0, y=0.0, z=0.0)#
Moves the x, y and z components of every point by the given offsets.
- name() str#
Returns the name of this object.
- Returns:
strreturns the name of this object:
PointCloud.
- organized#
bool: returnsTrueif this point cloud is organized, elseFalse.Points in an organized point cloud are assumed to lie on a regular grid, defined by
heightandwidth. Neighbouring points in this grid are the neighbours in space, too. An unorganized point cloud has always a height equal to1andwidthequal to the total number of points.
- scaleXYZ(x=1.0, y=1.0, z=1.0)#
Scales the x, y and z components of every point by the given values.
- toDataObject() dataObject#
Returns a
P x Nfloat32 dataObject with all point data, where P depends on the point type and N is the number of points.The output has at least 3 components per point. The first three rows contain always the
(x, y, z)coordinates of each point.If this cloud has normals defined, these will be added in the next 4 rows as
(nx, ny, nz, curvature). For types, that contain intensity values, the next row contains thisintensityvalue. Point types, that contain colour information for each point will put this information in the upcoming 4 rows, as(red, green, blue, alpha).To sum up, row column patterns are:
(x,y,z),(x,y,z,intensity),(x,y,z,r,g,b,a),(x,y,z,nx,ny,nz,curvature),(x,y,z,nx,ny,nz,curvature,intensity], among others.- Returns:
- dObj
dataObject A
float32dataObjectof sizeP x N(Nis equal toself.size).
- dObj
- type#
int: Gets the point type of this point cloud.Point types can be:
point.PointInvalid= 0x00point.PointXYZ= 0x01point.PointXYZI= 0x02point.PointXYZRGBA= 0x04point.PointXYZNormal= 0x08point.PointXYZINormal= 0x10point.PointXYZRGBNormal0x20
- width#
int: Gets the width of point cloud (if the cloud is not organized, since is equal tosize).The width of a point cloud is equal to the number of total points, if the points in the point cloud are not organized. If it is organized, all points are assumed to lie on a regular grid, such that neighbouring points in the grid are adjacent in space, too. In this case, the width is the number of columns in this grid. The total number of points is then
height * width.