def METHOD_NAME(tmp_path, template_lpi):
    """
    Test registration with option -ref subject when data is not RPI orientation.
    This test uses the temporary dataset created in test_sct_register_to_template_non_rpi_template().
    """
    # Run registration to template using the LPI template as input file
    sct_register_to_template.main(argv=['-i', f'{template_lpi}/template/PAM50_small_t2.nii.gz',
                                        '-s', f'{template_lpi}/template/PAM50_small_cord.nii.gz',
                                        '-ldisc', f'{template_lpi}/template/PAM50_small_label_disc.nii.gz',
                                        '-c', 't2', '-t', sct_test_path('template'), '-ref', 'subject',
                                        '-param', 'step=1,type=seg,algo=centermass',
                                        '-ofolder', str(tmp_path), '-r', '0', '-v', '2'])
    img_orig = Image(f'{template_lpi}/template/PAM50_small_t2.nii.gz')
    img_reg = Image(str(tmp_path/'template2anat.nii.gz'))
    # Check if both images almost overlap. If they are right-left flipped, distance should be above threshold
    assert np.linalg.norm(img_orig.data - img_reg.data) < 1