neurocarto.util.edit

How to write a blueprint script function

Real examples are:

  • src/neurocarto/util/edit/_actions.py

  • tests/bp_example.py

Prepare a python file example.py with following contents.

from neurocarto.util.util_blueprint import BlueprintFunctions
def my_blueprint_script_function(bp: BlueprintFunctions, a0: str, a1: int):
    """
    Script Document, which is used in GUI.

    :param bp:
    :param a0: (str) the first string argument
    :param a1: (int) the second int argument
    """
    bp.log_message(f'{a0=}', f'{a1=}')

For more detail information of how to declare a blueprint function, please check BlueprintScript.

Add example.py into neurocarto.config.json.

{
  "BlueprintScriptView": {
    "actions" : {
      "my": "example:my_blueprint_script_function"
    }
  }
}

Start an application with the commandline option --view=script, then you can test your script.

Internal blueprint functions

It is an internal package for providing functions to the BlueprintFunctions