virtualscanner.coms.coms_ui

Communications with front end

coms_server_flask.py

allowed_file(filename)

Checks that the file extension is within the application allowed extensions.

Parameters

filename (str) – Uploaded file name

Returns

Allowed or not allowed extension

Return type

bool

launch_virtualscanner()

Runs the server in the specified machine’s local network address.

log_in()

Renders the log-in html page on the web and requests user log-in information (e-mail) and choice of user mode (Standard/Advanced).

Returns

Redirects to register page if user-name exists and Standard mode is selected
OR
Redirects to recon page if user-name exists and Advanced mode is selected
OR
Renders log-in template

Return type

AppContext

on_acq()

Renders the acquire html page on the web.

Returns

Renders acquire template
May also pass variables:
success : int
Either 1 or 0 depending on acquisition success
axial : list
File names for generated axial images
sagittal : list
File names for generated sagittal images
coronal : list
File names for generated coronal images
payload : dict
Form inputted values sent back to display together with template

Return type

AppContext

on_analyze()

Renders the analyze html page on the web.

Returns

Renders analyze template
May also pass variables:
roi_success/map_success/load_success : int
Either 1 or 0 depending on analyze steps success
payload1/payload2/payload3 : dict
Form inputted values and output results sent back to display together with template

Return type

AppContext

on_recon()

Renders the recon html page on the web.

Returns

Renders recon template
May also pass variables:
success : int
Either 1 or 0 depending on recon success
payload : dict
Form inputted values and output results sent back to display together with template

Return type

AppContext

on_register()

Renders the registration html page on the web.

Returns

Renders register page
OR
Redirects to register success page if registration occurs

Return type

AppContext

on_register_success()

Renders the registration html page on the web with a success message when registration occurs.

Returns

Renders register page with registration success message
May also pass variables:
success : int
Either 1 or 0 depending on registration success
payload : dict
Form inputted values sent back to display together with template

Return type

AppContext

on_rx()

Renders the rx html page on the web.

Returns

Renders rx template
May also pass variables:
success : int
Either 1 or 0 depending on rx success
payload : dict
Form inputted values and output results sent back to display together with template

Return type

AppContext

on_tx()

Renders the tx html page on the web.

Returns

Renders tx template
May also pass variables:
success : int
Either 1 or 0 depending on tx success
payload : dict
Form inputted values and output results sent back to display together with template

Return type

AppContext

worker()

Receives form inputs from the templates and applies the server methods.

Returns

Either renders templates or redirects to other templates

Return type

AppContext

coms_ui.py

This script unit starts and tests the communications between server and client(s). Requires coms_server_flask to be running before the unit test is run (run coms_server_flask first).