def test_slicing_atlas_along_infsup_axis_gets_correct_section_image(superior, out): atlas = Atlas( volume=np.broadcast_to(np.array([10, 16, 21]), (3, 3, 3)).swapaxes(1, 2), resolution_um=1, ) section = atlas.slice(AtlasTransform(superior=superior, rot_lateral=90)) assert np.all(section.image.channels == out)
def test_slicing_atlas_along_leftright_axis_gets_correct_section_image(right, out): atlas = Atlas( volume=np.broadcast_to(np.array([10, 16, 21]), (3, 3, 3)).swapaxes(0, 2), resolution_um=1, ) section = atlas.slice(AtlasTransform(right=right, rot_axial=-90)) assert np.all(section.image.channels == out)
def test_slicing_atlas_along_postant_axis_gets_correct_section_image(anterior, out): atlas = Atlas( volume=np.broadcast_to(np.array([10, 16, 21]), (3, 3, 3)), resolution_um=1, ) section = atlas.slice(AtlasTransform(anterior=anterior)) assert np.all(section.image.channels == out)
def test_slicing_atlas_along_z_axis_gets_correct_section_image(z, out): atlas = Atlas( volume=np.broadcast_to(np.array([10, 16, 21]), (3, 3, 3)), resolution_um=1, ) section = atlas.slice(Plane3D(z=z)) assert np.all(section.image.channels == out)
def test_slicing_atlas_along_y_axis_gets_correct_section_image(y, out): atlas = Atlas( volume=np.broadcast_to(np.array([10, 16, 21]), (3, 3, 3)).swapaxes(1, 2), resolution_um=1, ) section = atlas.slice(Plane3D(y=y, rx=90)) assert np.all(section.image.channels == out)
def test_slicing_an_atlas_gets_a_new_section_with_correct_parameters(): atlas = Atlas(volume=np.broadcast_to(np.array([10, 20, 30]), (3, 3, 3)).swapaxes(0, 2), resolution_um=1) plane = Plane3D() section = atlas.slice(plane) assert isinstance(section, Section) assert section.plane_3d == plane assert section.plane_2d == Plane2D() assert section.image.pixel_resolution_um == atlas.resolution_um assert section.image.channels.shape == (1, 3, 3) assert section.thickness_um == atlas.resolution_um