def main(): attachToApplication("MyApplicationAttachable") login.login("moe", "moonshine") list = [ "4D\n Flow", "4D\n Viewer", "Biplanar\n LAX", "Flow", "Patient\n Data", "Report", "MPR", "Multiple\n Long LAX", "Perfusion", "T1", "T2", "Tissue\n Char", "Tissue\n Tracking", "Vascular", "Viewer", "Series\n Overview" ] # loadStudy.load("Functions1") studyFunctions.reset_workspace() i = 0 for x in range(50000): module = random.choice(list) start = time.time() studyFunctions.click_module(module) end = time.time() if i == 0: module = module.replace('\n', ' ') if end - start > 1.0: test.log("%s module load time = %.2f" % (module, end - start)) oldModule = module else: oldModule = oldModule.replace('\n', ' ') module = module.replace('\n', ' ') if end - start > 1.0: test.log("From %s -> %s = %.2f " % (oldModule, module, end - start)) oldModule = module i += 1 # for child in object.children(waitForObject(":Primary Study.blackBackground_QWidget")): # for kid in child: # test.log("%s"%kid) # clickButton(waitForObject(":Primary Study.seriesPreview_SeriesPreview") # :Primary Study.seriesPreview_SeriesPreview_2 # status = ":cmr42MainWindow.cmr42StatusBar_QStatusBar" # if object.exists(status) is True: # test.log("yes") # else: # activateItem(waitForObjectItem(":cmr42MainWindow.appMenuBar_QMenuBar", "View")) # activateItem(waitForObjectItem(":cmr42MainWindow.viewMenu_QMenu", "Hide Status Bar")) # user = "******" # server = ":cmr42MainWindow.connectionStatusLabel_QLabel" # for name, value in object.properties(waitForObject(user)).iteritems(): # if name == "text": # test.log("Users = %s"%value) # break # for name, value in object.properties(waitForObject(server)).iteritems(): # if name == "text": # test.log("Users = %s"%value) # break
def ml_full_workflow(dialog, app, pid, study, button, series): studyFunctions.click_module(dialog, "Short\n 3D", pid) studyFunctions.load_series(dialog, study, "SAX3D Stack", series) ml_time = click_ml(dialog, button, app) return ml_time
def viewer_module_full_workflow(dialog, pid, study, window, series): studyFunctions.click_module(dialog, "Viewer", pid) load_series(dialog, study, window, series) drawContour.freehand_counter(dialog, window) drawContour.line_contour(dialog, window, 3) drawContour.curved_measurement_contour(dialog, window, 3) return
def check_report42_status(dialog, pid, filename, flag): start = time.time() studyFunctions.click_module(dialog, "Report", pid) dialog.child_window(title="Cardiac Imaging Reporting - Report", control_type="Document").wait('visible', timeout=100) dialog.child_window(title="Save in progress", control_type="Image").exists() dialog.child_window(title="Save in progress", control_type="Image").wait_not('visible', timeout=1000) end = time.time() print "%.2f" % float(end - start) outputFile.print_timing(flag, end - start, filename) return end - start
def the_test(): # # Makes sure cvi42 is not running # studyFunctions.close_cvi42()attachToApplication("MyApplicationAttachable") startApplication("cvi42") # Login login.login("moeadmin", "absinthe") # Anonymize and load Function-Flow-Perfusion study_mr = studyFunctions.anonymize_study("Function-Flow-Perfusion", "Automation-FuncFlow") loadStudy.load(study_mr) # Short3D entire stack ML studyFunctions.click_module("Short\n 3D") studyFunctions.load_series("short3d", 1) short3d.click_ml("Detect LV Endo/Epi Contours Entire Stack") # BiplanarLAX entire stack ML studyFunctions.click_module("Biplanar\n LAX") studyFunctions.load_series("2cv", 2) studyFunctions.load_series("4cv", 3) biplanarLAX.ml_button() # Close MR study studyFunctions.close_study() # Anonymize and load Annulus-016 study_ct = studyFunctions.anonymize_study( "Annulus-016 (Anonymize This for Load Tests)", "Automation-Annulus") loadStudy.load(study_ct, True) # Click and load ct study in 4D viewer studyFunctions.click_module("4D\n Viewer", True) studyFunctions.load_series("4d", 1) studyFunctions.close_study() # Anonymize and load 4d flow study study_4d = studyFunctions.anonymize_study("4D\\_066", "Automation-4DFlow") loadStudy.load(study_4d) studyFunctions.click_module("4D\n Flow") studyFunctions.load_series("4d flow", 1) if object.exists(cvi42Objects.confirmAreaButton): mouseClick(waitForObject(cvi42Objects.confirmAreaButton)) flow4D = studyFunctions.loading_time() test.log("4D Flow loading %s" % flow4D) studyFunctions.close_study() # Delete anon studies studyFunctions.delete_study(study_mr) studyFunctions.delete_study(study_ct) studyFunctions.delete_study(study_4d)
def check_report42(): reportTab = ":tabBar.Report_TabItem" greenStatusbar = ":webEngView.Save in progress_HTML_Object" reportLoading = "{container=':mCentralStack.stackWidget_QStackedWidget' name='webEndView' " "type='QWebEngineView' visible='1'}id='loader' tagName='DIV' type='HTML_Object' visible='true'}" feedbackMessage = ":webEngView.study-update-feeback_HTML_Object" counter = 0 start = time.time() # Select the Report module to check progress, wait one second to allow the system to catch up studyFunctions.click_module("Report") # squish.snooze(1) # Wait for the green progress bar to disappear while True: if object.exists(feedbackMessage): if object.exists(greenStatusbar) is True: pass else: if object.exists(greenStatusbar) is True or object.exists( reportLoading) is True: pass counter = 0 # If dialog doesn't exist for three consecutive iterations, break and time. else: counter += 1 if counter > 2: break else: pass counter += 1 if counter > 100: test.log("Can't check report42") squish.mouseClick(squish.waitForObject(reportTab)) return end = time.time() test.log("Added to report42 %.2f" % (end - start)) # squish.snooze(1) return
def flow_full_workflow(dialog, pid, study_name, flow_type, series): studyFunctions.click_module(dialog, "Flow", pid) if flow_type == "s": systemic_flow_select(dialog) elif flow_type == "p": pulmonary_flow_select(dialog) else: print "Wrong flow_type input" return studyFunctions.load_series(dialog, study_name, "Magnitude", series) flow_roi_1(dialog, "Magnitude") return
def run(dialog, app, pid, filename): # Step 3 - Anonymize Function-Flow-Perfusion functionFlow = studyFunctions.test1001_anonymize_study( dialog, "Function-Flow-Perfusion", "AutomationTest2-FuncFlow", filename) # Step 4 - Load Function-Flow-Perfusion loadTest.test1002_load(dialog, functionFlow, filename) # Step 5 - Draw 5 contours in viewer module viewerModule.viewer_module_full_workflow(dialog, pid, functionFlow, "Viewer1", 1) report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1003) # Step 6 - add to report from capture measurements studyFunctions.click_module(dialog, "Viewer", pid) viewerModule.add_measurement_capture(dialog) report42.check_report42_status(dialog, pid, filename, 1004) # Step 7 - Repeat step 5 for a different series viewerModule.viewer_module_full_workflow(dialog, pid, functionFlow, "Viewer2", 3) report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1005) # Step 8 - Load series 5 into systemic flow and draw/forward an ROI flowModule.flow_full_workflow(dialog, pid, functionFlow, "s", 5) report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1006) # Step 9 - Load series 6 into pulmonary flow and draw/forward an ROI flowModule.flow_full_workflow(dialog, pid, functionFlow, "p", 6) report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1007) # Step 10 - Go to comparison tab and add to report studyFunctions.click_module(dialog, "Flow", pid) flowModule.comparison_tab_select(dialog) report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1008) # Step 11 - Short 3D Module ML Phase series 1 time_short3d_ml = short3d.ml_full_workflow( dialog, app, pid, functionFlow, "Detect LV Endo/Epi Contours Current Phase", 1) outputFile.print_timing(1009, time_short3d_ml, filename) # Step 12 - add ML Short3d to report report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1010) # Step 14 - reset the workspace studyFunctions.reset_workspace(dialog) # Step 16 - Biplanar LAX assessment time_biplanar_ml = biplanarLAX.full_workflow( dialog, app, pid, functionFlow, "Detect LA/RA Contours Current Slice", 2, 3) outputFile.print_timing(1011, time_biplanar_ml, filename) report42.add_to_report(dialog) report42.check_report42_status(dialog, pid, filename, 1012) studyFunctions.close_study(dialog) # studyFunctions.delete_anon_study(dialog, annulus16) studyFunctions.delete_anon_study(dialog, functionFlow) return
def main(): total_start = time.time() attachToApplication("MyApplicationAttachable") # Login login.login("moeadmin", "everclear") # Anonymize study anon_study = studyFunctions.anonymize_study("ConcurrencyTest\\_Tester2", "Concurrency-Test1") # Load study loadStudy.load(anon_study) snooze(20) # Draw and send viewer module studyFunctions.click_module("Viewer") studyFunctions.load_series("viewer1", 1) drawContours.lineContour("viewer1", 5) # report42.add_to_report() snooze(10) # Send capture studyFunctions.click_module("Viewer") # Edit check report42 # report42.measurement_capture() snooze(10) # Draw and send systemic flow studyFunctions.click_module("Flow") flowAnalysisModule.select_systemic() studyFunctions.load_series("flow1", 16) drawContours.flowContour("flow1", 1) flowAnalysisModule.segment_forward() # report42.add_to_report() snooze(10) # Draw and send pulmonary flow studyFunctions.click_module("Flow") flowAnalysisModule.select_pulmonary() studyFunctions.load_series("flow1", 17) drawContours.flowContour("flow1", 2) flowAnalysisModule.segment_forward() # report42.add_to_report() snooze(10) # Select and send comparison flow studyFunctions.click_module("Flow") flowAnalysisModule.select_comparison() # report42.add_to_report() snooze(10) # export study studyFunctions.close_study() studyFunctions.export_study(anon_study) studyFunctions.delete_study(anon_study) total_end = time.time() test.log("Total time: %.2f" % (total_end - total_start))
def confirm_report_tab_viewed(dialog, pid): studyFunctions.click_module(dialog, "Report", pid) dialog.child_window(title="Report", control_type="TabItem").click_input() return