-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProjectionArrowsDF.py
103 lines (94 loc) · 5.68 KB
/
ProjectionArrowsDF.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import pandas as pd
from ProjectionResultRecordsDF import ProjectionResultRecordsDF
class ProjectionArrowsDF():
def __init__(self):
pass
def x_high(self, connect_lines: pd.DataFrame, input_shape, set_z_as_flat_axis=True, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, flat_axis, proj_connect_lines = PRR.throw(empty_df, input_shape, 0, -1, sum_axis=False, sort=False, reset_colors=None, connect_lines=connect_lines)
if set_z_as_flat_axis:
flat_z_connect_lines, image_shape = self.set_z_as_flat_axis(proj_connect_lines, flat_axis, input_shape, post_transform=True, transform_preset="x_high", set_z_idx_to_0=set_z_idx_to_0)
out1 = flat_z_connect_lines
out2 = flat_axis
out3 = image_shape
else:
out1 = proj_connect_lines
out2 = flat_axis
out3 = None
return out1, out2, out3
def x_low(self, connect_lines: pd.DataFrame, input_shape, set_z_as_flat_axis=True, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, flat_axis, proj_connect_lines = PRR.throw(empty_df, input_shape, 0, 1, sum_axis=False, sort=False, reset_colors=None, connect_lines=connect_lines)
if set_z_as_flat_axis:
flat_z_connect_lines, image_shape = self.set_z_as_flat_axis(proj_connect_lines, flat_axis, input_shape, post_transform=True, transform_preset="x_low", set_z_idx_to_0=set_z_idx_to_0)
out1 = flat_z_connect_lines
out2 = flat_axis
out3 = image_shape
else:
out1 = proj_connect_lines
out2 = flat_axis
out3 = None
return out1, out2, out3
def y_high(self, connect_lines: pd.DataFrame, input_shape, set_z_as_flat_axis=True, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, flat_axis, proj_connect_lines = PRR.throw(empty_df, input_shape, 1, -1, sum_axis=False, sort=False, reset_colors=None, connect_lines=connect_lines)
if set_z_as_flat_axis:
flat_z_connect_lines, image_shape = self.set_z_as_flat_axis(proj_connect_lines, flat_axis, input_shape, post_transform=True, transform_preset="y_high", set_z_idx_to_0=set_z_idx_to_0)
out1 = flat_z_connect_lines
out2 = flat_axis
out3 = image_shape
else:
out1 = proj_connect_lines
out2 = flat_axis
out3 = None
return out1, out2, out3
def y_low(self, connect_lines: pd.DataFrame, input_shape, set_z_as_flat_axis=True, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, flat_axis, proj_connect_lines = PRR.throw(empty_df, input_shape, 1, 1, sum_axis=False, sort=False, reset_colors=None, connect_lines=connect_lines)
if set_z_as_flat_axis:
flat_z_connect_lines, image_shape = self.set_z_as_flat_axis(proj_connect_lines, flat_axis, input_shape, post_transform=True, transform_preset="y_low", set_z_idx_to_0=set_z_idx_to_0)
out1 = flat_z_connect_lines
out2 = flat_axis
out3 = image_shape
else:
out1 = proj_connect_lines
out2 = flat_axis
out3 = None
return out1, out2, out3
def z_high(self, connect_lines: pd.DataFrame, input_shape, set_z_as_flat_axis=True, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, flat_axis, proj_connect_lines = PRR.throw(empty_df, input_shape, 2, -1, sum_axis=False, sort=False, reset_colors=None, connect_lines=connect_lines)
if set_z_as_flat_axis:
flat_z_connect_lines, image_shape = self.set_z_as_flat_axis(proj_connect_lines, flat_axis, input_shape, post_transform=True, transform_preset="z_high", set_z_idx_to_0=set_z_idx_to_0)
out1 = flat_z_connect_lines
out2 = flat_axis
out3 = image_shape
else:
out1 = proj_connect_lines
out2 = flat_axis
out3 = None
return out1, out2, out3
def z_low(self, connect_lines: pd.DataFrame, input_shape, set_z_as_flat_axis=True, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, flat_axis, proj_connect_lines = PRR.throw(empty_df, input_shape, 2, 1, sum_axis=False, sort=False, reset_colors=None, connect_lines=connect_lines)
if set_z_as_flat_axis:
flat_z_connect_lines, image_shape = self.set_z_as_flat_axis(proj_connect_lines, flat_axis, input_shape, post_transform=True, transform_preset="z_low", set_z_idx_to_0=set_z_idx_to_0)
out1 = flat_z_connect_lines
out2 = flat_axis
out3 = image_shape
else:
out1 = proj_connect_lines
out2 = flat_axis
out3 = None
return out1, out2, out3
def set_z_as_flat_axis(self, connect_lines, flataxis, input_shape, post_transform=True, transform_preset=None, set_z_idx_to_0=True):
PRR = ProjectionResultRecordsDF()
empty_df = pd.DataFrame({"x_idx": [0], "y_idx": [0], "z_idx": [0]})
_, image_shape, flat_z_connect_lines = PRR.set_z_as_flat_axis(empty_df, flataxis, input_shape, post_transform=post_transform, transform_preset=transform_preset, sort=False, reset_colors=None, connect_lines=connect_lines, set_z_idx_to_0=set_z_idx_to_0)
return flat_z_connect_lines, image_shape