niftynet.engine.application_driver module

This module defines a general procedure for running applications.

Example usage::
app_driver = ApplicationDriver() app_driver.initialise_application(system_param, input_data_param) app_driver.run_application()

system_param and input_data_param should be generated using: niftynet.utilities.user_parameters_parser.run()

class ApplicationDriver[source]

Bases: object

This class initialises an application by building a TF graph, and maintaining a session and coordinator. It controls the starting/stopping of an application. Applications should be implemented by inheriting niftynet.application.base_application to be compatible with this driver.

initialise_application(workflow_param, data_param)[source]

This function receives all parameters from user config file, create an instance of application.

Parameters:
  • workflow_param – a dictionary of user parameters, keys correspond to sections in the config file
  • data_param – a dictionary of input image parameters, keys correspond to data properties to be used by image_reader
Returns:

run_application()[source]

Initialise a TF graph, connect data sampler and network within the graph context, run training loops or inference loops.

The training loop terminates when self.final_iter reached. The inference loop terminates when there is no more image sample to be processed from image reader.

Returns:
run_vars(sess, message)[source]

Running a TF session by retrieving variables/operations to run, along with data for feed_dict.

This function sets message._current_iter_output with session.run outputs.