Skip to content

TG263

find_structures

pygrpm.tg263.nomenclature.find_structures(structure_name: str)

Finds if the name given in parameter is found in tg263 reference. Returns all information of possible structures.

Example

import pygrpm

result = pygrpm.tg263.nomenclature.find_structures('SpinalCord')
print(result)
#[
#    {
#    "targetType": "Anatomic",
#    "majorCategory": "Nerve",
#    "minorCategory": "Spinal Cord",
#    "anatomicGroup": "Body",
#    "nCharacters": 10,
#    "tg263PrimaryName": "SpinalCord",
#    "tg263ReverseOrderName": "SpinalCord",
#    "description": "Spinal Cord",
#    "fmaid": 7647
#    },
#    {
#    "targetType": "Anatomic",
#    "majorCategory": "Nerve",
#    "minorCategory": "Spinal Cord",
#    "anatomicGroup": "Head and Neck",
#    "nCharacters": 15,
#    "tg263PrimaryName": "SpinalCord_Cerv",
#    "tg263ReverseOrderName": "Cerv_SpinalCord",
#    "description": "Spinal Cord Cervical",
#    "fmaid": 71166
#    },
#    ...
#]

Parameters

structure_name

String to search for in TG263.

Returns

  • List of dictionnaries with structure information

is_structure_name_allowed

pygrpm.tg263.nomenclature.is_structure_name_allowed(structure_name: str)

Finds if the name given in parameter is found in tg263 reference. Returns a boolean in consequence.

Example

import pygrpm

result = pygrpm.tg263.nomenclature.is_structure_name_allowed('SpinalCord')
print(result)
# True

Parameters

structure_name

String to search for in TG263

Returns

  • Boolean value. True if present in TG263, false otherwise.

is_structure_valid

pygrpm.tg263.nomenclature.is_structure_valid(structure: dict)

Verifies that parameter dictionary is a valid structure. Returns a boolean and an error log accordingly. Criterias used to determine the validity of structures are based on the recommendations of the American Association of Physicists in Medicine in the TG263 report.

Source: https://www.aapm.org/pubs/reports/RPT_263_Supplemental/

Example

import pygrpm

structure = {
                "targetType": "Anatomic",
                "majorCategory": "Nerve",
                "minorCategory": "Spinal Cord",
                "anatomicGroup": "Head and Neck",
                "nCharacters": 15,
                "tg263PrimaryName": "SpinalCord_Cerv",
                "tg263ReverseOrderName": "Cerv_SpinalCord",
                "description": "Spinal Cord Cervical",
                "fmaid": 71166
            }

result, log = pygrpm.tg263.nomenclature.is_structure_valid(structure)
print(result)
# True
print(log)
# "Structure is valid"

Parameters

structure

Dictionary containing the structure information.

Returns

  • Boolean: True if the structure is valid, false otherwise.
  • String: Logs the problem with the structure, if any.

pygrpm.tg263.nomenclature.print_structure_info(allowed_structure: dict)

Prints all associated information of the structure. If the structure isn't valid, prints the log from is_structure_valid.

Example

import pygrpm

allowed_structure = {
                "targetType": "Anatomic",
                "majorCategory": "Nerve",
                "minorCategory": "Spinal Cord",
                "anatomicGroup": "Head and Neck",
                "nCharacters": 15,
                "tg263PrimaryName": "SpinalCord_Cerv",
                "tg263ReverseOrderName": "Cerv_SpinalCord",
                "description": "Spinal Cord Cervical",
                "fmaid": 71166
            }

pygrpm.tg263.nomenclature.print_structure_info(allowed_structure)
#
#
#FMAID:  71166
#
#Primary Name:  SpinalCord_Cerv
#Reverse Order Name:  Cerv_SpinalCord
#
#Target Type:  Anatomic
#Anatomic Group:  Head and Neck
#Major Category:  Nerve
#Minor Category:  Spinal Cord
#
#Description:  Spinal Cord Cervical

Parameters

allowed_structure

Dictionary containing the structure information.