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
27 changes: 19 additions & 8 deletions tools/AREG/AREG_CBCT/src/sadt_areg_cbct/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,25 @@
_SEMI = {"automation": [catalogs.AUTOMATION_AUTO, catalogs.AUTOMATION_SEMI]}

LAYOUT = {
# Injected by the server for every tool that calls another (see
# describe.INJECTED_ARGUMENTS), and unnamed it arrives with a generic label
# in a section of its own -- an "Intermediate results" box in a panel that
# never asked for one. Hidden rather than renamed: what this chain leaves
# behind on the way is not something a clinician is being offered yet, and
# a check box that promises files nobody has decided to return is worse
# than no check box.
"keep_intermediate": {"hidden": True},
# Injected by the server for any tool that calls another, so it is not in
# run()'s signature -- see describe.INJECTED_ARGUMENTS. The options are the
# steps themselves; only the wording is this tool's to give, and it is
# worth giving: "intermediate results" says nothing to a clinician, while
# the name of a step plus what it hands back is what makes a chain
# inspectable. ASO, ALI_IOS and VFACE already offer it, and AREG was the
# odd one out. The server only collects the output of the calls THIS tool
# makes, so ticking `ASO` returns ASO's own result and not the landmarks
# ASO predicted on the way.
"keep_intermediate": {
"label": "Steps to keep",
"option_help": {
"AMASSS": "The bone masks each region's registration is confined to "
"-- what to look at when a registration lands on the "
"wrong anatomy.",
"ASO": "The scans once both timepoints sit in a common orientation, "
"before the registration is run on them.",
},
},

# Injected by the server too, from the checkpoints this chain offers, and
# it lands in a "Quality control" section of its own. Not offered yet:
Expand Down
12 changes: 12 additions & 0 deletions tools/AREG/AREG_CBCT/tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,15 @@ def test_without_a_span_the_call_is_unchanged(self, tmp_path):
tools.segment_masks(sup, str(tmp_path), "/models", ["CBMASK"])

assert sup.spans == [("AMASSS", None)]


def test_the_steps_to_keep_are_offered_and_each_one_is_explained():
"""`keep_intermediate` is injected by the server from the tools this one
calls. Hidden, a clinician had no way to look at a step's working; named,
every step the chain runs says what it hands back."""
from sadt_areg_cbct.layout import LAYOUT

hints = LAYOUT["keep_intermediate"]
assert not hints.get("hidden")
assert hints["label"] == "Steps to keep"
assert set(hints["option_help"]) == {"AMASSS", "ASO"}
28 changes: 20 additions & 8 deletions tools/AREG/AREG_IOS/src/sadt_areg_ios/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,26 @@
_FULLY = {"automation": [catalogs.AUTOMATION_AUTO, catalogs.AUTOMATION_FULLY]}

LAYOUT = {
# Injected by the server for every tool that calls another (see
# describe.INJECTED_ARGUMENTS), and unnamed it arrives with a generic label
# in a section of its own -- an "Intermediate results" box in a panel that
# never asked for one. Hidden rather than renamed: what this chain leaves
# behind on the way is not something a clinician is being offered yet, and
# a check box that promises files nobody has decided to return is worse
# than no check box.
"keep_intermediate": {"hidden": True},
# Injected by the server for any tool that calls another, so it is not in
# run()'s signature -- see describe.INJECTED_ARGUMENTS. The options are the
# steps themselves; only the wording is this tool's to give, and it is
# worth giving: "intermediate results" says nothing to a clinician, while
# the name of a step plus what it hands back is what makes a chain
# inspectable. ASO, ALI_IOS and VFACE already offer it, and AREG was the
# odd one out. The server only collects the output of the calls THIS tool
# makes, so ticking `ASO` returns ASO's own result and not the landmarks
# ASO predicted on the way.
"keep_intermediate": {
"label": "Steps to keep",
"option_help": {
"ALI_IOS": "The landmarks placed on the intraoral scans, which the "
"mucogingival patch is built from.",
"ASO": "The scans once both timepoints sit in a common orientation, "
"before the registration is run on them.",
"Crown_Seg": "The per-tooth labelled meshes, which this tool "
"otherwise only uses to name the teeth.",
},
},

# Injected by the server too, from the checkpoints this chain offers, and
# it lands in a "Quality control" section of its own. Not offered yet:
Expand Down
12 changes: 12 additions & 0 deletions tools/AREG/AREG_IOS/tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,3 +1380,15 @@ def test_without_a_report_crown_seg_s_output_is_used_as_it_came(tmp_path):
(planted / "x" / "A2_UpperT1_Seg.vtk").write_text("")
sup = FakeSup(tmp_path, {"Crown_Seg": lambda params: planted})
assert Path(tools.label_crowns(sup, str(tmp_path / "meshes"))) == planted


def test_the_steps_to_keep_are_offered_and_each_one_is_explained():
"""`keep_intermediate` is injected by the server from the tools this one
calls. Hidden, a clinician had no way to look at a step's working; named,
every step the chain runs says what it hands back."""
from sadt_areg_ios.layout import LAYOUT

hints = LAYOUT["keep_intermediate"]
assert not hints.get("hidden")
assert hints["label"] == "Steps to keep"
assert set(hints["option_help"]) == {"ALI_IOS", "ASO", "Crown_Seg"}
30 changes: 22 additions & 8 deletions tools/AREG/AREG_IOSCBCT/src/sadt_areg_ioscbct/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,28 @@
_ORIENTED = {"automation": [catalogs.AUTOMATION_AUTO, catalogs.AUTOMATION_FULLY]}

LAYOUT = {
# Injected by the server for every tool that calls another (see
# describe.INJECTED_ARGUMENTS), and unnamed it arrives with a generic label
# in a section of its own -- an "Intermediate results" box in a panel that
# never asked for one. Hidden rather than renamed: what this chain leaves
# behind on the way is not something a clinician is being offered yet, and
# a check box that promises files nobody has decided to return is worse
# than no check box.
"keep_intermediate": {"hidden": True},
# Injected by the server for any tool that calls another, so it is not in
# run()'s signature -- see describe.INJECTED_ARGUMENTS. The options are the
# steps themselves; only the wording is this tool's to give, and it is
# worth giving: "intermediate results" says nothing to a clinician, while
# the name of a step plus what it hands back is what makes a chain
# inspectable. ASO, ALI_IOS and VFACE already offer it, and AREG was the
# odd one out. The server only collects the output of the calls THIS tool
# makes, so ticking `ASO` returns ASO's own result and not the landmarks
# ASO predicted on the way.
"keep_intermediate": {
"label": "Steps to keep",
"option_help": {
"ALI_CBCT": "The landmarks placed on the CBCT, before this tool "
"registers on them.",
"ALI_IOS": "The landmarks placed on the intraoral scans, which the "
"mucogingival patch is built from.",
"ASO": "The scans once both timepoints sit in a common orientation, "
"before the registration is run on them.",
"Crown_Seg": "The per-tooth labelled meshes, which this tool "
"otherwise only uses to name the teeth.",
},
},

# Injected by the server too, from the checkpoints this chain offers, and
# it lands in a "Quality control" section of its own. Not offered yet:
Expand Down
12 changes: 12 additions & 0 deletions tools/AREG/AREG_IOSCBCT/tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,15 @@ def test_a_supervisor_is_accepted_and_unused_in_registration_mode(tmp_path):
sup = FakeSup(tmp_path)
run_registration(tmp_path, sup=sup)
assert sup.calls == []


def test_the_steps_to_keep_are_offered_and_each_one_is_explained():
"""`keep_intermediate` is injected by the server from the tools this one
calls. Hidden, a clinician had no way to look at a step's working; named,
every step the chain runs says what it hands back."""
from sadt_areg_ioscbct.layout import LAYOUT

hints = LAYOUT["keep_intermediate"]
assert not hints.get("hidden")
assert hints["label"] == "Steps to keep"
assert set(hints["option_help"]) == {"ALI_CBCT", "ALI_IOS", "ASO", "Crown_Seg"}
Loading