def RegionScanTest(x_size, y_size):

    rs = MicroscopeModules.RegionScan()
    
    try:
        print "Running RegionScanTest"
        rs.SetRelativeRoi(x_size, y_size)
        rs.Start(action, "C:", "", "")
        
    except Exception, e:
        print e
        print "hello"
        print "Could not run regionscan", e
        
# Name: Region Multicube
# Description: Aquire regions with all cubes, uses UI cube options for exposure and Z offset
# Author: Fluorescence Acq
# Category: Regions

import microscope, MicroscopeModules, os, time

# Specify the whether the region scan saves images, SAVE_DISPLAY, or just displays them, DISPLAY_ONLY
action = MicroscopeModules.RegionScan.SAVE_DISPLAY

aborted = False
rs = MicroscopeModules.RegionScan()
cube_data = {}


# OnStart is called once when the user presses start to begin the timelapse.
def OnStart():
    print "Start: Region Multicube"
    global output, cube_data

    data_dir = microscope.GetUserDataDirectory()
    output = microscope.ShowSimpleFileSequenceSaveDialog(
        data_dir
    )  # This is really geared to regions and does not have the %. options

    if output != None:
        print "Saving to directory ", output[0]
        print "Filename Format ", output[1]
    else:
        print "Aborting Timelapse"
        microscope.AbortTimeLapseVisitPoints()
# Move Perform spc and Save

import MicroscopeModules, microscope, time

output = ()
spc = MicroscopeModules.Spc()

# OnStart is called once when the user presses start to begin the timelapse.
def OnStart():

    global output
    
    print "Stage Position, ", microscope.GetStagePosition()
    print microscope.GetTimeLapsePoints()
    
    data_dir = microscope.GetUserDataDirectory()
    output = microscope.ShowFileSequenceSaveDialog(data_dir)
        
    print "Saving to directory ", output[0]
    print "Filename Format ", output[1]
    
def OnAbort():
    print "OnAbort()"
    
        
# Called once at the start of each cycle of points. Should contain at least one call to  microscope.MicroscopeVisitPoints() to start the cycle.
def OnCycleStart():
    print "Back to start."
    microscope.VisitPoints()
 
# Called each time the stage moves to a new point.