SSIM is not rotation invariant. That is, if ImgA is a rotated version of ImgB the SSIM( ImgA, ImgB ) is not likely to be high.
So, if you want to detect the relative rotation angle between ImgA and ImgB you would have to rotate ImgA through all possible angles and compare the rotated version to ImgB.
This is not a very efficient method and you might find other methods that are more efficient for detecting rotation.
If I recall correctly, you are dealing mostly with binary masks of closed curves. I believe a better choise for rotation detection in your case would be to use rotation invariane version of shape-context descriptors combined in some robust rigid transformation estimation method (like Ransac).