Decomposing the Transformation matrix and the order of operation?

Hi all!

In 3D slicer Image Registration Operation :

I want to decompose the individual Transformation operation as a product of Translation Matrix, Scaling Matrix, and Rotation Matrix(if used). So, I need to know the order of multiplication and elements of these matrices. Finally, I wanted to take a general equation out of these matrices which tell the order of operation and element relationship (if any, between the elements of each matrix)

Can anyone give some solution related to this? Thanks!

Scaling matrix is a diagonal matrix that contains the column norms of the transformation matrix.
Rotation matrix is the transformation matrix with translation removed (the 4th column set to [0,0,0,1]) and the columns normalized.
Translation matrix is the transformation matrix with the top-left 3x3 submatrix set to identity matrix.

Order of rotation and scaling does not matter (rotate then scale = scale then rotate). You need to translate after you rotated&scaled.