Grid creation issue in micro-manager

Hi @nanthony21,
I was premature with my last reply. It seems I’m still having issues with the grid function. Attached are the 9 images relating to a grid I created using 20% overlap. When I look at the grid positions, they seem all as expected, with 3 overlapping columns in a row and 3 such rows. But when I look at the images from one row, they are 20% overlapping not only on vertical but also on horizontal, i.e. they are sort of diagonal. I attach the 9 images for the first step of my time-lapse, as well as my position list. The images are for “pos5”. I renamed the files and scaled them by 50% so to be able to send over.

best
orkun
ch1_grid.zip (964.2 KB) PositionList_20210203.txt (57.0 KB)

Hi Orkun,

That’s disappointing to hear that it still isn’t working as expected. I tried looking at your images but couldn’t really figure out what I was looking at. I’m not sure I actually understand what is going wrong.

Would it be possible for you to take some images of a resolution target or some other easily interpretable sample to illustrate what you are describing here:

I’m not really sure what you mean by “diagonal” in this context. To me it seems correct that the images should have overlap in both the vertical and horizontal directions.

Hi @nanthony21,
Thanks for your reply!

Yes, I can take more images, but let me first explain this set. Sorry, it is more cryptic than it really is.

If you focus on images labelled “Ch1_r001_c000_t000-1”, “Ch1_r001_c001_t000-1”, “Ch1_r001_c002_t000-1”, these are images from the same row.

They are of filamentous bacteria. You can see some of the overlapping filaments. For example ‘c002’ and ‘c001’ has an overlapping filament that looks like an outline of a heart. Images ‘c001’ and ‘000’ have a distinctive, small circle-shaped filament that overlap. If you use these features as anchor points, you can overlap those three images. As you will see, they seem to overlap about 20% on vertical and 20% on horizontal.

As you say, this might have been the expected behaviour of the grid creation algorithm. Is it?

Regardless of the answer, the issue is that the position list does not fit this behaviour. The naming correspondence between the image names I listed above and the position list I sent you are as follows:
“Ch1_r001_c002_t000-1” corresponds to “5-Pos001_002”
“Ch1_r001_c001_t000-1” corresponds to “5-Pos001_001”
“Ch1_r001_c000_t000-1” corresponds to “5-Pos001_000”

As you will see from the position list file, the coordinates for those positions are:
“5-Pos001_000”: 8069.6,-45988.30
“5-Pos001_001”: 8069.6,-43794.89
“5-Pos001_002”: 8069.6,-41601.5

According to this list, there is suppose to be only overlap on one axis, i.e. the images should be on the same line in one axis…but they are not.

I will certainly run some more tests when I’m next in the lab and let you know the outcome.

best
orkun

Hi Orkun,

One thing that would be worth checking is how well your camera is aligned with your translation stage.

If you run the pixel calibrator what do you get as a result for the 2x2 affine transformation matrix?

To run the pixel calibration go to: “Devices → pixel size calibration… → New → Measure”

–Nick

Hi @nanthony21 ,
This is the result I get:
xScale: 1.4714
yScale: 1.4653
rotation: -85.97
Shear: -0.0003
pixel size: 1.4683

I tried creating a grid again after doing the calibration. I tried both using the ‘centre here’ approach and defining corners. In both cases, I still get the same behaviour described in my previous message. I.e. positions in a given row are listed as having the same x-axis coordinate on the .pos file, but when I look at them, they are overlapped 20% on both x- and y- coordinates…i.e. images from one row are not on the same x-line.

Please let me know if you have any suggestions.

It might be that everything is working fine and the grid creator is suppose to be behaving in this way. If so, then I would be interested in your thoughts on how to best stitch these images. Using grid/image collection plugin is not really working well when images are not on the same row.

best
orkun

Any chance that you can rotate your camera by ~90 degrees? Then you can switch off the transposecorrection property, and will end up in more normal “territory”.

I still can not fully think it through in my head, but I suspect that you hit a use case that is not handled nicely in the current code (rectangular camera and 90 degree rotation). We could try to fix that, but it is probably better to focus efforts on using the full affine transform (which in your case shows an 85 degree rotation) to create the grid. That approach works well in the Slide Explorer and Magellan plugins, so also should work here.

Hi Both,
Thanks for the continued help on this. Much appreciated.

I realised that the “TransposeXY” setting was not saved as ‘on’. It seems that this was the main issue. I have now grids created with either “TransposeXY=1” and camera in its original orientation, or with “TransposeXY=0” and camera in a 90deg position (compared to original). Is this to do with the xScale value being off? I presume we want both xScale and yScale to be as close as possible to pixel size? If so, how can I improve this?

best
orkun

In both cases, the overlap is primarily in one axis, as expected. I still get a misalignment though, especially on x-axis (i.e. row-wise).

Hi Orkun,

I see what the issue is. The grid creator does not currently support situations where the camera and stage aren’t lined up at a multiple of 90°.

You’ll need to adjust your camera so that it is at 0, 90, 180, or 270 degrees from your xy stage. You can then use the transposexy, mirrorx, etc. properties to get it working.

Someday it would be nice to add support for the full pixel calibration to the grid creator. I don’t see this happening in the near future though.

–Nick

I managed to get the following values;
xScale: 1.4681
yScale: 1.4766
rotation: -0.03
shear: -0.0006

It seems to be working much better now. I’m not using transposeXY and fixed the camera at the ~90 angle.

Thanks for all your help!