Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and

## [Unreleased]

### Changed

- Opening a dataset folder now asks where the masks go before the first case opens (in the desktop app the folder dialog opens in the folder used last time for that dataset). Cases done earlier show ✓ at once and open with their saved masks, and the first case still to do opens. Cancel, or "Only look" in a browser, opens the dataset without a folder to save into.
- Changing "Start from" opens the case on screen again from that label, asking first if it was edited. A case marked done keeps its saved mask.

### Fixed

- A view-through-host guest whose connection dropped could leave the room on reconnecting, with "Can't reach the room server", instead of coming back. The app asked the host for pictures on the new connection before signing in again, and the room server took that as a broken sign-in. Nothing is sent now until the app has signed in. A sign-in that a slow network made late is tried again rather than ending the room.
- A reload (F5) lost the open dataset. The desktop app now comes back to the same dataset, Save to folder and case; a browser says to open the dataset folder again.

## [0.1.4] - 2026-11-24

Expand Down
2 changes: 1 addition & 1 deletion docs/design/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ Disabled edit tool tooltip: `Add a segment to start editing.`
| Mask confirm (Open image picked a file of segment labels while an image is open) | Add 10000_0001.mha as a mask? · Its values are segment labels. It can also open in place of 10000_0001_0000.mha. (unsaved: Its values are segment labels. Replacing the image instead loses unsaved mask changes.) · Replace image (not in a room) · Cancel · Add as mask |
| Labels opened as the image | 10000_0001.mha holds segment labels. To edit them, open them on their scan. · Pick scan |
| Files section | Files · New mask · Edit {name} · Hide / Show · Dim image / Show image at full brightness · Make active · Save… · Use as mask on a scan… (image row, when it holds segment labels) · Show in Finder / Explorer / folder · Close · Close image |
| Dataset section (above Files, while a dataset folder is open) | Dataset · {n} / {total} · {folder name} · Previous case / Next case (Alt+↑ / Alt+↓) · Close dataset · Start from: This scan’s label / First scan’s label · Save to: Choose folder… / {folder} Change… · {d} done · {s} skipped · {l} left · Zip for email… (tip: One file of the saved masks and the progress, to attach to an email) · Skip · Done and next (Mod+Enter; tip: Save to the folder and open the next case) · patient ids, each with its scan numbers and ✓ done or – skipped · {case}, no label |
| Dataset section (above Files, while a dataset folder is open) | Dataset · {n} / {total} · {folder name} · Previous case / Next case (Alt+↑ / Alt+↓) · Close dataset · Start from: This scan’s label / First scan’s label · Save to: Choose folder… / {folder} Change… · {d} done · {s} skipped · {l} left · Zip for email… (tip: One file of the saved masks and the progress, to attach to an email) · Skip · Done and next (Mod+Enter; tip: Save to the folder and open the next case) · patient ids, each with its scan numbers and ✓ done or – skipped · {case}, no label · On opening a dataset, before the first case: desktop folder dialog `Choose where to save the masks, or Cancel to only look`; in a browser a dialog `Where should the masks go?` / `Choose the folder for the corrected masks. To carry on earlier work, pick the folder you used then.` / `Only look` · `Choose folder…` · After a reload in a browser: `Open the dataset folder again to carry on with {dataset}.` |
| Dataset messages | No images named like nnU-Net cases (case_0000.nii.gz) were found in this folder. · Started from the label of 10000_0001. Check that it fits this scan. · {case} has 4 channels. The first one is shown. · This is the first case. · This is the last case. · Leave the room to open a dataset folder. · {folder} already has {d} done and {s} skipped. They keep their status. · {folder} holds the dataset's own labels. Choose or make another folder, so the originals stay as they are. · This browser can't save into a folder. Use the desktop app, or Edge or Chrome. · Couldn't save {file} to {folder}. Check that the folder is writable. · Every case is done or skipped. The masks are in {folder}. [Zip for email] · Zipping the masks… · Saved {file}: {n} masks, {size}. Attach it to an email. · {n} cases marked done have no mask in {folder} and are left out: {cases} (up to five, then "and {m} more"). · That is more than most email services accept. Share it through a file link instead. |
| Dataset confirms | Skip {case}? · Your edits to this case are not saved. · Cancel · Skip — Save changes to {case}.mha? · It is saved to {folder} and marked done. · Don't save · Cancel · Save |
| Too many masks | Up to 4 masks can be open at once. Close one in Files to add another. |
Expand Down
3 changes: 3 additions & 0 deletions docs/process/DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ How to use it:
| 2026-11-23 | What if the zip would not arrive, or a mask is missing? | Above 14 MB the message says most email services will not accept it and suggests a file link; nothing is split. A case marked done whose mask is not in the folder is left out and named in the message (a warning), so the receiver is not sent a progress file that promises more than the zip holds without the sender knowing. Unsaved edits on the case on screen are offered for saving first. | Gmail takes 25 MB and Outlook 20 MB including the encoding mail adds (about a third), so a 14 MB file fits both. A whole PANTHER task's corrected masks are about 5 MB. |
| 2026-11-24 | Can someone look for an update without restarting the app? | "Check for updates" in Settings › Help, in the desktop app only (a browser loads the latest web version anyway). It uses the same updater as the launch check and joins it if that is still running, so a release is never downloaded twice. It shows each step beside the button; a found release downloads, then the button becomes "Restart to update" and the banner shows again even if Later was chosen. A failed check says so and can be tried again. The launch check still shows nothing until an update is ready. | The launch check is the only way in today, so a long-running app hears of a release only after a restart, and a failed check is silent. A button in Help is where people look for it, and adds no new dialog or toast. |
| 2026-11-24 | When may a room client send, and does a late sign-in end the room? | Only after `welcome` on the connection that is open: `RoomClient.open` is false from a new socket until then, so `send`, `request` and `sendFrame` hold off (the handshake itself still goes on `hello`). A member already welcomed who is closed with 4400 `handshake timed out` reconnects; any other 4400 still ends the room. | A view-through-host guest asks the host for pictures every 400 ms while offline. On a reconnect that frame could go out before the handshake, the relay closed with 4400 `bad handshake`, and the guest left the room with "Can't reach the room server" (seen once in CI, run 45433928289). A handshake timeout is a slow network, which is no reason to end a membership. |
| 2026-11-24 | When does a dataset's Save to folder get chosen? | Right after the dataset folder is picked, before any case opens. The desktop app shows its folder dialog at once, opening in the folder last used for that dataset (kept on this computer, for up to 20 datasets); a browser first shows a small dialog, because it opens a folder picker only after a click. Cancel, Esc or "Only look" opens the dataset without one, as before, and Change… still works. With a folder chosen, the first case still to do opens, not the first case. | An annotator reopening a dataset saw the original labels of cases already corrected until they chose the folder again, which looked like lost work. Asking first means the work done shows at once. |
| 2026-11-24 | What happens to the case on screen when Start from changes? | It opens again from the chosen label. If its mask changed since the case opened, the usual save question comes first, and Cancel leaves both the case and Start from as they were. A case marked done keeps its saved mask; the choice applies to the cases opened after it. | Changing the menu and seeing nothing happen read as broken. A mask that is still as it opened, even one started from another scan, has nothing to lose, so it is not asked about. |
| 2026-11-24 | What does a reload (F5) do to an open dataset? | The desktop app comes back to the same dataset, Save to folder and case. It keeps them for the window only (sessionStorage, gone after a restart), and the Rust side reopens only folders picked in a dialog during this run of the app (`reopen_folder`, `reopen_output_folder`); after a restart the folders are picked again. A browser cannot read a folder again without a pick, so it says to open the dataset folder again. | A reload threw away the place in a 460-case dataset. Reopening without a dialog stays within what the user already picked, so the rule that nothing is readable until picked holds. |
88 changes: 74 additions & 14 deletions e2e/dataset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,31 @@ const voxels = (page: Page, label?: number) =>
const dataset = (page: Page) => page.getByRole('region', { name: 'Dataset' });
const caseRow = (page: Page, name: string) => page.getByRole('option', { name, exact: true });

