Skip to content

Commit 3721817

Browse files
authored
Merge pull request #129 from PytorchConnectomics/88-improvement-continuous-brush-stroke-interpolation-for-fast-pointer-movement-on-mask-proofreading
88 improvement continuous brush stroke interpolation for fast pointer movement on mask proofreading
2 parents 4679c0c + 36be130 commit 3721817

25 files changed

Lines changed: 6154 additions & 827 deletions

client/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function createMenu() {
5454
label: "Electron",
5555
submenu: [{ role: "toggleDevTools" }, { role: "quit" }],
5656
},
57+
{ role: "editMenu" },
5758
{
5859
label: "Edit",
5960
submenu: [
@@ -140,13 +141,13 @@ function createMenu() {
140141
),
141142
},
142143
{
143-
label: "Worm Error Handling",
144+
label: "Mask Proofreading",
144145
type: "checkbox",
145146
checked: false,
146147
click: (menuItem) =>
147148
mainWindow.webContents.send(
148149
"toggle-tab",
149-
"worm-error-handling",
150+
"mask-proofreading",
150151
menuItem.checked,
151152
),
152153
},

client/src/components/FilePickerModal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { apiClient } from "../api";
1010

1111
const HIDDEN_SYSTEM_FILES = new Set([
1212
"workflow_preference.json",
13+
".pytc_proofreading.json",
1314
".ds_store",
1415
"thumbs.db",
1516
]);

client/src/components/WorkflowSelector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const WorkflowSelector = ({ visible, onSelect, onCancel }) => {
3636
{ label: "Tensorboard", value: "monitoring", icon: <DashboardOutlined /> },
3737
{ label: "SynAnno", value: "synanno", icon: <ApartmentOutlined /> },
3838
{
39-
label: "Worm Error Handling",
40-
value: "worm-error-handling",
39+
label: "Mask Proofreading",
40+
value: "mask-proofreading",
4141
icon: <BugOutlined />,
4242
},
4343
];

client/src/views/EHTool.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { useState, useEffect } from "react";
22
import { Layout } from "antd";
3-
import { BugOutlined } from "@ant-design/icons";
43
import DetectionWorkflow from "./ehtool/DetectionWorkflow";
54

65
const { Content } = Layout;
76

87
/**
98
* EHTool Main Component
10-
* Error Handling Tool for detecting and classifying errors in image stacks
9+
* Mask proofreading workflow for reviewing slices in image stacks
1110
*/
1211
function EHTool({
1312
onStartProofreading,
@@ -33,18 +32,8 @@ function EHTool({
3332
}, [sessionId, onSessionChange]);
3433

3534
return (
36-
<Layout style={{ height: "100%", background: "#fff" }}>
37-
<Content style={{ padding: "16px" }}>
38-
<div style={{ marginBottom: "16px" }}>
39-
<h2 style={{ margin: 0 }}>
40-
<BugOutlined style={{ marginRight: "8px" }} />
41-
Error Handling Tool
42-
</h2>
43-
<p style={{ color: "#666", marginTop: "4px" }}>
44-
Detect and classify errors in image stacks
45-
</p>
46-
</div>
47-
35+
<Layout style={{ height: "100%", background: "#f6f8fb" }}>
36+
<Content style={{ padding: "20px 24px" }}>
4837
<DetectionWorkflow
4938
sessionId={sessionId}
5039
setSessionId={setSessionId}

client/src/views/FilesManager.js

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import FileTreeSidebar from "../components/FileTreeSidebar";
2727

2828
const HIDDEN_SYSTEM_FILES = new Set([
2929
"workflow_preference.json",
30+
".pytc_proofreading.json",
3031
".ds_store",
3132
"thumbs.db",
3233
]);
@@ -150,7 +151,6 @@ function FilesManager() {
150151
setServerUnavailable(true);
151152
if (!hasShownServerWarning && !silentNetworkError) {
152153
setHasShownServerWarning(true);
153-
message.warning("API server is not available yet. Retrying...");
154154
}
155155
}
156156
if (!err.isAuthError && !isNetworkError) {
@@ -797,12 +797,19 @@ function FilesManager() {
797797
}
798798
return;
799799
}
800-
if (e.target.tagName === "INPUT") return;
800+
const target = e.target;
801+
if (
802+
target &&
803+
(target.tagName === "INPUT" ||
804+
target.tagName === "TEXTAREA" ||
805+
target.isContentEditable)
806+
)
807+
return;
801808
if (e.key === "Delete") handleDelete();
802809
if (e.ctrlKey && e.key === "c") handleCopy();
803810
if (e.ctrlKey && e.key === "x") handleCut();
804811
if (e.ctrlKey && e.key === "v") handlePaste();
805-
if (e.ctrlKey && e.key === "a") {
812+
if ((e.ctrlKey || e.metaKey) && e.key === "a") {
806813
e.preventDefault();
807814
const allKeys = [
808815
...folders
@@ -1251,29 +1258,6 @@ function FilesManager() {
12511258
position: "relative",
12521259
}}
12531260
>
1254-
{serverUnavailable && (
1255-
<div
1256-
style={{
1257-
position: "absolute",
1258-
top: 80,
1259-
left: 24,
1260-
right: 24,
1261-
zIndex: 10,
1262-
}}
1263-
>
1264-
<div
1265-
style={{
1266-
padding: 12,
1267-
background: "#fffbe6",
1268-
border: "1px solid #ffe58f",
1269-
borderRadius: 8,
1270-
}}
1271-
>
1272-
API server is not ready yet. File list will load automatically when
1273-
it comes online.
1274-
</div>
1275-
</div>
1276-
)}
12771261
{isSidebarVisible && (
12781262
<>
12791263
<FileTreeSidebar
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from "react";
22
import EHTool from "./EHTool";
33

4-
function WormErrorHandling() {
4+
function MaskProofreading() {
55
const [ehToolSession, setEhToolSession] = useState(null);
66
const [refreshTrigger, setRefreshTrigger] = useState(0);
77

@@ -20,4 +20,4 @@ function WormErrorHandling() {
2020
);
2121
}
2222

23-
export default WormErrorHandling;
23+
export default MaskProofreading;

client/src/views/ProofReading.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ function ProofReading() {
3232
useEffect(() => {
3333
const handleKeyPress = (e) => {
3434
// Don't trigger shortcuts when typing in input fields
35-
if (e.target.tagName === "INPUT") return;
35+
const target = e.target;
36+
if (
37+
target &&
38+
(target.tagName === "INPUT" ||
39+
target.tagName === "TEXTAREA" ||
40+
target.isContentEditable)
41+
)
42+
return;
3643

3744
switch (e.key.toLowerCase()) {
3845
case "c":

client/src/views/Views.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import ModelTraining from "./ModelTraining";
1616
import ModelInference from "./ModelInference";
1717
import Monitoring from "./Monitoring";
1818
import ProofReading from "./ProofReading";
19-
import WormErrorHandling from "./WormErrorHandling";
19+
import MaskProofreading from "./MaskProofreading";
2020
import WorkflowSelector from "../components/WorkflowSelector";
2121
import Chatbot from "../components/Chatbot";
2222

@@ -48,8 +48,8 @@ function Views() {
4848
{ label: "Tensorboard", key: "monitoring", icon: <DashboardOutlined /> },
4949
{ label: "SynAnno", key: "synanno", icon: <ApartmentOutlined /> },
5050
{
51-
label: "Worm Error Handling",
52-
key: "worm-error-handling",
51+
label: "Mask Proofreading",
52+
key: "mask-proofreading",
5353
icon: <BugOutlined />,
5454
},
5555
];
@@ -224,7 +224,7 @@ function Views() {
224224
/>,
225225
)}
226226
{renderTabContent("synanno", <ProofReading />)}
227-
{renderTabContent("worm-error-handling", <WormErrorHandling />)}
227+
{renderTabContent("mask-proofreading", <MaskProofreading />)}
228228
</Content>
229229
<Drawer
230230
placement="right"

client/src/views/ehtool/ClassificationPanel.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { Card, Button, Space, Divider, Tag } from "antd";
2+
import { Card, Button, Space, Divider, Tag, Typography } from "antd";
33
import {
44
CheckCircleOutlined,
55
CloseCircleOutlined,
@@ -10,24 +10,30 @@ import {
1010

1111
/**
1212
* Classification Panel Component
13-
* Controls for classifying selected layers
13+
* Controls for classifying selected slices
1414
*/
1515
function ClassificationPanel({
1616
selectedCount,
1717
onClassify,
1818
onSelectAll,
1919
onClearSelection,
2020
}) {
21+
const { Text } = Typography;
22+
2123
return (
2224
<div style={{ padding: "16px" }}>
2325
<Card
2426
title="Classification"
2527
size="small"
26-
style={{ marginBottom: "16px" }}
28+
style={{
29+
marginBottom: "12px",
30+
background: "#fff",
31+
boxShadow: "0 6px 20px rgba(15, 23, 42, 0.06)",
32+
}}
2733
>
2834
<div style={{ marginBottom: "16px" }}>
2935
<Tag color={selectedCount > 0 ? "blue" : "default"}>
30-
{selectedCount} layer{selectedCount !== 1 ? "s" : ""} selected
36+
{selectedCount} slice{selectedCount !== 1 ? "s" : ""} selected
3137
</Tag>
3238
</div>
3339

@@ -38,7 +44,7 @@ function ClassificationPanel({
3844
onClick={() => onClassify("correct")}
3945
disabled={selectedCount === 0}
4046
block
41-
style={{ background: "#52c41a", borderColor: "#52c41a" }}
47+
style={{ background: "#22c55e", borderColor: "#22c55e" }}
4248
>
4349
Correct (C)
4450
</Button>
@@ -59,17 +65,24 @@ function ClassificationPanel({
5965
disabled={selectedCount === 0}
6066
block
6167
style={{
62-
background: "#faad14",
63-
borderColor: "#faad14",
64-
color: "#fff",
68+
background: "#f59e0b",
69+
borderColor: "#f59e0b",
70+
color: "#1f2937",
6571
}}
6672
>
6773
Unsure (U)
6874
</Button>
6975
</Space>
7076
</Card>
7177

72-
<Card title="Selection" size="small">
78+
<Card
79+
title="Selection"
80+
size="small"
81+
style={{
82+
background: "#fff",
83+
boxShadow: "0 6px 20px rgba(15, 23, 42, 0.06)",
84+
}}
85+
>
7386
<Space direction="vertical" style={{ width: "100%" }} size="small">
7487
<Button icon={<SelectOutlined />} onClick={onSelectAll} block>
7588
Select All (Ctrl+A)
@@ -91,12 +104,14 @@ function ClassificationPanel({
91104
<div
92105
style={{
93106
padding: "12px",
94-
background: "#f5f5f5",
107+
background: "#f8fafc",
95108
borderRadius: "4px",
96109
fontSize: "12px",
97110
}}
98111
>
99-
<h4 style={{ marginTop: 0, fontSize: "13px" }}>Keyboard Shortcuts:</h4>
112+
<Text strong style={{ fontSize: 12 }}>
113+
Keyboard shortcuts
114+
</Text>
100115
<ul style={{ marginBottom: 0, paddingLeft: "20px" }}>
101116
<li>
102117
<kbd>C</kbd> - Mark as Correct

0 commit comments

Comments
 (0)