Set tile region name

Post your acquisition-related questions and macros here
Post Reply
Sam van Beuningen
Posts: 1
Joined: Wed Oct 19, 2022 1:49 pm

Set tile region name

Post by Sam van Beuningen »

Hi all,

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')
This works great expect for one thing: the tile region name. In the AddRectangleTileRegion function there is no field for name, so an automatic name is created by ZEN (TLR1, TLR2 etc). Since the original name (well name) is very important for our set-up I am looking for a solution to this problem.

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
julie diane
Posts: 24
Joined: Wed Jun 28, 2023 1:25 am

Re: Set tile region name

Post by julie diane »

Hello,

It's great to hear about the progress you're making with your imaging plate setup. Your description of the initialization process, macro development, and integration with the robotic platform is quite thorough.

Regarding your question about retaining specific tile region names, it seems you're facing a challenge with the AddRectangleTileRegion function automatically generating names of bad posture effects. While there might not be a direct parameter for setting the name in this function, there's usually a workaround in such scenarios.

One approach could be to rename the tile regions immediately after adding them to the experiment. You could include a line of code that sets the name for each tile region based on the original well name that you've stored in your JSON data. Here's a hypothetical modification to your code that could achieve this:

python
Copy code
for i in tiles['TileRegion']:
NAME = i['@Name']
# ... other code ...
if SHAPE == 'Rectangle':
region = Zen.Acquisition.Experiments.ActiveExperiment.AddRectangleTileRegion(block, X, Y, W, H, Z)
elif SHAPE == 'Ellipse':
region = Zen.Acquisition.Experiments.ActiveExperiment.AddEllipseTileRegion(block, X, Y, W, H, Z)
else:
print('Unsupported Shape')

# Set the desired name for the added tile region
region.Name = NAME
By using the region.Name = NAME line, you should be able to assign the desired well name to each added tile region, ensuring that your setup maintains the original nomenclature you need.

I hope this solution aligns with your requirements. Remember to test and adjust it as needed to ensure compatibility with your specific environment and version of the software. Best of luck with your project, and I'm here to help if you have further questions!
Post Reply