calculating similarity scores between similar and different classes?
From a general perspective, you are trying to take SSIM - which is image difference measure. But it is probably a bad idea if you are looking for measure the intraclass, distance. 

You can look at distance measures like Euclidean distance, Mahalonbis distance (if you have co-variance metrics) or others. 

As a very simple example : To compute Euclidean distance $L_2$, which is computed between the centroid of the Clusters - as $ Distance = \sqrt{(x_a- x_b)^2 + (y_a- y_b)^2 }$

NOTE: here the dimension are NOT image dimension but are rather the dimension of the feature vector. 


  I WILL EXPAND THIS ANSWER WITH YOUR SPECIFIC NEEDS.