コード例 #1
0
def test_instantiate(default_res, default_trans, has_res, has_trans):
    if not has_res:
        default_res = None
    if not has_trans:
        default_trans = None
    assert CoordinateTransformer(default_res, default_trans)
コード例 #2
0
def test_from_catmaid(default_coord_transformer, catmaid_mock):
    assert CoordinateTransformer.from_catmaid(
        catmaid_mock, None) == default_coord_transformer
コード例 #3
0
def default_coord_transformer(default_res, default_trans):
    return CoordinateTransformer(default_res, default_trans)
コード例 #4
0
def test_project_to_stack_orientation_xy(orientation, direction, expected):
    coord_trans = CoordinateTransformer(orientation=orientation)
    result = getattr(coord_trans, direction)({'z': 0, 'y': 1, 'x': 2})
    assert result == expected
コード例 #5
0
def test_can_validate_orientation_invalid(orientation, expected_exception):
    with pytest.raises(expected_exception):
        CoordinateTransformer(orientation=orientation)
コード例 #6
0
def test_can_validate_orientation_valid(orientation):
    trans = CoordinateTransformer(orientation=orientation)
    assert trans.orientation == StackOrientation.XY
    assert trans.depth_dim == 'z'
コード例 #7
0
 def get_coord_transformer(self, stack_id_or_title=None):
     if stack_id_or_title is None:
         return CoordinateTransformer()
     else:
         stack_id = self._get_stack_id(stack_id_or_title)
         return CoordinateTransformer.from_catmaid(self._catmaid, stack_id)