mspt.mathTools package¶
Submodules¶
mspt.mathTools.tools module¶
- mspt.mathTools.tools.distEuclideanP1P2(p1, p2)[source]¶
Computes the Euclidean distance
Parameters: - p1 – Coordinates point1 (x,y,z)
- p2 – Coordinates point2 (x,y,z)
Returns: The euclidean distance
- mspt.mathTools.tools.fromCTToIECFixedCoord(X, Y, Z, isocenter)[source]¶
Converts coordinates from Dicom Patient coordinate system to IEC fixed coordinate system:
Parameters: - X – matrix of x coordinates for voxels
- Y – matrix of y coordinates for voxels
- Z – matrix of z coordinates for voxels
- isocenter – [x,y,z] coordinates of the isocenter defined in the RP dicom (plan) file
Returns: A tuple:
- X_iec_f = X - x_isocenter
- Y_iec_f = Y - y_isocenter
- Z_iec_f = Z - z_isocenter
- mspt.mathTools.tools.fromIECFixedToCTCoord(XiecF, YiecF, ZiecF, isocenter)[source]¶
Converts coordinates from IEC fixed coordinate system to Dicom Patient coordinate system.
Parameters: - XiecF – matrix of x coordinates for voxels
- YiecF – matrix of y coordinates for voxels
- ZiecF – matrix of z coordinates for voxels
- isocenter – [x,y,z] coordinates of the isocenter defined in the RP dicom (plan) file
Returns: A tuple:
- X_iec_f = X - x_isocenter
- Y_iec_f = Y - y_isocenter
- Z_iec_f = Z - z_isocenter
- mspt.mathTools.tools.interp(xValue, x1, x2, y1, y2)[source]¶
Interpolates linearly between (x1,y1) and (x2,y2) and return the value for xValue
Parameters: - xValue – value to interpolate
- x1 – x coordinate of the first point
- x2 – x coordinate of the second point
- y1 – y coordinate of the first point
- y2 – y coordinate of the second point
Returns: Interpolated value.
- mspt.mathTools.tools.rot3D(X, Y, Z, n, nr, floatType)[source]¶
Computes the rotation of the X,Y,Z coordinates.
Parameters: - X – 3D numpy array with x coordinates of each voxel
- Y – 3D numpy array with y coordinates of each voxel
- Z – 3D numpy array with z coordinates of each voxel
- n – unit vectors (1 by column) in the initial coordinate system
- nr – unit vectors (1 by column) in the new coordinate system
- floatType – Type of numpy float : ‘float32’ or ‘float64’
Returns: (Xr,Yr,Zr) a tuple of 3D arrays corresponding to the rotated coordinates
- mspt.mathTools.tools.rotateCoordinates(rotMatrix, point, typeFloat)[source]¶
Computes the rotation of a point.
Parameters: - rotMatrix – 3x3 rotation matrix (numpy array)
- point – coordinates (x,y,z) of the point to rotate
- typeFloat – type of numpy float to use; ‘float32’ or ‘float64’
Returns: The coordinates of the rotated point (x’,y’,z’)