PyPO User Manual
MatUtils.py File Reference

File containing a method for finding a connected subset, centered around a starting index, in a matrix. More...

Functions

def PyPO.MatUtils.findConnectedSubsets (mat, component, idx_start)
 Find extent of centered connected subset in a matrix. More...
 
def PyPO.MatUtils.findRotation (self, v, u)
 Find rotation matrix to rotate v onto u. More...
 
def PyPO.MatUtils.getAnglesFromMatrix (self, M)
 Find x, y and z rotation angles from general rotation matrix. More...
 

Detailed Description

File containing a method for finding a connected subset, centered around a starting index, in a matrix.

Used for creating masks for fitting Gaussians.

Function Documentation

◆ findConnectedSubsets()

def PyPO.MatUtils.findConnectedSubsets (   mat,
  component,
  idx_start 
)

Find extent of centered connected subset in a matrix.

Parameters
matMatrix of which to find largest connected subset.
componentValue on which to differentiate subset.
idx_startMatrix index on which to center the subset.
Returns
Indices of row and column of limits of subset.

◆ findRotation()

def PyPO.MatUtils.findRotation (   self,
  v,
  u 
)

Find rotation matrix to rotate v onto u.

Parameters
vNumpy array of length 3.
uNumpy array of length 3.

◆ getAnglesFromMatrix()

def PyPO.MatUtils.getAnglesFromMatrix (   self,
  M 
)

Find x, y and z rotation angles from general rotation matrix.

Note that the angles are not necessarily the same as the original angles of the matrix. However, the matrix constructed by the found angles applies the same 3D rotation as the input matrix.

Parameters
MNumpy array of shape (3,3) containg a general rotation matrix.
Returns
r Numpy array of length 3 containing rotation angles around x, y and z.