def get_deviation_from_atlas_com():
    transformed_coms = get_transformed_coms()
    atlas_com = get_atlas_com()
    nprep = transformed_coms.shape[0]
    com_diff = []
    for prepi in range(nprep):
        difference = transformed_coms[prepi]-atlas_com
        com_diff.append(difference)
    return np.array(com_diff)
def get_atlas_com_aligned_to_DK52():
    DK52_com = get_reference_com('DK52')
    atlas_com = get_atlas_com()
    rotation, translation = align_point_sets(atlas_com.T, DK52_com.T)
    transformed_coms = []
    for com in atlas_com:
        transformed_coms.append(rotation @ com.reshape(3) +
                                translation.reshape(3))
    return np.array(transformed_coms)
def get_transformed_coms():
    prep_list_for_rough_alignment = get_prep_list_for_rough_alignment_test()
    atlas_com = get_atlas_com()
    transformed_coms = []
    for prepi in prep_list_for_rough_alignment:
        DK52_com_aligned_to_prep = get_DK52_com_aligned_to_prepi(prepi)
        DK52_com_aligned_to_atlas,_= get_and_apply_transform(DK52_com_aligned_to_prep,atlas_com)
        transformed_coms.append(DK52_com_aligned_to_atlas)
    transformed_coms = np.array(transformed_coms)
    return transformed_coms