Uvis Application Code¶
The Uvis Application is structured with the MVC architecture pattern.
Module Overview
uvis_controller.py - Contains the major logic of the application.
uvis_view.py - Contains the view of the application
uvis_model.py - Contains the model class handling data and persiting to csv.
NavigationVisualizer.py - Separate Navigation visualization for orientation + position.
Calibrator.py - Contains the Calibrator class which is handles the calibration of the EMM Tracking system.
config.py - Contains the configuration for the uvis application like serial configuration etc.
helper.py - Contains minor helping methods for the application.
uvis_controller¶
The uvis_controller module contains the major logic of the application.
UltraVisController implements the logic.
-
class
uvis_controller.UltraVisController(debug_mode=False)¶ - Parameters
debug_mode (bool) – Enables debug functionality in the app. The main.py normally sets this parameter.
The UltraVisController class controls the application flow and connects all modules of the uvis app.
-
_debugfunc()¶ Internal method for testing all kinds of code
-
_do_data_evaluation()¶ Evaluates the current Ground Truth datasets and display the boxplots.
-
_initBackgroundQueue()¶ Initializes a
threading.Queuein the background for parallel processing (e.g.init_aurora())
-
_initObservers()¶
-
_init_framegrabber()¶
-
_on_closing()¶ Closing method when the root window is closed. Stops all relevant processing for a clean exit.
-
activateHandles()¶ Initializes and activated the handles in order to start tracking. See NDI Aurora API Guide for more details.
-
addFuncDebug()¶ Adds the button functionality for the debugging GUI
-
addSetupHandlesFunc()¶ Sets the button functionality for the setuphandles frame.
-
build_summary()¶ Build the summary for “examination summary” frame.
-
calibrate_coordsys(calibrator=None, handles=None)¶ - Parameters
calibrator (Calibrator) – Preconfigured calibrator object or
None.handles (dict) – A dictionary containing
aurora.HandleobjectsNone.
Calibrates by default the reference coordinate system of the application. An individual
Calibratorobject can also be given (e.g. for loading recorded data).
-
cancel_examination(save=False)¶ Cancels current workflow and loads the main menu frame.
-
capture_framegrabber(label, ms_delay=35)¶ - Parameters
label (tkinter.Label) – The tkinter label in which the video source is rendered.
ms_delay (int) – The refresh rate for the video stream.
- Returns
Returns the scheduler_id for canceling the frame grabber job with the after_cancel method.
Starts a background process for continuously refreshing the given label, with the grabbed image. The label must be a
tkinter.Labelobject. For the delay thetkinter.Label.after()method is used.
TODO
-
evaluate_examination()¶ Starts the GUI for the “evaluate examination” frame
-
finalize_examination()¶ Starts the GUI for the “examination summary”, after persisting the current workitem.
-
init_aurora(ser)¶ Initializes the NDI Aurora system (see for details
aurora.Aurora).- Parameters
ser (serial.Serial) – The Serial object configured to the NDI Aurora System.
Sets for all buttons the functionality. The buttons are defined in
UltraVisView.build_menu_frame().
Accepts the temporary record and persists it to the database. It also compares the records and displays statistics
The same as
save_record()but for the navigation process.
-
new_examination()¶ Starts the GUI for new examinations.
-
open_evaluation()¶ Starts the GUI for the “open evaluation” frame
-
open_examination()¶ Starts the GUI for the “open examination” frame.
-
refreshWorkItem()¶
-
refresh_position_data()¶ Refreshes and visualizes the tracking data in tabular form. See
UltraVisView.build_position_summary().
-
refresh_sysmode()¶ Displays the current Operating mode of the NDI Aurora System. Modes are ‘Setup’ and ‘Tracking’. For more details please read the official NDI Aurora API Guide.
-
run()¶ Starts the tkinter mainloop after
__init__().
-
save_record()¶ Acquires record data (ultrasound image, current date etc.) in an
uvis_model.Recordobject and persist the data with theuvis_model.UltraVisModel.
Transforms the handle data to the correct reference system with the
Calibratorand then provides the data to the view (NavigationVisualizerto be precise).
-
set_target_from_record(record=None, R_ID=None)¶ - Parameters
record (uvis_model.Record) –
uvis_model.Recordobject to be loaded orNone.R_ID (str) – R_ID like “R-0” to be loaded or
None.
Sets the target for an navigation based on an record. As input it can either use the R-ID or an
uvis_model.RecordObject.
-
set_target_pos(calibrator=None, handles=None)¶ - Parameters
calibrator (Calibrator) – Preconfigured calibrator object or
None.handles (dict) – A dictionary containing
aurora.Handleobjects orNone.
By default it sets a target in the navigation visualzation for the current reference coordinate system. Alternatively it is used to load a Record and set that data as a target.
-
setup_handles()¶ Validates the examination meta data and starts the GUI for “setup handles”.
-
start_examination()¶ Starts the GUI for the “examination”.
- Parameters
event (buttonevent) – Defaults to
None. Param is necessary for <Enter> event.
Starts the GUI for the “navigation” frame and loads the first record as a target for navigation.
-
startstopTracking()¶ Starts / Stops the current tracking process of the Aurora System
-
testFunction()¶ Tests a function for the debugging GUI
-
track_handles()¶ Acquires the handle data from the Aurora system. Data is available from the
aurora.Handlemanager. Can either be done with bx or tx. Use bx for faster processing.
-
validatePosition(handles)¶ Validates the 4 handles (“position”) before saving. It checks the frameID and missing handles.
-
validate_examination()¶ Validates the data from the “examination” frame.
-
validate_new_examination()¶ - Returns
isValid indicator,
uvis_model.Examination- Return type
bool,
uvis_model.Examination
Validates the data from the “new examination” frame and returns
uvis_model.Examinationobject.
-
validate_setuphandles(handle_index=None)¶ - Parameters
handle_index (int) – index of 0-3 or
None- Returns
isValid indicator.
- Return type
bool
- Raises
ValueError – Will be raised when handle_index are out of range or incorrect.
Validates the data from the “setup handles” frame.
-
writeCmd2AUA(event)¶ Writes a serial Command to the NDI Aurora System
uvis_view¶
This is the uvis_view module.
The uvis_view module contains contains the views / frontend of the uvis application.
-
class
uvis_view.UltraVisView(master, debug_mode=False)¶ - Parameters
master (tkinter.Frame) – The root frame.
debug_mode (bool) – Enables debug functionality in the app. The main.py normally sets this parameter.
The UltraVisView class inherits from the
tkinter.Frameclass and is the frontend implementation of the Uvis Application.Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
-
_build_statistics_table(master, title_id)¶ - Parameters
master (tkinter.Frame) – The master frame.
title_id (string) – String for statistics table title.
- Returns
Statistics table frame.
- Return type
tkinter.Frame
Builds the statistics table frame.
-
_build_tab1()¶
-
_build_tab2()¶
-
_center_window(toplevel, width, height)¶ - Parameters
toplevel (tkinter.Frame) – The toplevel / root frame.
width (int) –
height (int) –
- Returns
Returns the centered Position for the tk.Frame.geometry() function.
- Return type
str
-
build_DebugCMD(rFrame)¶ Build the debug menu
-
build_DebugMenu(lFrame)¶ - Parameters
lFrame (tkinter.Frame) – The master frame.
Builds the debug frame.
-
build_coordinatesystem()¶ Sets the navcanvas_data for the NavigationVisualization. It refreshes every 25 ms.
-
build_details_frame(lFrame)¶ - Parameters
lFrame (tkinter.Frame) – The master frame.
Builds the scrollable details_frame (
helper.ScrollableFrameobject).
-
build_evaluation_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
build_exam_summary(master, exam)¶ - Parameters
master (tkinter.Frame) – The master frame.
exam (uvis_model.Examination) – The Examination object for the summary frame.
- Raises
TypeError – Will be raised when param exam is not of type
uvis_model.Examination.- Returns
Returns the
uvis_model.Examinationsummary as antkinter.Frameobject.- Return type
tkinter.Frame
Builds an a summary frame, for an Examination. The Frame displays the
uvis_model.Examinationobject in 3 Column pairs.
-
build_examination_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
build_mainscreen_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
Builds the mainscreen of the app.
- Parameters
lFrame (tkinter.Frame) – The master frame.
Build the menu frame and adds the buttons to the application
- Parameters
master (tkinter.Frame) – The master frame.
-
build_newExam_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
build_openeval_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
build_openexam_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
build_position_summary(master, position)¶ - Parameters
master (tkinter.Frame) – The master frame.
position (dict) – A dictionary contained up to 4
aurora.Handlesobject.
- Raises
TypeError – Will be raised when if the dictonary position doesn’t include objetcs
aurora.Handlesonly.- Returns
Returns the sensor data for summary as an
tkinter.Frameobject.- Return type
tkinter.Frame
Builds an a summary frame, for an Examination. The Frame displays the 4
aurora.Handles/ the Position in an table format.
-
build_record_summary(master, record)¶ - Parameters
master (tkinter.Frame) – The master frame.
record (uvis_model.Record) – The Record object for the summary frame.
- Raises
TypeError – Will be raised when param record is not of type
uvis_model.Record.- Returns
Returns the
uvis_model.Recordsummary as antkinter.Frameobject.- Return type
tkinter.Frame
Builds an a summary frame, for a Record. The frame displays the
uvis_model.Recordobject in 3 Column pairs.
-
build_setup_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
build_summary_frame(master)¶ - Parameters
master (tkinter.Frame) – The master frame.
-
calculate_US_imgsize()¶ “Calculates the max available image size of the frame grabber / ultra sound image and resizes the image source.
Recursively removes the Buttons from the menu_frame
-
getImage_fromfile(filename, asTKImage=True)¶ Return a PIL.Image.Image or PIL.ImageTk.PhotoImage from the file system.
-
get_statistics_table()¶ Getter of statistics table frame.
-
initImages()¶ Initializes images from the predecessor project.
-
refresh_img_for_lb(event=None, img=None, lb=None)¶ - Parameters
event (event) – Defaults to
None. Param is necessary for <Framechanged> eventimg (Image.Image) –
PIL.Image.Imageof the frame grabber.lb (tkinter.Label) –
tkinter.Labelfor displaying the image.
Supporting method for setting to image for a given label and resizing it to img_size.
-
refresh_imgsize(frame, event=None)¶ - Parameters
frame (tkinter.Frame) –
tkinter.Frameof the frame grabber.
Supporting method for background refreshing of frame grabber img_size.
-
refresh_saved_img(event=None)¶ Supporting method for resizing the saved_img label.
-
set_calibrate_info(msg, msg_type='INFO')¶
-
set_current_setuphandle(handle_index)¶ - Parameters
handle_index (int) – index of 0-3.
Sets the active / current setuphandle in the setup frame.
- Parameters
eval_list (list) – List with all examination (E_ID) for evaluation.
Loads the distinct E_IDs from the comparison table into the dropdown.
-
set_handle_info(msg, msg_type='INFO')¶
-
set_info_message(msg, type='INFO')¶ - Parameters
msg (str) – The message string to be displayed.
type (str) – The display type. Must be in [‘INFO’, ‘SUCCESS’, ‘ERROR’]
Sets the info message in the details frame.
-
set_setup_instruction(text)¶ - Parameters
text (str) – Instuction text.
Sets the setup instruction.
-
set_statistics_table(df: pandas.core.frame.DataFrame)¶ - Parameters
df (pd.DataFrame) – The DataFrame containing the statistic data.
Sets and displays the statistics data.
- Parameters
records_list (list) – Holds a list of R_ID (str), which are available for the dropdown.
Sets the target_menu for the navigation menu. Param records_list should hold R_ID which shall be loaded
-
set_tracking_info(msg, msg_type='INFO')¶
- Parameters
menu (str) – Menu to be displayed. Defaults to ‘main’. Menu param must be in [‘main’, ‘new_examination’, ‘setup’, ‘examination’, ‘summary’, ‘open_examination’, ‘navigation’, ‘open_evaluation’, ‘evaluate_examination’]
states (list) – list a 0,1 sequence for button states in the menu.
- Raises
ValueError – Will be raised when menu param is not in valid keys.
Displays the corresponding menu, for an application frame. The menu chosen via the menu parameter will be displayed. With the ‘states’ parameter the states of the buttons in the menu can be influences via a 0,1 sequence [0,1,1,…].
- Note
STATES IS NOT IMPLEMENTED YET!
-
switch_imgsrc()¶ Switches between the VideoinputSource and the savedimaged frame
-
uvis_view.clear_frame(func)¶ The decorator clears the master (tkinter.Frame Object) of its children when the build_frame method is called. The build_frame method must be called with the ‘master’ keyword.
Example: myframe = self.build_frame(master=parent_frame).
uvis_model¶
This is the Uvis Model module.
- This module contains the following classes:
- UltraVisModel
The main class of this module, which provides methods to access the data / model of the uvis application.
- Examination
The model of the examination / Untersuchung. Contains information about the doctor, patient etc.
- Record
Represent a record / Aufzeichnung, of an examination. Contains the image and the reference to the positional data of an record.
-
class
uvis_model.Comparison(R_ID_base=None, R_ID_nav=None, vec_base=None, vec_nav=None, acc_t=None, acc_o=None, calc_errors=None, doc_eval=None, E_ID=None)¶ - Parameters
R_ID_base (str) – The key of the base
Record.R_ID_nav (str) – The key of the navigated / target
Record.vec_base (numpy.array) – The ultrasound probe position vector of the base
Record.vec_nav (numpy.array) – The ultrasound probe position vector of the navigated / target
Record.acc_t (float) – Translational accuracy in mm (95% confidence interval)
acc_o (float) – Orientation accuracy in degree (95% confidence interval)
calc_errors (list) – List of calculation errors pessimitic calculated.
doc_eval (str) – Evaluation of the doctor regarding the two images.
E_ID (str) – The foreign key of the
Examination.
The object holding the results from compairing two records.
-
set_values_from_records(tgt_rec: uvis_model.Record, nav_rec: uvis_model.Record)¶ Sets the values via Record objects. TODO
-
class
uvis_model.Evaluation¶
-
class
uvis_model.Examination(E_ID=None, doctor=None, patient=None, examitem=None, created=None)¶ - Parameters
E_ID (str) – The Examination ID
doctor (str) – The doctor performing the examination.
patient (str) – The patient name.
examitem (str) – The examination item (e.g. left lung …)
created (date.datetime) – The timestamp of the performed examination.
The data model of an examination. Can be instantiated as empty object. If no E_ID is given at the instantitation, it will generate a tempID with uuid4(): ‘tempE-5d51171a-eae6-4b93-b4dd-abadecda3976’.
-
class
uvis_model.Record(E_ID, R_ID=None, descr=None, date=None, US_img=None)¶ - Parameters
E_ID (str) – The foreign key of the
Examination.R_ID (str) – The key or ID of the
Record.descr (str) – The description of the record (e.g. which struture is to seen in the image).
date (date.datetime) – The timestamp of the performed examination.
US_img (str) – Path of the saved image in the filesystem (e.g dataimgimag_name).
The data model of an record. If no R_ID is given at the instantitation, it will generate a tempID with uuid4(): ‘tempR-5d51171a-eae6-4b93-b4dd-abadecda3976’.
-
class
uvis_model.UltraVisModel¶ The UltraVisModel class provides methods to access the data / model of the uvis application. It is primarily for reading and saving data from the csv tables. As for a more handy accessability, the model maintains the application data in a “workitem”. A dict, which consolidates the Examination, Records and Handles in one object. Via an observer pattern, the model triggers a callback to the corresponding methods in the controller (caller). During instatiation the pd.DataFrame object are loaded from the filesystem to provide the application with the data.
-
_callback(key)¶ - Parameters
key (str) – Key / functionname of Observed method in UltraVisModel.
Calls the observers methods, based on the methodkey of UltraVisModel method.
-
_dataset_to_csv()¶ Writes the dataframes to the csv files. Locking could be implemented
-
_get_max_calcerror(position: list)¶ Checks the calculation errors for 4 handles and return the highest calculation error.
-
_getnextID(df)¶ - Parameters
df (df.DataFrame) – The dataframe for which the next ID is necessary.
- Returns
Returns the next ID for persisting.
- Return type
int
Supporting method for getting the next real ID for persisting.
-
_init_baseline_dataset()¶ Loads the baseline datasets. Might cause errors when datasets are not in the filesystem. The datasets can be found in the MS Team folder. See further_readings in the code documentation
-
_init_calibrator(position)¶
-
_insert_comparison(df: pandas.core.frame.DataFrame)¶
-
_insert_evaluation(df: pandas.core.frame.DataFrame)¶
-
_ori_data(h_base, h_nav)¶ get all the orientations
-
calculate_baseline(records_df: pandas.core.frame.DataFrame = None)¶
-
clear_current_workitem()¶ Clears the _curr_workitem dictionary and reset its values to a clean state {“Examination”:None, “Records”:[], “Handles”:[]}.
-
clear_temp_data()¶ Revmoves all temporary from the whole data set. Temp data are items which start with ‘temp’ in their IDs.
-
compare_records(tgt_rec: uvis_model.Record, nav_rec: uvis_model.Record, E_ID=None, insert_data=True)¶ Compares two records and creates an Comparison object with calculated values
-
display_boxplot(input_arr, columns=None)¶ - Parameters
input_arr (list) – List of numpy.array containing the data for each plot column.
columns (list) – List of the column names.
Creates and displays a boxplot for the baseline evaluations.
-
evaluate_comparison_data(df: pandas.core.frame.DataFrame)¶
-
get_comparison(Eval_ID, as_df=True)¶
-
get_current_workitem()¶ - Returns
Return the current workitem.
- Return type
dict
-
get_examination(ID=None)¶ - Returns
Return an class:Examination Object from the csv. Else it returns
None.
-
get_img(filename, asPILimage=True)¶
-
get_length_workitem()¶ - Returns
Return the length or rather the num of items workitem.
- Return type
int
-
get_position(R_ID=None, as_dict=False, handle_df=None)¶ - Parameters
R_ID (str) – Record ID.
as_dict (bool) – Flag for getting the position as a dict or a list.
handle_df (pd.DataFrame) – DataFrame contained all recorded handle data (or sensor data).
- Returns
Return the position as list or dict with the 4
aurora.Handleobjects. Else it returnsNone.- Return type
dict, list, None
-
get_record(R_ID=None, E_ID=None)¶ - Parameters
R_ID (str) – The key of an
Recordobject. Used to get single record object.E_ID (str) – The key of an
Examinationobject. Used for all corresponding records to the examination.
- Returns
Either return single
Recordobject or list ofRecordobjects.- Return type
Record, list, None
Returns an Record object or Record object list from the csv. Get corresponding Records via the E_ID or a specific instance via R_ID. If it can’t find an object the method returns
None.
-
list_string_to_list(string, dtype)¶ Suboptimale Methode. Had to do this workaround for the csv. Takes a String which is formatted as a list and actually converts it to a list.
-
load_workitem(E_ID)¶ - Parameters
E_ID (str) – The ID of an
Examination
Loads the workitem based on the examination id (E_ID). The workitem can be accessed via
get_current_workitem().
-
persist_workitem()¶ Persists Workitem. For each item (an Examination, Record or Handle) of the workitem, the method gets the next ID in the table via _getnextID and tries to save the changes in the local dataframe (self.t_examination e.g.). If everything works, it persists the changes in the csv files.
At success the method return the new E_ID as a string.
-
pos_to_transformed_data(position, orientation_type='quaternion')¶ - Parameters
position (list) – A list with the 4
aurora.Handleobjects.- Returns
Return 2 lists with the transformed translative and transformed orientation data.
- Return type
list, list
Takes a record or rather the position and return the transformed data of the Ultrasound probe.
-
register(key, observer)¶ - Parameters
key (str) – Function name of the observed function in the model.
observer (function) – Observer method or function to be called back.
Implementation of observer pattern. Observers can register methods for a callback. The key should be the UltraVisModel methodname. When the method in the model is executed the
_callback()is triggered.
-
rename_images(rec_df: pandas.core.frame.DataFrame = None, PATH=None)¶ Renames the image files, with temporary filenames.
-
save_PIL_image(img, img_name, filetype='.png')¶ Saves an PIL Image to the _cfg defined DATAPATH. Returns path of the saved image as a string.
-
save_examination(examination, persistant=False)¶ - Parameters
examination (Examination) – Examination object for saving
persistant (bool) – Flag whether save Examination temporarily or persisant. Defaults to
False
- Raises
TypeError – Will be raised examination param is not of
uvis_model.Examination.
Saves a (temporary) instance of an Examination Object to the csv.
-
save_position(R_ID, handles)¶ - Parameters
R_ID (str) – Record ID.
handles (dict) – Dictionary containing the 4
aurora.Handleobjects.
- Raises
ValueError – Will be raised if the saving procedure failed.
Saves the 4
aurora.Handleobjects to the database / csv.
-
save_record(record, persistant=False)¶ - Parameters
record (Record) – Record object for saving
persistant (bool) – Flag whether save record temporarily or persisant. Defaults to
False
- Raises
TypeError – Will be raised examination param is not of
uvis_model.Record.
Saves a (temporary) instance of an Examination Object to the csv.
-
set_current_workitem(obj, as_instance=True)¶ - Parameters
obj (Examination, Record, Handle, tuple) – Object or tuple to be set for the workitem.
as_instance (bool) – If True use single object. If False then use tuple with the objects.
- Raises
TypeError – Will be raised object is not of
uvis_model.Examination,uvis_model.Record,aurora.Handleor tuple containing the object types..
Set the current workitem for the UvisModel. You can either append single instances of an Examination Object, Record Object or a Position (a list object with 4 Handle Objects) to the workitem. Alternatively you can set a whole workitem, as a tuple (Examination, [Record,…], [Handle,…]).
-
Calibrator¶
-
class
Calibrator.Calibrator¶ builds transformation matrices
-
__dist_ab(a, b)¶ distance between point a and b
-
__rpy_from_matrix(m)¶ calculate roll pitch yaw from 3x3 rotation matrix
-
get_target_rotation_split(w, x, y, z)¶ returns transformed target orientation in adjusted roll, pitch, yaw
-
get_transformed_rotation(Q0, Qx, Qy, Qz)¶ used for model class
-
quaternion_to_rotation_matrix(Q0, Qx, Qy, Qz)¶ quat to rotation matrix from NDI API documentation
-
rotate_backward(orientation_matrix)¶ calibrate orientation for current frame
-
set_target_rotation_matrix(m)¶ target orientation (read from file?)
-
set_trafo_matrix(a, b, c, log_matrix=False)¶ set transformation matrix and inverse transformation matrix from calibration sensors a: Becken rechts (pelvis, right) b: Becken links (pelvis, left) c: Brustbein (sternum, caudal)
-
transform_backward(vector, do_scale=True)¶ transform vector using inverse matrix
-
config¶
-
class
config.Configuration(*args, **kwargs)¶ The
Configurationobject contains all the configuration for the Uvis Application. one could research alternatives for configs.Attributes
-
DEBUG¶ bool - Sets the debug mode flag for the Uvis App.
-
DATAPATH¶ str - Sets the path of the data directory.
-
SAVEDIMGPATH¶ str - Sets the path where the ultrasound images are saved.
-
IMGPATH¶ str - Sets the path of the image directory. These images are used for the application itself.
-
COM¶ str - Sets the COM Port for the
Serialconnection of the application (e.g. ‘COM8’).
-
VID_INPUT¶ int - Index for choosing the video source. See
cv2.VideoCapturefor more details.
-
LOGGER¶ logging.Logger - The general logger of the uvis application.
-
Q_LOGGER¶ logging.Logger- The logger for the queue thread.
-
helper¶
Uvis helper Module
The helper module contains methods, which helps with easier GUI Handling.
- Available Classes
Helper Class Scrollable Frame Class
-
class
helper.Helper¶ The helper class easier GUI Handling in uvis_controller and uvis_view
-
disable_widgets(childList, disable_all=False)¶ Disables all widgets in the list if disable_all is False. Else only button and entry.
-
enable_widgets(childList, enable_all=False)¶ Enables all widgets in the list if enable_all is True. Else only button and entry.
-
get_next_row()¶
-
get_readonly_widget(master, value, max_length, max_height=None)¶ - Parameters
master (tkinter.Frame) – Master frame.
value (str) – Sets the text for the widget.
max_length (int) – If the input value length len(value) > max_length, the method will return a tk.Text Widget. Else it will return an Entry widget.
max_height (int) – The maximum height of the Text widget.
- Returns
Returns either a
tk.Entryor atk.Textwidget with an readonly state.- Return type
tkinter.Entry or tkinter.Text.
-
get_tk_image(filename)¶
-
pack_children(childList, side, fill, padx, pady)¶
-
q_average(Q, W=None)¶ - Parameters
Q (np.array) – N-by-4 matrix of unit quaternions.
W (np.array) – Matrix of weights.
Calculates the average quaternions. Q is therefore a N-by-4 matrix. Quaternion should be normalized / be unit quaternions.
-
set_row(num)¶
-
to_float(number_list)¶ Converts each item of a list to float and returns the list
-
-
class
helper.ScrollableFrame(master, *args, **kwargs)¶ This Class instantiates an outer base_frame. Inside that frame, it utilizes tk.Canvas and tk.Scrollbar to create a acrollable frame. Use the ‘contentframe’ attribute to put widgets into it. The ‘contentframe’ doesn’t need to be packed, gridded or placed. The SrollableFrame is sufficient.
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.