Appendix 3 Slicer Interface Code Python Template – – The Slicer Interface code consists of a Parent class and a Widget class as shown below. The following pages include step-by-step information on how to use this template. Note that go at the front of the module. Replace YourModuleName with the name of the module. Important Note: The script must be saved under the same name as YourModuleName. For example, a module name of Template must be saved under Template.py. Replace YourModuleNameWidget with appended to the name of the “Widget” module. This must not include any spaces. For example, a module name of Template must have this field as TemplateWidget. Replace all marked fields in the YourModuleName class. parent.title = Title of module that users will see in the module list parent.category = Category that this module will fit into in the module list See module list for examples (Utilities, Informatics etc.) parent.contributors = List of people who contributed to this module parent.helpText = Description of module that will see parent.acknowledgementText = List of acknowledgements (i.e. Sponsors) Do the code in of not __init__ YourModuleNameWidget Under def setup(self) of YourModuleNameWidget, determine number of required buttons and add/remove as necessary. The template only includes generic push buttons (qt.QPushButton). These push buttons are shown in the figure below. Buttons are stored as variables using the following format. variableName = qt.QPushButton(“Text to display on button”)
Appendix 3 – Slicer Interface Code – Python Template The Slicer Interface code consists of a Parent class and a Widget class as shown below. The following pages include step-by-step information on how to use this template. Note that go at the front of the module. Replace YourModuleName with the name of the module. Important Note: The script must be saved under the same name as YourModuleName. For example, a module name of Template must be saved under Template.py. Replace YourModuleNameWidget with “Widget” appended to the name of the module. This must not include any spaces. For example, a module name of Template must have this field as TemplateWidget. Replace all marked fields in the YourModuleName class. parent.title = Title of module that users will see in the module list parent.category = Category that this module will fit into in the module list See module list for examples (Utilities, Informatics etc.) parent.contributors = List of people who contributed to this module parent.helpText = Description of module that will see parent.acknowledgementText = List of acknowledgements (i.e. Sponsors) Do not the code in __init__ of YourModuleNameWidget Under def setup(self) of YourModuleNameWidget, determine number of required buttons and add/remove as necessary. The template only includes generic push buttons (qt.QPushButton). These push buttons are shown in the figure below. Buttons are stored as variables using the following format. variableName = qt.QPushButton(“Text to display on button”)