Skip to content

Commit f6c58f6

Browse files
author
Joseph Hirsch
committed
:sparkling: add filter option for clusters
1 parent 47f7b05 commit f6c58f6

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

demonstrator/assets/style.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body {
2626
bottom: 0;
2727
}
2828
.two_columns {
29-
min-height: 720px;
29+
min-height: 760px;
3030
flex: 1 1 auto;
3131
width: 100%;
3232
display: flex;
@@ -56,15 +56,15 @@ body {
5656

5757

5858
height: 80vh;
59-
min-height: 720px;
59+
min-height: 760px;
6060
overflow: auto;
6161
}
6262

6363
.graphContainer {
6464

6565

6666
height: 80vh;
67-
min-height: 720px;
67+
min-height: 760px;
6868
overflow: auto;
6969
width: 70%;
7070
border: 1px solid lightgray;
@@ -76,7 +76,7 @@ body {
7676

7777
.nodeInfo {
7878
height: 80vh;
79-
min-height: 720px;
79+
min-height: 760px;
8080
overflow: auto;
8181
width: 30%;
8282
border: 1px solid lightgray;
@@ -86,7 +86,7 @@ body {
8686
}
8787
.main_page_container {
8888
width: 100%;
89-
min-height: 850px;
89+
min-height: 870px;
9090
overflow: none;
9191
display: flex;
9292
flex-flow: column;

demonstrator/data_manager.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class FilterOptions():
1212
telemetry_similarities: float
1313
image_quality_threshold: float
1414
mosaics: bool
15+
clusters: bool
1516
key_frames: bool
1617
filter_id: str
1718

@@ -127,16 +128,17 @@ def get_graph_stuff(filter_options):
127128
nodes[mosaic_id] = dict(mosaic.nodes[0])
128129
in_mosaic.add((image_id, mosaic_id))
129130

130-
query_cluster_nodes = f"""{graph_images} WITH i ORDER BY i.id LIMIT {LIMIT} MATCH (i) -[:IN_CLUSTER]-> (c:Cluster) RETURN i, c"""
131-
with neo4j_transaction() as tx:
132-
cursor = tx.run(query_cluster_nodes)
133-
results = [(r['i'], r['c']) for r in cursor]
134-
for image, cluster in results:
135-
image_id = f"im_{image['id']}"
136-
cluster_id = f"{cluster['id']}"
137-
if cluster_id.endswith("-1"): continue
138-
nodes[cluster_id] = dict(cluster.nodes[0])
139-
in_cluster.add((image_id, cluster_id))
131+
if filter_options.clusters:
132+
query_cluster_nodes = f"""{graph_images} WITH i ORDER BY i.id LIMIT {LIMIT} MATCH (i) -[:IN_CLUSTER]-> (c:Cluster) RETURN i, c"""
133+
with neo4j_transaction() as tx:
134+
cursor = tx.run(query_cluster_nodes)
135+
results = [(r['i'], r['c']) for r in cursor]
136+
for image, cluster in results:
137+
image_id = f"im_{image['id']}"
138+
cluster_id = f"{cluster['id']}"
139+
if cluster_id.endswith("-1"): continue
140+
nodes[cluster_id] = dict(cluster.nodes[0])
141+
in_cluster.add((image_id, cluster_id))
140142

141143

142144
"""

demonstrator/views/controls.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ def layout():
1616
html.P('Telemetry Similarities'),
1717
dcc.Slider(id="telemetry_similarities", min=0, max=5, value=1.5),
1818
html.P('Visual Similarities'),
19-
dcc.Slider(id="visual_similarities", min=0, max=5, value=2),
19+
dcc.Slider(id="visual_similarities", min=0, max=20, value=10),
2020
html.P('Image Quality'),
2121
dcc.Slider(id="quality_slider", min=0, max=15, value=4),
22-
html.H4('Image Stitching'),
23-
dcc.Checklist(['mosaics'], id='extras_cl'),
22+
html.H4('Extras'),
23+
dcc.Checklist(['mosaics', 'clusters'], value=['clusters'], id='extras_cl'),
2424
html.H4('Inspection criteria'),
2525
dcc.Checklist(['marine growth', 'paint peel', 'corrosion', 'defect'], id='defects_cl'),
2626
html.H4('Classifications'),
@@ -47,6 +47,7 @@ def updateFilter(inspections, image_quality_threshold, telemetry_similarities, v
4747
inspections = [title_to_id[t] for t in inspections]
4848
if extras is None: extras = []
4949
mosaics = 'mosaics' in extras
50+
clusters = 'clusters' in extras
5051
key_frames = 'key_frames' in extras
5152

5253
if defects is None: defects = []

0 commit comments

Comments
 (0)