WOLFRAM NOTEBOOK

4.6 Comparison of Regression Methods

4.6.1 Registration of a Medical Image

In[]:=
imgT=
;
In[]:=
imgS=
;
In[]:=
imgR=ImageAlign[imgT,imgS,BackgroundBlack,Method"Keypoints",TransformationClass"Affine"]
Out[]=
In[]:=
GraphicsGrid[{{HighlightImage[imgT,imgR]}}]
Out[]=
In[]:=
ImageDifference[imgT,imgR]//ImageData//Max
Out[]=
0.941176
In[]:=
z=ImageCorrespondingPoints[imgT,imgS];
In[]:=
Length[z[[1]]]
Out[]=
100
In[]:=
GraphicsGrid[{{HighlightImage[imgT,z[[1]]],HighlightImage[imgS,z[[2]]]}}]
Out[]=
In[]:=
{error,tf}=FindGeometricTransform[z[[1]],z[[2]],Method->"RANSAC"]
Out[]=
0.481202,TransformationFunction
1.19767
0.115656
-26.1737
-0.156004
1.12978
20.0959
-0.0000125343
-0.0000125236
1.
In[]:=
{w,h}=ImageDimensions[imgS];
In[]:=
imgR=ImagePerspectiveTransformation[imgS,tf,DataRangeFull]
Out[]=
In[]:=
GraphicsGrid[{{HighlightImage[imgT,imgR]}}]
Out[]=
In[]:=
ImageDifference[imgT,imgR]//ImageData//Max
Out[]=
0.941176
In[]:=
fg[x_,y_]:={1.04x+0.1083y-24.02,-0.131x+1.04y+17.4}imgR=ImageForwardTransformation[imgS,fg[#[[1]],#[[2]]]&,DataRangeFull,BackgroundBlack]
Out[]=
In[]:=
GraphicsGrid[{{HighlightImage[imgT,imgR]}}]
Out[]=
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.