test_center_view

Tests for center_view functionality with different scale configurations.

Classes

TestCenterViewWithScale

Test center_view correctly handles scaled data.

Module Contents

class test_center_view.TestCenterViewWithScale

Test center_view correctly handles scaled data.

The key thing to understand: - Node positions in the graph are in WORLD coordinates (scaled) - viewer.dims.point is in WORLD coordinates - viewer.dims.current_step is an index into the dims range - center_view should position the viewer at the node’s world coordinates

test_center_view_with_z_scale_less_than_one(make_napari_viewer)

Test center_view when z-scale < 1 (common for anisotropic z).

With z-scale = 0.5: - Segmentation pixel z=50 corresponds to world z=25 - Node at world z=25 should display correctly

test_center_view_with_z_scale_greater_than_one(make_napari_viewer)

Test center_view when z-scale > 1.

With z-scale = 2.0: - Segmentation pixel z=25 corresponds to world z=50

test_center_view_with_image_layer_different_scale(make_napari_viewer)

Test center_view when image layer has different scale than tracks seg layer.

Image layer: scale [1,1,1,1], 100 z-pixels -> world z 0-100 Seg layer: scale [1,0.5,1,1], 100 z-pixels -> world z 0-50

test_center_view_no_scale(make_napari_viewer)

Test center_view when no scale is set (defaults to 1.0).

test_center_view_no_segmentation_with_scaled_image(make_napari_viewer)

Test center_view when there is no segmentation, only points and an image layer.

Image layer: scale [1, 0.5, 1, 1], 100 z-pixels -> world z 0-50 Points: in world coordinates at z=25 No segmentation layer.

test_center_view_no_segmentation_mismatched_scales(make_napari_viewer)

Test center_view with no segmentation and mismatched image/points scales.

Image layer: scale [1, 1, 1, 1], 100 z-pixels -> world z 0-100 Points: scale [1, 0.5, 1, 1], positions at world z=25 No segmentation layer.

This tests the case where the image and points have different scales, which affects how dims.range is computed.

test_center_view_syncs_ortho_views(make_napari_viewer, qtbot)

Test that center_view properly syncs ortho views so points are visible.

When center_view is called, the ortho views should also update their dims.current_step so that the point is visible in all views.