def mitral_measurement_capture(): firstIndexMeasurements = "{container=':mMprCaptureFrame_MprCaptureListWidget' type='QModelIndex'}" bottomFrame = ":mMprFrame.mCoronalMprFrame_TriPlaneMprFrame" lineContourEmbedFrame = ":contourHandle.ToolButton-contourAction-lineRoiContour_QToolButton" tagMVTOLAA = ":mGroupFrame.MV to LAA_QModelIndex" x, y = squish.waitForObject(bottomFrame).height, squish.waitForObject( bottomFrame).width squish.mouseMove(squish.waitForObject(bottomFrame), 10, x - 20) squish.clickButton(squish.waitForObject(lineContourEmbedFrame)) squish.mousePress(bottomFrame, randint(0 + 50, x - 70), randint(0 + 50, y - 70), squish.Qt.LeftButton) # squish.snooze(0.5) squish.mouseRelease(bottomFrame, randint(0 + 50, x - 70), randint(0 + 50, y - 70), squish.Qt.LeftButton) # squish.snooze(0.5) # Drag and drop LVOT tag on first measurement capture image squish.mousePress(squish.waitForObject(tagMVTOLAA)) # squish.snooze(1) squish.mouseMove(squish.waitForObject(firstIndexMeasurements), 5, 5) squish.mouseRelease(squish.waitForObject(firstIndexMeasurements)) return
def load_series(window_given, series_num): series = ":scrollArea.frame-%s_SeriesThumbPreview" % (series_num - 1) window, x, y = find_window(window_given) # if series needed is bigger than 8, check if scrolling is needed to reach the series if object.exists(cvi42Objects.series_scrollbar): squish.scrollTo(squish.waitForObject(cvi42Objects.series_scrollbar), -505) if series_num > 8: squish.scrollTo( squish.waitForObject(cvi42Objects.series_scrollbar), 855) # Load series into window requested squish.mouseMove(squish.waitForObject(series), 5, 5) squish.mousePress(squish.waitForObject(series)) # squish.snooze(1) squish.mouseRelease(squish.waitForObject(window)) squish.snooze(0.2) if object.exists(":Load Volume.Yes_QPushButton"): squish.clickButton( squish.waitForObject(":Load Volume.Yes_QPushButton")) # Wait for progress bar time = loading_time() if time > 10: test.log("Time to load series: %.2f" % time) return
def segment_forward(): segmentContour = ":mContourOptions.ToolButton-segAction_QToolButton" forwardContour = ":mContourOptions.ToolButton-segForwardAction_QToolButton" squish.mousePress(squish.waitForObject(segmentContour)) # squish.snooze(1) squish.mouseRelease(squish.waitForObject(segmentContour)) squish.clickButton(squish.waitForObject(forwardContour)) return
def aortic_measurement_capture(): firstIndexMeasurements = "{container=':mMprCaptureFrame_MprCaptureListWidget' type='QModelIndex'}" tagLVOT = ":mGroupFrame.LVOT_QModelIndex" # Drag and drop LVOT tag on first measurement capture image squish.mousePress(squish.waitForObject(tagLVOT)) # squish.snooze(1) squish.mouseMove(squish.waitForObject(firstIndexMeasurements), 5, 5) squish.mouseRelease(squish.waitForObject(firstIndexMeasurements)) return
def lineContour(window_name, num=3): lineContourButton = ":mContourTools.ToolButton-contourAction-lineRoiContour_QToolButton" # Grabs Qt equivalent of given window name window, x, y = studyFunctions.find_window(window_name) # Finds and clicks on the line contour button in the toolbar squish.clickButton(squish.waitForObject(lineContourButton)) counter = 0 while counter < num: # Mouse press and release inside the frame of the selected window squish.mousePress(window, randint(0 + 50, x - 70), randint(0 + 50, y - 70), squish.Qt.LeftButton) squish.mouseRelease(window, randint(0 + 50, x - 70), randint(0 + 50, y - 70), squish.Qt.LeftButton) counter += 1 return
def freehandContour(window_name): freehandContour = ":mContourTools.ToolButton-contourAction-freeDrawRoiContour_QToolButton" # Grabs Qt equivalent of given window name window, x, y = studyFunctions.find_window(window_name) # Finds and clicks on the Contour measurement button squish.clickButton(squish.waitForObject(freehandContour)) # Starts drawing freehand contour by pressing the left mouse button squish.mousePress(squish.waitForObject(window), randint(0 + 50, x - 70), randint(0 + 50, y - 70), squish.Qt.LeftButton) for i in range(3): squish.mouseMove(squish.waitForObject(window), randint(0 + 50, x - 70), randint(0 + 50, y - 70)) squish.mouseRelease(squish.waitForObject(window), randint(0 + 50, x - 70), randint(0 + 50, y - 70), squish.Qt.LeftButton) return
def flowContour(window_name, contour=1): flowContour = ":mContourTools.ToolButton-contourAction-flow1Contour_QToolButton" new_contour = ":mContourTools.ToolButton-contourAction-flow%sContour_QToolButton" % contour # Grabs Qt equivalent of given window name window, x, y = studyFunctions.find_window(window_name) # Finds and clicks on the Contour measurement button squish.clickButton(squish.waitForObject(new_contour)) # Draw a handcoded contour for now squish.mousePress(squish.waitForObject(window), ((x / 2) + 20), ((y / 2) + 20), squish.Qt.LeftButton) squish.mouseMove(squish.waitForObject(window), ((x / 2) + 20), ((y / 2) - 20)) squish.mouseMove(squish.waitForObject(window), ((x / 2) - 30), ((y / 2) - 20)) squish.mouseRelease(squish.waitForObject(window), ((x / 2) - 30), ((y / 2) - 20), squish.Qt.LeftButton) return