-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_cross_section.py
More file actions
45 lines (35 loc) · 1.08 KB
/
test_cross_section.py
File metadata and controls
45 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the BSD 3-Clause
# (see plotpy/LICENSE for details)
"""Renders a cross section chosen by a cross marker"""
# guitest: show
import numpy as np
from guidata.qthelpers import qt_app_context
from plotpy.builder import make
from plotpy.tests import get_path
def create_window():
win = make.dialog(
edit=False,
toolbar=True,
wintitle="Cross sections test",
show_xsection=True,
show_ysection=True,
type="image",
size=(640, 600),
)
return win
def test_cross_section():
"""Test cross section"""
with qt_app_context(exec_loop=True):
filename = get_path("brain.png")
win = create_window()
win.show()
image = make.image(filename=filename, colormap="bone")
data2 = np.array(image.data.T[200:], copy=True)
image2 = make.image(data2, title="Modified", alpha_function="linear")
plot = win.manager.get_plot()
plot.add_item(image)
plot.add_item(image2, z=1)
if __name__ == "__main__":
test_cross_section()