Configuring

Several Braviz parameters are available to end-users via a configuration file names braviz.cfg and located in the braviz.applications directory. This files are parsed by the python ConfigParser module.

Configuration file

The default config file is

[Braviz]
project = kmc400
server_port = 8100
logger = console
web_logger_server = 127.0.0.1:8050

[Default_Variables]
nominal1 = ubicac
nominal2 = BIRTH_sexo5
numeric1 = WASI_FSIQ_4
numeric2 = BIRTH_peso5
laterality = LAT_EdinburgHandedness
left_handed_label = 3
reference_pop_var = ubicac
reference_pop_label = 3

[Defaults]
default_subject = 119

[VTK]
background = 0.1 0.1 0.2
interaction_style = TrackballCamera

Braviz

The project field defines the project that will be used in the following session. This defines the BaseReader subclass that will be used, and according to it the location for the database and cache files.

The server_port field contains the port in which the Braviz Web server will listen for http connections.

The logger field can take the values console, file or web_logger. In the first case all logging is done to the terminal, in the second case it is stored in the logs directory inside get_auto_dyn_data_root() Finally, logging messages are sent ass HTTP requests to the address specified in the web_logger_server field of this section.

Default_Variables

This variables are shown by default in several applications. The user may use this field to choose the variables which are more important to them.

The laterality variable is used to solve which is the dominant hemisphere for each participant, it is assumed to be the left side unless its value is left_handed_label.

The reference_pop_var defines a reference population, where its value is equal to reference_pop_label. This is used in some applications to calculate a typical range for variable values.

Defaults

The default_subject field specifies the subject that will be loaded by default at the start of applications.

VTK

Deprecated since version 2.0: It is recommended to use interaction style trackballCamera and a degraded gray background color.

The background field is used in legacy applications to select a background color for all vtk viewers.

The interaction_style is used in legacy applications to select a different interaction style for vtk viewers.

Host Configuration

Host configuration files contain information for configuring auto readers (see Reading geometric data). This files are named after the project they belongs to. For example the file for the kmc project would be named kmc_hosts.cfg. This files use the same syntax as the standard configuration files (config_file).

This file contains the parameters required to create a reader in specific hosts. This allows using the same installation in different machines. When creating an autoreader the hostname is found using platform.node(), afterwards a section with that name is located in the _hosts.cfg file. The options found in this section are returned as a dictionary which may be used by get_auto_reader(). A section in such a file may look like this

[Echer]
data root = H:/kmc400
dynamic data root = H:/kmc400-braviz
memory (mb) = 8000

Implementation

Configuration file access is implemented in the module braviz.readAndFilter.config_file

BravizConfig Class

class BravizConfig[source]

Holds Braviz configuration

get_default_variables()[source]

Default variables from configuration file

Returns:dict – A dictionary containing the default variables. The keys are {"nom1","nom2","ratio1","ratio2","lat"}
get_laterality()[source]

Laterality from configuration file

Returns:A tuple (lat, left) where lat is the name of the nominal variable containing laterality information and left is the label (integer) this variable takes for left-handed subjects.
get_reference_population()[source]

Reference population from configuration file

Returns:A tuple (var,label) where var is the name of the nominal variable that separates the reference population and label is the integer value this variable takes for the reference population
get_default_subject()[source]

Default subject from configuration file

Returns:An integer containing the code for the chosen default subject
get_background()[source]

Background color from a configuration file

Deprecated since version 3.0b: Use a gray or degraded gray background

Returns:tuple – RGB value as a float tuple
get_interaction_style()[source]

Interaction style from a configuration file

Deprecated since version 3.0b: Use TrackballCamera

Checks if the intraction style is a valid vtk interaction style and returns vtk name

Returns:vtkInteractorStyle class

Read Configuration

get_config(custom_dir=None)[source]

Read Braviz configuration file

A default configuration file is read at the library directory. A secondary configuration can also be read, and in this case its values will overwrite default ones.

Parameters:custom_dir (str) – Location of a secondary configuration file. For convenience a file can also be passed and the directory containing it will be used
Returns:BravizConfig – An instance of BravizConfig containing the configuration specified in the file at the specified directory
get_apps_config()[source]

Reads configuration from the ‘braviz.applications’ directory BravizConfig

Parameters:lala (str) – mamama BravizConfig
Returns:BravizConfig – An instance of BravizConfig containing the configuration specified in the file at the applications directory
get_host_config(project, hostname=None)[source]

Reads host configuration for a given project

Parameters:
  • project (str) – The name of the project. This function will look for a file called <project>_hosts.cfg in the directory containing the module braviz.applications
  • hostname (str) – Name of host to get configuration. If None the name of the current host, as returned by platform.node() will be used
Returns:

dict – A dictionary containing the requested configuration parameters.

Create config

make_default_config(default_config_name=None)[source]

Creates a configuration file with default parameters and stores it

Parameters:default_config_name (str) – Name used to store the default configuration, if None it stored as braviz.cfg in the directory containing this library