Rail alignment

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

Andy Davies
Posts: 138
Joined: Tue Dec 09, 2014 3:25 pm

Rail alignment

Post by Andy Davies »

I wish to align my rail as best I can. I was wondering whether Zerene could be used to calculate the offset misalignment by taking an image and then moving the camera and taking another image.

rjlittlefield
Site Admin
Posts: 21823
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Yes, this can be done.

Use a planar target that has an easily matched random texture all over the frame. Stop down as far as you can, to get maximum DOF even at the expense of diffraction blur. Shoot two frames equally far in front and behind perfect focus, so that the images are as similar as possible except for centering and scale.

Load just those two images into Zerene Stacker and do a Stack > Align All Frames. Then do an Options > View Console Log, and look near the bottom for a line that looks something like this:

Code: Select all

Aligning, finalFit = RegistrationParameters: xoffset = -4.967322586108755E-4, yoffset = -0.002133304529604224, scale = 1.0073800407525497, rotate = 0.0
In this line, the xoffset and yoffset are expressed as fractions of frame dimension.

To calculate the misalignment angles, multiply those fractions by the frame width and height to get shift in millimeters, then divide by distance that you moved the camera and take the arctan of that.

--Rik

ChrisR
Site Admin
Posts: 8616
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

I've been thinking a little about this. If you look down on a horizontal rig, the rail can be twisted left or right, and so can the camera. They both need to be at rotation zero, they won't cancel out.
Your centre of frame might apparently move to the right when the camera goes forwards, but one or other of the rail and camera axes could be twisted to the left.

Without being able to accurately measure the very small rotations, I think you're left with an iterative process with a lot of sketching and measuring!

Then you have to do the orthogonal axis.

[edit "to" → "do"]
Last edited by ChrisR on Tue Aug 20, 2019 2:59 am, edited 1 time in total.
Chris R

rjlittlefield
Site Admin
Posts: 21823
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

ChrisR wrote:If you look down on a horizontal rig, the rail can be twisted left or right, and so can the camera. They both need to be at rotation zero, they won't cancel out.
I'm a bit confused by this description.

It sounds like you're thinking of the rail being mounted on some second translation slide, like maybe an Arca-Swiss bar. I grant that it's possible for the rail to be rotated with respect to that second slide, but I don't see why it would matter as long as you shoot stacks using only movements of the rail carriage. Then what matters is alignment of the optical axis with the focus stepping axis, which I think is your camera rotation.

What have I missed?

--Rik

ChrisR
Site Admin
Posts: 8616
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

Illustration of the above description:

Image
[Pic replaced, the P was missing]

As you move the camera along the rail towards the subject, the "travel" of P moves sideways depending on both camera and rail twists.
If you use an Arca clamp you would have a third error.

If the rail twist is "small" then its effect is small enough to ignore (I think).

We want a total travel of say less than say 5µm on sensor over a distance of perhaps 10mm (100 would be nicer) rail carriage movement.
So adjusting the camera is a little difficult, even if you know how far the travel is.
You can't measure the angles accurately enough.

The image would be moving in the opposite direction to that of the intersection, so if the image is moving to the right you'd twist the camera to the left

This doesn't guarantee that your rail is pointing at 90º to the subject. To check that you'd have to move the whole rail back and forward. That one doesn't matter too much - you'll just have a slightly tilted plane of focus. It would be easier to tilt the specimen if it were say a sillicon chip slice.

Iterative!

Sound right?
Last edited by ChrisR on Tue Aug 20, 2019 4:39 pm, edited 1 time in total.
Chris R

rjlittlefield
Site Admin
Posts: 21823
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

ChrisR wrote:Sound right?
Still seems overly complicated. In your diagram, the "tilt" of the rail seems quite arbitrary, imposed by how you've chosen to draw the gray grid and the green line.

If I erase the gray and the green and twist my head a little, I see a blue rail, pointed at an obliquely oriented black subject, with a red camera that happens to be twisted on the rail.

It's the rotation of the camera with respect to the rail that causes the center of field to move across the specimen. Rotate the camera so that it points straight along the rail, and all will be OK for stacking purposes. One might also want to adjust the subject's orientation, but that's a separate issue.

Image
We want a total travel of say less than say 5µm on sensor over a distance of perhaps 10mm (100 would be nicer) rail carriage movement.
Hhmm... I can't recall that I've ever felt the need for that degree of precision. My concern has always been to get a clean stacked result, with no edge streaks. The requirements for that are not nearly as stringent as you've described.

What's driving the quest for perfect alignment?

--Rik

Andy Davies
Posts: 138
Joined: Tue Dec 09, 2014 3:25 pm

Post by Andy Davies »

I hope to be able to position my subject I can rotate it and shoot stacks at small changes of angle and then create a video. I have goniomters to be able to position the subject at the centre of a sphere so that it can be moved in two different rotational axes.

It seems like good practice to have the rail moving as closely as possible to be orthogonal with X and Y axes of movement as well as the three axes of rotation (I have a turntable as well).

rjlittlefield
Site Admin
Posts: 21823
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Andy Davies wrote:position my subject I can rotate it and shoot stacks at small changes of angle and then create a video
Makes sense. So then what you really need is
  • the camera is rotationally lined up well enough with the rail so that whatever is centered in the camera's field stays centered as you step focus, and
  • the rail is shifted so that the center of subject rotation is in the center of the camera's field.
One question I always have about precise alignments is this: how do you tell whether something is aligned or not?

The procedure I outlined will tell you about alignment over a span of a few DOF thicknesses, but beyond that the images will get so fuzzy that the computational alignment becomes uncertain. If you want to image say a 10 mm cube on APS-C, call it 1X, then even at nominal f/22, effective f/44, DOF is less than 5 mm, so ChrisR's spec of "5µm on sensor over a distance of perhaps 10mm" seems to be near the limit of what's doable.

I can imagine other strategies, like for example using a special test target that has a wire running straight along the rail axis, so that its in-focus bits should stay perfectly centered in the frame. But then how do you get the target mounted so precisely with respect to the rail? In other words if the wire drifts in frame, how do you know that drift is caused by camera alignment and not by subject alignment?

Bottom line is that I suspect extreme precision is not really needed. If the center of physical rotation is not exactly in the center of the camera field, then that will be evident in the video but at the same time it can be fixed by a simple crop. And if the camera is twisted slightly with respect to the rail, but so slightly that the stack output is still clean (no edge streaks, no subject blurring), then I don't see a scenario where the video would be visibly different.

--Rik

Adalbert
Posts: 1545
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hello Andy,
Why do you want to align your rail in the perfect way?
Do you expect that the stacks will be better calculated by Zerene?
I haven’t noticed any dependence on the alignment of the rail up to now.
BR, ADi

ChrisR
Site Admin
Posts: 8616
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

In your diagram, the "tilt" of the rail seems quite arbitrary, imposed by how you've chosen to draw the gray grid and the green line.
In my diagram, the baseplate is normal to the intended direction of travel of the camera, whose sensor should be parallel to the baseplate.
There's nothing arbitrary about that. The twists of the rail and camera, are arbitrary - in that they might both be either way and to any degree.
The problem is in aligning both the rail and the camera with that direction of motion indicated by the green line.

In your diagram, it's the tilt of the baseplate which to me seems arbitrary.

I want the thing to be set up like every decent microscope - you can move the stage to and from the optics over the entire (say) 30mm of travel, and the axis stays put. If using an MM telecentric) objective, then drift of less than one pixel, please

If the baseplate of a "rig" is horizontal in both axes, then I want the slide to be vertical, not at some arbitrary angle. And I want to be able to lift the slide it its length is short, without major readjustment of the subject.
I don't think there's anything surprising about any of that.

The "rigs" have a harder job than a microscope, because they might be used from say 0.1x to 100x, and over a large range of working distances.

It would be nice to not need alignment in the stacker; I know some prefer to use telecentric optics and do that, but it's beyond what I can I can achieve at the moment.
One question I always have about precise alignments is this: how do you tell whether something is aligned or not?
When you've lost a chunk of the image because the field of view wandered off. Either because of misalignment, or the stacker working with some sloping feature, trying to keep it straight.
The annoying thing is that you don't realise until the stack is complete.
"Fairly annoying" with a deep stack at 100x.

I admit I haven't tried tinkering with Shift X and Y percentages in ZS Preferences, but it would be "nice" to be able to turn it off.
But then how do you get the target mounted so precisely with respect to the rail? In other words if the wire drifts in frame, how do you know that drift is caused by camera alignment and not by subject alignment?
Sure it could be any misalignment. Set square off the baseplate is probably worth being fussy over, for the rail, which has straight sides, unlike the camera.
Chris R

rjlittlefield
Site Admin
Posts: 21823
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

ChrisR wrote:I want the thing to be set up like every decent microscope.
...
In my diagram, the baseplate is normal to the intended direction of travel of the camera, whose sensor should be parallel to the baseplate.
OK, thanks.

I agree, if you want to build a duplicate of a commercial microscope, then you need to have the translation rail perpendicular to the XY stage and the camera sensor parallel to it.

But from my standpoint, choosing to duplicate that configuration is itself an arbitrary decision, and not one that I've ever made. I don't care about getting the setup perfectly perpendicular unless I'm imaging something flat, and then all I care about is that the subject is parallel to the sensor, which is achieved by tweaking the goniometers. If the post in my vertical setup happens to be a little off vertical, I'll never know because it doesn't matter for what I do. The same is true if my rail happens to be not perfectly parallel to the post, or if the camera happens to be not perfectly aligned with the rail. Any slight imperfections in those aspects will be swamped by other issues.

Of course I do care about avoiding edge streaks, but that issue is a lot more complicated than getting the mechanics perpendicular. It is in the nature of computational alignment to drift a little, whenever the scene content is not symmetric across the frame. So my choice comes down to either using computational alignment and somehow dealing with the drift, or getting focus-stepping mechanics that are so stable I can simply turn off XY shift correction. Usually I go with the first approach. Sometimes I do get edge streaks, but when that happens I almost always find that they're too long to have been caused by mechanical misalignment so further worrying about the mechanics would not have been a solution.

To take a specific example, I have just now reviewed the saved ZS project for one of my favorite results, the cherry fruit fly maggot shown at http://www.photomacrography.net/forum/v ... 017#171017 . In that case, the stack output did have significant edge streaks, amounting to over 0.04 in both X and Y shifts. And what caused that? Well, running the calculations, it was either a setup misalignment of over 6 degrees, or something else. Given how obvious a 6 degree misalignment would be, I'd bet strongly on the "something else".

I would be interested to hear more about your experiences. In my own experiences, it has seemed simple to get physical alignment good enough that other issues dominate. But I would be very interested to learn of other situations where physical alignment is paramount.

--Rik

Post Reply Previous topicNext topic