I am developing a set-up where I first run a imaging plate in an "initialization experiment". During this initialization I run auto-focus on all positions and update all the positions. All tile regions were pre-selected and the names correspond to the well name (A1 A2 etc).
After this experiment I run a macro that saves the regions as a json file. When finished the plate is returned into our robotic platform which is now able to add compounds etc.
After compound addition I want to immediately image the plate in a experiment with different settings, however with the same tile regions and z-positions I just exported. For this I developed the following macro:
Code: Select all
import json
#Set default experiment block
block = 0
#Clear current positions
Zen.Acquisition.Experiments.ActiveExperiment.ClearTileRegionsAndPositions(block)
#Load JSON and create shapes
#tiles = json.load('D:\init\latest-tiles.json')
with open('D:\init\latest-tiles.json') as json_file:
tiles = json.load(json_file)
for i in tiles['TileRegion']:
NAME = i['@Name']
XY = i['CenterPosition'].split(',')
X = float(XY[0])
Y = float(XY[1])
WH = i['ContourSize'].split(',')
W = float(WH[0])
H = float(WH[1])
Z = float(i['Z'])
SHAPE = i['Contour']['@Type']
if SHAPE == 'Rectangle':
Zen.Acquisition.Experiments.ActiveExperiment.AddRectangleTileRegion(block, X, Y, W, H, Z)
elif SHAPE == 'Ellipse':
Zen.Acquisition.Experiments.ActiveExperiment.AddEllipseTileRegion(block, X, Y, W, H, Z)
else:
print('Unsupported Shape')
Is there anyway to add a Tileregion with a specific name to the experiment?
I am looking forward to your response.
All the best,
Sam