async function openFolder(page: Page): Promise<void> {
/** Opens the app and hands it the test dataset, without answering what it asks next. */
async function pickTestFolder(page: Page): Promise<void> {
await skipTour(page);
await page.goto('/');
await page.waitForFunction(() => '__w' in window);
const chooser = page.waitForEvent('filechooser');
await page.getByRole('button', { name: 'Open a dataset folder' }).click();
await setFolder(await chooser, folder);
await expect(rows(page).nth(0)).toContainText('p1_0001_0000');
}

const askWhere = (page: Page) => page.getByRole('dialog', { name: 'Where should the masks go?' });

/**
* Opens the test dataset. A browser that can save into a folder then asks where
* the masks go, and `then` answers ('look' by default); one that cannot (WebKit
* without the fake picker) asks nothing. `first` is the image of the case that opens.
*/
async function openFolder(page: Page, { then = 'look', first = 'p1_0001_0000' }: { then?: 'look' | 'choose'; first?: string } = {}): Promise<void> {
await pickTestFolder(page);
if (await page.evaluate(() => 'showDirectoryPicker' in window)) {
await askWhere(page)
.getByRole('button', { name: then === 'choose' ? 'Choose folder…' : 'Only look' })
.click();
}
await expect(rows(page).nth(0)).toContainText(first);
}

test('a dataset folder lists its cases by patient and opens the first one with its label', async ({ page }) => {
Expand Down Expand Up @@ -212,6 +229,54 @@ const written = (page: Page) => page.evaluate(() => Object.keys((window as unkno
const progress = (page: Page) =>
page.evaluate(() => JSON.parse(new TextDecoder().decode((window as unknown as { __out: { files: Record<string, Uint8Array> } }).__out.files['w-annotator-progress.json'])) as { cases: Record<string, { status: string; changed?: boolean; start?: string }> });

test('opening a dataset asks where the masks go, and Esc only looks', async ({ page }) => {
await fakeOutputFolder(page);
await pickTestFolder(page);
await expect(askWhere(page)).toContainText('Choose the folder for the corrected masks. To carry on earlier work, pick the folder you used then.');
// Nothing opens behind the question.
await expect(rows(page)).toHaveCount(0);
await page.keyboard.press('Escape');
await expect(rows(page).nth(0)).toContainText('p1_0001_0000');
await expect(dataset(page).getByRole('button', { name: 'Choose folder…' })).toBeVisible();
expect(await written(page)).toEqual([]);
});

test('changing Start from opens the case on screen again from that label, asking first about edits', async ({ page }) => {
await openFolder(page);
await caseRow(page, 'p1_0002').click();
await expect.poll(() => voxels(page, 2)).toBeGreaterThan(0);
const start = dataset(page).getByLabel('Start from');

await start.selectOption({ label: 'First scan’s label' });
await expect.poll(() => voxels(page, 1)).toBeGreaterThan(0);
expect(await voxels(page, 2)).toBe(0);
await expect(page.getByText('Started from the label of p1_0001. Check that it fits this scan.')).toBeVisible();
await expect(caseRow(page, 'p1_0002')).toHaveAttribute('aria-selected', 'true');

// Not changed since it opened: back to its own label without asking.
await start.selectOption({ label: 'This scan’s label' });
await expect.poll(() => voxels(page, 2)).toBeGreaterThan(0);
await expect(page.getByRole('heading', { name: /^Save changes/ })).toHaveCount(0);

// After an edit it asks first; Cancel keeps the case and the choice as they were.
await page.evaluate(() => window.__w.session.clearSegment(2));
await start.selectOption({ label: 'First scan’s label' });
await expect(page.getByRole('heading', { name: 'Save changes to p1_0002.mha?' })).toBeVisible();
await page.getByRole('button', { name: 'Cancel' }).click();
await expect(start).toHaveValue('own');
expect(await voxels(page)).toBe(0);
await start.selectOption({ label: 'First scan’s label' });
await page.getByRole('button', { name: "Don't save" }).click();
await expect.poll(() => voxels(page, 1)).toBeGreaterThan(0);
await expect(start).toHaveValue('first');
});

test('after a reload, a browser says to open the dataset folder again', async ({ page }) => {
await openFolder(page);
await page.reload();
await expect(page.getByText('Open the dataset folder again to carry on with task1.')).toBeVisible();
});

test('Done and next saves the case into the chosen folder, marks it and opens the next one', async ({ page }) => {
await fakeOutputFolder(page);
await openFolder(page);
Expand Down Expand Up @@ -266,14 +331,13 @@ test('a folder with earlier progress picks up where the work stopped', async ({
'p1_0001.mha': Array.from(ball(2)),
'w-annotator-progress.json': Array.from(Buffer.from(JSON.stringify(earlier))),
});
await openFolder(page);
await dataset(page).getByRole('button', { name: 'Choose folder…' }).click();
// Chosen as the dataset opens: the done case is marked at once, and the first case still to do opens.
await openFolder(page, { then: 'choose', first: 'p1_0002_0000' });
await expect(page.getByText('labels_corrected already has 1 done and 0 skipped. They keep their status.')).toBeVisible();
await expect(caseRow(page, 'p1_0001, done')).toBeVisible();
await expect(caseRow(page, 'p1_0002')).toHaveAttribute('aria-selected', 'true');

// A done case opens with the mask saved for it.
await caseRow(page, 'p1_0002').click();
await expect(rows(page).nth(0)).toContainText('p1_0002_0000');
await caseRow(page, 'p1_0001, done').click();
await expect(rows(page).nth(0)).toContainText('p1_0001_0000');
await expect.poll(() => voxels(page, 2)).toBeGreaterThan(0);
Expand All @@ -286,16 +350,14 @@ test('a folder with earlier progress picks up where the work stopped', async ({

test('the dataset’s own labels folder cannot be the output folder', async ({ page }) => {
await fakeOutputFolder(page, 'LabelsTr', { 'p1_0001.mha': [1], 'p1_0002.mha': [1] });
await openFolder(page);
await dataset(page).getByRole('button', { name: 'Choose folder…' }).click();
await openFolder(page, { then: 'choose' });
await expect(page.getByText("LabelsTr holds the dataset's own labels. Choose or make another folder, so the originals stay as they are.")).toBeVisible();
await expect(dataset(page).getByRole('button', { name: 'Choose folder…' })).toBeVisible();
});

test('moving on with unsaved edits saves into the output folder when there is one', async ({ page }) => {
await fakeOutputFolder(page);
await openFolder(page);
await dataset(page).getByRole('button', { name: 'Choose folder…' }).click();
await openFolder(page, { then: 'choose' });
await expect(dataset(page)).toContainText('labels_corrected');
await expect.poll(() => voxels(page, 1)).toBeGreaterThan(0);
await page.evaluate(() => window.__w.session.clearSegment(1));
Expand All @@ -317,8 +379,7 @@ async function zipNow(page: Page): Promise<{ name: string; files: Record<string,

test('the output folder zips into one file for email: the masks of done cases and the progress', async ({ page }) => {
await fakeOutputFolder(page);
await openFolder(page);
await dataset(page).getByRole('button', { name: 'Choose folder…' }).click();
await openFolder(page, { then: 'choose' });
// Nothing done or skipped yet: nothing to send.
await expect(dataset(page).getByRole('button', { name: 'Zip for email…' })).toBeDisabled();

Expand Down Expand Up @@ -352,8 +413,7 @@ test('a case marked done whose mask is not in the folder is left out of the zip,
'p1_0001.mha': Array.from(ball(1)),
'w-annotator-progress.json': Array.from(Buffer.from(JSON.stringify(earlier))),
});
await openFolder(page);
await dataset(page).getByRole('button', { name: 'Choose folder…' }).click();
await openFolder(page, { then: 'choose', first: 'p2_0001_0000' });
await expect(caseRow(page, 'p1_0002, done')).toBeVisible();

const zip = await zipNow(page);
Expand Down
Loading
Loading