def test_get_cut_slices(): # Generate simple simulated data with one "spot" img, data = _simulate_img() # Use automatic selection of coordinates cut_slices = html_stat_map._get_cut_slices(img, cut_coords=None, threshold=None) assert (cut_slices == [4, 4, 4]).all() # Check that using a single number for cut_coords raises an error with pytest.raises(ValueError): html_stat_map._get_cut_slices(img, cut_coords=4, threshold=None) # Check that it is possible to manually specify coordinates cut_slices = html_stat_map._get_cut_slices(img, cut_coords=[2, 2, 2], threshold=None) assert (cut_slices == [2, 2, 2]).all() # Check that the affine does not change where the cut is done affine = 2 * np.eye(4) img = Nifti1Image(data, affine) cut_slices = html_stat_map._get_cut_slices(img, cut_coords=None, threshold=None) assert (cut_slices == [4, 4, 4]).all()
def test_get_cut_slices(): # Generate simple simulated data with one "spot" img, data = _simulate_img() # Use automatic selection of coordinates cut_slices = html_stat_map._get_cut_slices(img, cut_coords=None, threshold=None) assert (cut_slices == [4, 4, 4]).all() # Check that using a single number for cut_coords raises an error assert_raises(ValueError, html_stat_map._get_cut_slices, img, cut_coords=4, threshold=None) # Check that it is possible to manually specify coordinates cut_slices = html_stat_map._get_cut_slices(img, cut_coords=[2, 2, 2], threshold=None) assert (cut_slices == [2, 2, 2]).all() # Check that the affine does not change where the cut is done affine = 2 * np.eye(4) img = Nifti1Image(data, affine) cut_slices = html_stat_map._get_cut_slices(img, cut_coords=None, threshold=None) assert (cut_slices == [4, 4, 4]).all()