validate.seg.structures#

Registry mapping a required structure to the auto-segmentation method. Contains functions to: - Transform raw AI outputs to the structures required to run a dosimetric model including operations such as union, intersection, diff etc. - Identify the structures required by a dosimetric model, and apply a user-supplied name mapping.

Structures with derivation recipes (STRUCTURE_REGISTRY, end of this file): Oral cavity, Submandibular glands, SCRR, Parotids-SCRR

Functions

applyStructureNameMap(modelFile, structNameMap)

Return a copy of the model dict with required structures renamed to

deriveOralCavity(planC, scanNum)

deriveParotidsSCRR(planC, scanNum)

deriveSCRR(planC, scanNum)

deriveSubmandibularGlands(planC, scanNum)

getDerivation(structName)

Return the StructureDerivation for structName, or None if no derivation is registered yet.

getRequiredAiModels(structNames)

Resolve the AI models needed to auto-segment structNames.

getRequiredStructures(modelFile)

Return the structure names a model requires or an empty list if none.

listReqdAISegModels(modelFile)

Names of the AI models whose outputs a dosimetric model's structures are derived from (by their registered recipes), in the order the structures are listed.

loadModelJSON(modelFile)

Load a model's parameter dict.

Classes

StructureDerivation(deriveFn[, aiModelNum, ...])

class validate.seg.structures.StructureDerivation(deriveFn: Callable, aiModelNum: int = None, aiModelName: str = None, type: str = 'AI')[source]#

Bases: object

Parameters:
  • deriveFn (Callable)

  • aiModelNum (int)

  • aiModelName (str)

  • type (str)

deriveFn: Callable#
aiModelNum: int = None#
aiModelName: str = None#
type: str = 'AI'#
validate.seg.structures.getDerivation(structName)[source]#

Return the StructureDerivation for structName, or None if no derivation is registered yet.

validate.seg.structures.listReqdAISegModels(modelFile)[source]#

Names of the AI models whose outputs a dosimetric model’s structures are derived from (by their registered recipes), in the order the structures are listed.

validate.seg.structures.getRequiredAiModels(structNames)[source]#

Resolve the AI models needed to auto-segment structNames.

Returns:

(models, missing) where models is {aiModelNum – aiModelName} for the distinct AI models needed, and missing is the list of structNames with no registered derivation.

validate.seg.structures.loadModelJSON(modelFile)[source]#

Load a model’s parameter dict. modelFile: a built-in model name, a path to a parameter JSON file, or a dict (returned as-is).

validate.seg.structures.getRequiredStructures(modelFile)[source]#

Return the structure names a model requires or an empty list if none.

validate.seg.structures.applyStructureNameMap(modelFile, structNameMap)[source]#
Return a copy of the model dict with required structures renamed to

dataset-specific versions.

Parameters:
  • modelFile – model name, JSON path, or dict (see loadModelDict).

  • structNameMap (dict) – {modelStructName: datasetStructName}. A missing or blank mapping for a structure leaves its name unchanged.

Returns:

dict – a copy of the model dict with parameters.structures renamed.

validate.seg.structures.deriveOralCavity(planC, scanNum)[source]#
validate.seg.structures.deriveSubmandibularGlands(planC, scanNum)[source]#
validate.seg.structures.deriveSCRR(planC, scanNum)[source]#
validate.seg.structures.deriveParotidsSCRR(planC, scanNum)[source]#