QA: Region Editor and classes¶
Test cases for the Region Editor (table, toolbar, dialogs), annotation classes and presets, GeoJSON, label volume and mask import/export, large region sources and 3D class features. See How to use the plan. Reference: Region Editor, Annotation classes, GeoJSON import and export.
Unless a case says otherwise, use img01.png (no pixel size) or WSI CMU-1 (with a pixel size) in the
Image view, with the Region Editor open.
The dialog¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-001 | Open the Region Editor | P1 | img01.png |
1. Click Open the Region Editor. | A non-modal dialog "Region Editor" opens on the right (85% of the window height), draggable, resizable and maximizable. The image stays usable. |
| RED-002 | Live sync with drawing | P1 | Editor open | 1. Draw a rectangle on the image. | A new row appears immediately with class "Region" and its surface. No save/cancel is needed. |
| RED-003 | Per-image list | P1 | Regions on two images | 1. Switch between the two images. | The table shows only the current image's regions. |
| RED-004 | Help opens the guide | P1 | Editor open | 1. Click the editor's Help (?). | A new tab opens the guide's Region Editor reference page. |
| RED-005 | Initial width follows the host | P3 | JIT (with regionEditorWidthSelector) |
1. Open the editor. | The dialog opens as wide as the host's side panel; without that setting, a quarter of the window. |
Table¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-020 | Columns | P2 | A few regions | 1. Look at the table header. | Class, Surface (tooltip "The region's area on this slice") and a delete column. |
| RED-021 | Area in px² | P2 | img01.png (no pixel size) |
1. Draw a 100 × 100 px rectangle (approx.). | Surface in px², rounded to an integer above 1000. |
| RED-022 | Area in µm² / mm² | P1 | WSI CMU-1 |
1. Draw a small region. 2. Draw a very large one. | Small: µm². Large (≥ 1,000,000 µm²): mm². Values ≥ 1000 are integers, smaller ones have two decimals, with locale separators. |
| RED-023 | Holes and parts in the area | P2 | A donut and a multi-part region | 1. Compare their surfaces with the parts. | The hole is subtracted; multi-part areas are summed. |
| RED-024 | Click selects | P1 | Three regions | 1. Click a row. | The row is highlighted and the region is selected on the image (with handles in Selection mode). |
| RED-025 | Ctrl/Cmd-click and Shift-click | P2 | Five regions | 1. Click row 1. 2. Ctrl-click row 3. 3. Shift-click row 5. | Ctrl/Cmd toggles a row in the selection; Shift selects the range. |
| RED-026 | Canvas → table sync | P1 | Three regions | 1. Click a region on the image. | The matching row is highlighted; the paginator jumps to its page if needed. |
| RED-027 | Change class from the dropdown | P1 | One region | 1. Open the Class dropdown of its row. 2. Pick Tumor. | The class becomes Tumor and the region turns #FF4444. |
| RED-028 | Free-form class name | P2 | One region | 1. Click the pencil "Rename / free-form label". 2. Type Gland, press Enter. |
The class is "Gland". Esc or the × "Close" cancels instead. |
| RED-029 | Delete one row | P1 | Two regions | 1. Click the trash of one row. | That region is deleted from the table and the image. |
| RED-030 | Paginator | P2 | 12 regions | 1. Look at the table footer. 2. Change rows per page. | 10 rows per page by default, options 10/25/50, report "1 to 10 of 12". |
| RED-031 | Class column sort | P3 | Several classes | 1. Click the Class header's sort icon. | Record behaviour (a sort icon is shown but the column may not sort). ⚠ see Known issues (KI-25). |
| RED-032 | Every editor edit is one undo step | P2 | One region | 1. Change its class. 2. Press Ctrl+Z. | The class change is undone. |
Editor toolbar¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-040 | Show region labels | P2 | Classified regions | 1. Click the tag "Show region labels." twice. | Class labels show on each region, then hide. (Slower with many regions.) |
| RED-041 | Fill regions | P2 | Classified regions | 1. Click the filled circle "Fill regions in their colour (an atlas's look); labels sit inside.". | Regions are filled in their colour (60% opacity) with labels inside where they fit; a selected region is highlighted in purple. |
| RED-042 | See regions through the volume | P3 | micro-ct z-stack, Volume, regions shown in 3D | 1. Click the eye "See the regions through the volume…". | Only shown in a volume view. On: region surfaces stay visible inside bright structures; off: the volume hides the parts behind it. |
| RED-043 | x512 rounding | P2 | A 700 × 300 px rectangle and a polygon | 1. Click x512. | Tooltip "Round all rectangle regions to width and height that are multiple of 512". The rectangle becomes 512 × 512; the polygon is unchanged. |
| RED-044 | x512 with a small rectangle | P3 | A 200 × 200 px rectangle | 1. Click x512. | Record behaviour (rounds to the nearest multiple, so 0 × 0 is expected from the code). ⚠ see Known issues (KI-24). |
| RED-045 | Select all regions | P1 | Five regions | 1. Click "Select all regions". | All rows and regions are selected. |
| RED-046 | Set class on selected rows | P1 | Three regions selected | 1. Click "Edit class on selected rows". 2. Pick Stroma in "Choose a class…". | Panel title "Set class on 3 selected region(s)". Picking applies immediately: all three become Stroma. |
| RED-047 | New class from the bulk panel | P2 | Two regions selected | 1. Open the panel. 2. Type Vessel in "…or a new class", press Enter (or "Add class & set it"). |
Both regions become Vessel and Vessel is added to the classes. |
| RED-048 | Bulk panel filter | P3 | More than 8 classes | 1. Open the panel's dropdown. | A filter box is shown. |
| RED-049 | Region colour dialog | P2 | Regions of two classes selected | 1. Click "Edit colour of selected regions". 2. Change one colour. 3. Apply. | Dialog "Region colour": "Outline colour per class for the N selected region(s):", one picker per class ("Unclassified" for unlabelled). Apply recolours those regions. |
| RED-050 | Per-region colour survives class recolour | P2 | After RED-049 | 1. Recolour that class from its swatch in the Classes panel. | The regions recoloured in RED-049 keep their own colour; other regions of the class change. |
| RED-051 | Delete selected regions | P1 | Three regions, two selected | 1. Click "Delete selected regions". | The two selected regions are deleted. |
| RED-052 | Delete all regions | P1 | Several regions | 1. Click "Delete all regions". 2. Click No. 3. Repeat, click Yes. | Confirm "Are you sure you want to delete all regions?". No keeps them; Yes deletes all (and clears any region source). |
| RED-053 | Buttons disabled without regions | P3 | No regions | 1. Look at the editor toolbar. | Save to server, Save mask, Select all, Delete all are disabled. |
Classes panel and class presets¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-070 | Classes panel contents | P1 | Classified regions | 1. Look at the "Classes" panel. | Search "Search by name"; one row per class with an eye, colour swatch, name, region count and trash; sorted by count (descending), then name. |
| RED-071 | Default classes | P2 | Fresh session (no saved presets) | 1. Open Manage. | Fragmented-embryo #FF8C00, Dying-embryo #FF3333, Two-cell-embryo #33CC66, One-cell-embryo #3399FF, Unknown #888888, Tumor #FF4444, Stroma #44AAFF, Immune cells #FFDD00, Necrosis #AA6633, Region #00FFFF, Ignore #AAAAAA, Positive #00CC44, Negative #CC0000. |
| RED-072 | Search classes | P3 | Many classes | 1. Type tu in the search. 2. Press Enter. 3. Type zzz. |
The list filters; Enter picks the first match; no match shows "No class matches.". |
| RED-073 | Hide a class | P2 | Tumor regions | 1. Click Tumor's eye ("Hide this class"). 2. Click again. | Tumor regions disappear from the image, then return. |
| RED-074 | Recolour a class | P1 | Tumor regions | 1. Click Tumor's swatch, pick green. | Every Tumor region turns green at once. |
| RED-075 | Row click with a selection | P2 | Two regions selected | 1. Click the Stroma row (tooltip "Apply “Stroma” to the selected region(s)"). | Both selected regions become Stroma. |
| RED-076 | Row click without a selection | P2 | Nothing selected | 1. Click the Tumor row (tooltip "Set “Tumor” active — new regions use it"). 2. Draw a rectangle. | Record the new region's class. The tooltip promises Tumor; the code is known to give "Region". ⚠ see Known issues (KI-21). |
| RED-077 | Remove a class in use | P2 | Tumor regions | 1. Click Tumor's trash ("Remove class — its regions revert to Region"). | Tumor is removed; its regions become "Region" and lose any colour override. |
| RED-078 | The default class cannot be removed | P3 | Regions of class Region | 1. Hover Region's trash. | Disabled, tooltip "The default class cannot be removed while in use". |
| RED-079 | Empty state | P3 | All classes removed (Manage) | 1. Look at the panel. | "No classes yet — add one from Manage." |
| RED-080 | Manage dialog | P1 | 1. Click Manage (cog, tooltip "Manage classes — add / remove, palette, matching, import/export"). | Modal "Manage annotation classes": class rows (swatch, "Class name", trash), Add class, "Fallback palette — colours for classes not listed", "Auto-add detected classes to this list as they appear", "Label matching" Exact / Normalized, Reset, Import, Export, Apply. | |
| RED-081 | Add a class | P1 | Manage open | 1. Add class. 2. Name Gland, pick a colour. 3. Apply. |
The new row starts grey #888888. After Apply, Gland is in the Classes panel with its colour. |
| RED-082 | Apply cleans the list | P3 | Manage open | 1. Add a blank row and a duplicate Tumor. 2. Apply. |
Blank and duplicate rows are dropped. |
| RED-083 | Closing with × discards | P2 | Manage open | 1. Add a class. 2. Close with ×. 3. Reopen. | The added class is not there. |
| RED-084 | Preset overrides colours on import | P1 | A GeoJSON with class Tumor coloured blue |
1. Import the file. | Tumor regions are drawn in the preset colour (#FF4444), not blue. |
| RED-085 | Fallback palette for unknown classes | P2 | A GeoJSON with class Foo |
1. Import it twice (reload in between). | Foo gets a palette colour (the file's colour if it carries one), the same colour each time. |
| RED-086 | Normalized matching | P2 | Manage: Label matching = Normalized, Apply | 1. Import a GeoJSON with class tumor. |
The regions match the Tumor preset (case and surrounding spaces ignored). With Exact they do not. |
| RED-087 | Auto-add checkbox | P2 | Auto-add off | 1. Import a GeoJSON with an unknown class, editor open. | Record whether the class appears in the list. It is expected to stay out with auto-add off; the code adds it anyway. ⚠ see Known issues (KI-22). |
| RED-088 | Export presets | P2 | Manage open | 1. Click Export. | annotation-classes.json downloads with classes, fallbackPalette, autoPromote, matchMode. |
| RED-089 | Import presets | P2 | The exported file, edited | 1. Click Import, choose the file. | Toast "Classes imported — Annotation classes loaded."; the list updates. ⚠ see Known issues (KI-23): it applies without Apply. |
| RED-090 | Import an invalid preset file | P3 | Any non-preset JSON | 1. Import it. | Toast "Import failed — The file is not an annotation-class list (no valid classes)." |
| RED-091 | Reset presets | P3 | Modified presets | 1. Click Reset. | The default classes return. ⚠ see Known issues (KI-23): applied and saved without Apply. |
| RED-092 | Presets persist per user | P1 | JIT, logged in | 1. Add a class and Apply. 2. Reload JIT, reopen any image. | The class is still there (saved on the server). In the demo (no preferences server) presets last only for the session. |
Class tree (region sets with a hierarchy)¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-100 | Tree view | P2 | Allen atlas 1-in-10 dataset (brain-region tree) | 1. Open the Region Editor. | Classes show as a tree (roots expanded); a list/tree toggle ("Show the classes as a list" / "…as a tree") is in the header. |
| RED-101 | Expand and collapse | P3 | Same | 1. Click the ⊕ / ⊖ icons. | Branches expand and collapse. |
| RED-102 | Pick a class and its subtree | P2 | Same | 1. Click a class row. | It and its subclasses are picked; their regions are selected; the header shows "name · title". |
| RED-103 | Additive pick | P3 | Same | 1. Pick one class. 2. Shift-click another. | Both are picked. |
| RED-104 | Partial visibility | P3 | Same | 1. Hide one subclass. 2. Look at its parent's eye. | The parent's eye shows a partial state; tooltip ends with "(some are hidden)". |
| RED-105 | Absent classes greyed | P3 | A slice where some classes have no regions | 1. Look at the tree. | Classes absent from the slice are greyed. |
| RED-106 | Title on hover | P3 | Same | 1. Hover a class name for about a second. | Its long title shows. |
| RED-107 | Drawing replaces the tree pick | P3 | A picked class | 1. Click a region on the canvas. | The tree pick is cleared. |
Import¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-120 | Import a GeoJSON file | P1 | A GeoJSON exported earlier (RED-140) | 1. Click Import regions (upload icon). 2. Choose the file. | Toast "Regions imported"; the regions, classes and colours appear. |
| RED-121 | Import replaces current regions | P1 | Two regions drawn; a GeoJSON with three | 1. Import the file. | The image has exactly the three imported regions; the two drawn ones are gone. |
| RED-122 | QuPath-style classification | P2 | A GeoJSON with classification: {name, color} and one with a string classification |
1. Import each. | Class names (and colours where no preset exists) are taken from the file. |
| RED-123 | Missing classification | P3 | A feature without classification |
1. Import. | The region's class is "Cell". |
| RED-124 | Rectangles round-trip | P2 | Export with a rectangle, re-import | 1. Re-import. | The rectangle comes back as a rectangle (resize handles), not a polygon. |
| RED-125 | Holes, multi-parts, polylines, Bézier round-trip | P2 | Donut, multi-part, polyline, Bézier exported | 1. Re-import. | Holes, all parts, open lines (LineString) and Bézier curves (with handles) come back. |
| RED-126 | Invalid JSON | P2 | A text file with broken JSON | 1. Import it. | Toast "Error importing the file" with "Error parsing json string: …". |
| RED-127 | Missing features |
P3 | {"type":"FeatureCollection"} |
1. Import it. | "Invalid GeoJson file: must contain the 'features' key." |
| RED-128 | Missing coordinates |
P3 | A feature whose geometry has no coordinates | 1. Import it. | "Invalid GeoJson file: must contain the 'coordinates' key." |
| RED-129 | Point geometry | P3 | A GeoJSON with a Point feature |
1. Import it. | Record behaviour (unsupported geometry; an error is likely). ⚠ see Known issues (KI-29). |
| RED-130 | Multi-plane GeoJSON | P2 | A GeoJSON with plane.z on features, on a z-stack |
1. Import. | Features go to their slices; "N slice(s) annotated." in the toast. |
| RED-131 | Large GeoJSON becomes a region source | P2 | A GeoJSON of at least 1,000,000 characters (e.g. many cells) | 1. Import. 2. Zoom in and out. | Loaded as a level-of-detail source: features drawn from tiles in view, simplified when zoomed out, exact at 1:1. Rows appear after the regions in the table. |
| RED-132 | Taking a source feature | P3 | After RED-131 | 1. Click a source feature. 2. Change its class. | The feature joins the regions (editable); undoing past it returns it to the source. |
| RED-133 | Select all with a source | P3 | After RED-131 (more than 5000 features) | 1. Select all regions. | Regions plus up to 5000 source features are selected. |
| RED-134 | Import a folder of per-slice GeoJSON | P2 | A folder of GeoJSON files (one per slice) with regionset.json |
1. Click Import a folder (folder icon), pick the folder. | Files apply to slices in natural name order (slice_2 before slice_10); the class tree comes from regionset.json. |
| RED-135 | Import a label volume | P2 | A .nii.gz or .nrrd label volume with its ontology JSON, matching a z-stack |
1. Import both files together. | Each label becomes a class (from the ontology; "label N" without one). Toast "Regions imported". |
| RED-136 | Label volume of the wrong size | P3 | A label volume whose slices differ from the image | 1. Import. | Toast "Different size" — "The volume's slices are W × H; the image is W × H." |
| RED-137 | Unsupported file | P3 | A .txt file (via the folder import) |
1. Import. | "Error importing regions": "Choose a GeoJSON file, a folder of GeoJSON files, a .nii, .nii.gz or .nrrd label volume, an OME-Zarr store, or a .zip of any of these." |
| RED-138 | Import discarded on image change | P3 | A large import | 1. Start the import. 2. Switch image immediately. | Toast "Import discarded — The image changed while the regions were being read." |
| RED-139 | .zip from the file picker |
P3 | A .zip of GeoJSON files |
1. Click Import regions; try to choose the zip. | Record behaviour (.zip is not in the picker's accept list; the folder route accepts zips). ⚠ see Known issues (KI-28). |
| RED-150 | Import from server | P2 | JIT | 1. Click "Import regions from server…" (cloud icon). 2. Pick a file. | A spinner shows while loading; regions appear. The button is not shown in the demo. |
| RED-151 | OME-Zarr labels | P3 | JIT or a local OME-Zarr store with labels/ |
1. Import the store folder. | The first label image is used; classes appear. A store without labels: "The zarr store has no label image (an OME-Zarr labels/ group)." |
Export and save¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-140 | Export GeoJSON | P1 | Several regions of several classes | 1. Click "Download regions as geojson file". 2. Keep the name, click Export. | Dialog "Export Regions" with the name <image-stem>.geojson. A FeatureCollection downloads; each feature has properties.classification = {name, color:[r,g,b]}. |
| RED-141 | Export geometry types | P2 | Rectangle, polygon, donut, polyline, multi-part, Bézier | 1. Export and open the file. | Rectangle → Polygon (5-point ring); polygon → Polygon (holes as extra rings); polyline → LineString; multi-part → MultiPolygon; Bézier → flattened Polygon plus isBezier and handle properties. |
| RED-142 | Slice index in the export | P3 | Regions on slice 3 of a z-stack | 1. Export. | Features carry geometry.plane = {c:-1, z:3, t:0}; slice 0 has no plane. |
| RED-143 | Imported ids and properties kept | P3 | A GeoJSON with feature ids and extra properties |
1. Import, edit one region, export. | Feature ids and unknown properties are preserved. |
| RED-144 | Export with no image | P3 | Regions opened without an image (demo: "Open annotations…") | 1. Export. | Default name rois.geojson. |
| RED-145 | Save to server | P2 | JIT | 1. Click "Save regions to server." 2. Keep the name, save. | Dialog "Save Regions As", "GeoJSON filename" <stem>.geojson. Busy "Saving regions…" with Cancel. Toast "Regions saved — Saved as …". |
| RED-146 | Overwrite warning | P2 | JIT, a file that already exists | 1. Type the existing name. | "This file already exists and will be overwritten." shows; saving asks "Confirm Overwrite — "X" already exists. Do you want to overwrite it?". |
| RED-147 | Save a folder stack | P3 | JIT, a folder of slices with regions on several | 1. Save to server. | One GeoJSON per slice file is written, without the dialog; toast "Saved ROIs for N slice(s)". |
| RED-160 | Save mask (binary) | P1 | Regions on img01.png |
1. Click "Download mask of the regions as PNG". 2. Choose "Binary (regions 1, background 0)". 3. Save. | <stem>_mask.png downloads at the image size: background 0, regions non-zero. ⚠ see Known issues (KI-27: region value is 255). |
| RED-161 | Save mask (multi-class) | P2 | 3 regions | 1. Choose "Multi-class (unique id per region, background 0)". | Each region has its own value 1, 2, 3 (8-bit up to 255 regions, 16-bit above). Later regions paint over earlier ones. |
| RED-162 | Mask progress and cancel | P3 | Many regions on a WSI | 1. Save a mask. 2. Watch, then Cancel a second run. | "Rasterizing regions…" with a progress bar, then "Encoding PNG…". Cancel stops it. |
| RED-163 | Large mask is downscaled | P3 | WSI CMU-1 (> 100 MP) |
1. Save a mask. | Toast "Mask downscaled — Image too large for a full-resolution mask; saving at W×H." |
| RED-164 | Mask scope | P3 | A z-stack with regions on two slices; a region source | 1. Save a mask. | Record what is included. Expected from the code: only the current slice's regions, no region-source features; open polylines may be filled. ⚠ see Known issues (KI-26). |
3D class features¶
| ID | Title | Pri | Preconditions / data | Steps | Expected result |
|---|---|---|---|---|---|
| RED-180 | Volume column | P2 | micro-ct z-stack, Volume, regions on several slices | 1. Look at the table. | A Volume column replaces Surface (tooltip about the class's volume over the whole stack); voxels, µm³ or mm³. |
| RED-181 | Show a class in 3D | P2 | Same, regions of class Tumor on several slices | 1. Click Tumor's cube "Show in the volume, in 3D". | A translucent surface reconstructed from the outlines appears in the volume. |
| RED-182 | Pick a surface in 3D | P2 | After RED-181 | 1. Selection mode. 2. Click the surface. 3. Shift-click another class's surface. | The class is picked (near opaque; others fade); Shift adds to the pick. |
| RED-183 | Whole-stack counts | P3 | Same | 1. Compare class counts with the slice editor closed and open. | Closed: counts cover the whole stack. Open: the shown slice. |
| RED-184 | 3D failure toast | P3 | A class whose outlines cannot form a surface | 1. Show it in 3D. | Toast "Could not show the region in 3D" (if it fails); the view stays usable. |