In [1]:
from leicaautomator.automator import find_spots
from leicaautomator.utils import save_regions, flatten
from leicaexperiment import Experiment
from leicascanningtemplate import ScanningTemplate
from leicacam import CAM
In [7]:
cam = CAM()
cam.welcome_msg
Out[7]:
In [5]:
tmpl_path = r"C:\Users\TCS-User\AppData\Roaming\Leica Microsystems\LAS X\MatrixScreener\ScanningTemplates\ ".strip()
tmpl_path
Out[5]:
In [42]:
tmpl_name = '{ScanningTemplate}leicaautomator-overview.xml'
tmpl = ScanningTemplate(tmpl_path + tmpl_name)
In [43]:
tmpl.properties.attrib
Out[43]:
In [44]:
tmpl.properties.CountOfScanFieldsX = 20
tmpl.properties.CountOfScanFieldsY = 12
In [45]:
tmpl.add_well(1, 2, 55225e-6, 29525e-6)
In [46]:
tmpl.remove_well(1,1)
In [58]:
tmpl.well_array.ScanWellData.attrib['WellY'] = '1'
for f in tmpl.fields:
f.attrib['WellY'] = '1'
In [60]:
tmpl.write()
In [67]:
cam.load_template('{ScanningTemplate}leicaautomator0') # fake load
Out[67]:
In [68]:
cam.load_template(tmpl.filename)
Out[68]:
In [8]:
cam.start_scan()
Out[8]:
In [37]:
from time import sleep
scanfinished = False
while not scanfinished:
msg = cam.receive()
for cmd in msg:
try:
if cmd['inf'] == 'scanfinished':
scanfinished = True
break
except KeyError:
continue
sleep(10e-3)
NOTE
In [38]:
exp_path = r"D:\MatrixScreenerImages\3.3.0_9757\ ".strip()
exp_path
Out[38]:
In [39]:
whole = 'experiment--2015_03_21_15_02_11'
experiment = Experiment(exp_path + whole)
!dir $experiment.path
In [40]:
compressed = experiment.compress(delete_tif=True)
In [41]:
len(experiment.images), len(compressed)
Out[41]:
In [42]:
from PIL import Image
for img in experiment.images:
i = Image.open(img)
i = i.rotate(270)
i.save(img)
In [43]:
stitched = experiment.stitch()[0]
from IPython import display
display.Image(stitched)
Out[43]: