imregtform documentation and tform scaling
4 次查看(过去 30 天)
显示 更早的评论
I have found similar requests to this but not satisfactory reply yet so here we go again:
is there any detailed documentation on imregtform and its internal behaviour? The online help specifies that the optimizer parameters should be tuned depending on the images but without knowing how those parameters work, it is really hard to know in which direction to tune.
-For instance, what are the units (if any) of MaximumStepLength?
-If I pass the spatial reference to the function, the tform is supposed to be in the same units as the reference. Is that correct? And if so, how can I pass an 'InitialTransformation' parameter that was obtained using a different scale?
To explain what I am doing, I have two sets of slices from a microscope scan. The number of slices is much smaller than the XY resolution (1040*1392 and 60 slices) so I am implementing my own pyramid algorithm ,in which X and Y resolutions are halved at each level but Z (n of slices) remains constant. I want to find the best transformation at each level and pass it to the next one but I suspect I will need to rescale the tform before passing it.
I understand that trying to explain my problem is tricky, that is why I am trying to find as much documentation as possible relative to the function. The examples provided are helpful but very simplified and do not cover the tricky details (and we know the devil is in the details).
Thanks for any help.
0 个评论
回答(1 个)
Matthew Madany
2022-7-28
编辑:Matthew Madany
2022-7-28
I'm going to answer this as best as I can, although I've also found dealing with tforms at different scales to be quite tricky. tforms can be difficult to work with because they rotate and project around the coordinate 0,0 and not the image center, so it's difficult to pull them apart and understand each underlying transformation.
-For instance, what are the units (if any) of MaximumStepLength?
This is a parameter passed to the optimizer registration.optimizer.RegularStepGradientDescent. It doesn't have units because it isn't related to the image information and is an optimizer parameter: https://www.mathworks.com/help/images/ref/registration.optimizer.regularstepgradientdescent.html
-If I pass the spatial reference to the function, the tform is supposed to be in the same units as the reference. Is that correct? And if so, how can I pass an 'InitialTransformation' parameter that was obtained using a different scale?
All of the elements of a geometric transfomation matrix are scale-indepdent with the exception of translation. So in order to rescale tforms you need to do tform.T(3,1:2) = tform.T(3,1:2)*ScaleFactor: https://www.mathworks.com/help/images/matrix-representation-of-geometric-transformations.html
To explain what I am doing, I have two sets of slices from a microscope scan. The number of slices is much smaller than the XY resolution (1040*1392 and 60 slices) so I am implementing my own pyramid algorithm ,in which X and Y resolutions are halved at each level but Z (n of slices) remains constant. I want to find the best transformation at each level and pass it to the next one but I suspect I will need to rescale the tform before passing it.
Given image of size 1040x1392 with a corresponding tform aligned at half resolution, your code will look like: tform.T(3,1:2) = tform.T(3,1:2)*2; registeredImage = imwarp(image,tform,'nearest','OutputView',imref2d(size(image)));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!