<div dir="ltr"><p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif;background-image:initial;background-repeat:initial">Hi
all,</span><span style="font-size:12pt;font-family:"Times New Roman",serif"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">I noticed that the
output of my registration is exactly as the moving image, which means
that the code below is not correct, but not sure where is the mistake. I think
it has to do with the transform initializer....</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">Thanks,</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">AD</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
// Read input static</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.ImageFileReader reader1 = new
itk.simple.ImageFileReader();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
reader1.SetFileName(args[0]);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
Image static = reader1.Execute();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
// Read input moving</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.ImageFileReader reader2 = new
itk.simple.ImageFileReader();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
reader2.SetFileName(args[0]);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
Image moving = reader2.Execute();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
//registation </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.ImageRegistrationMethod R = new
itk.simple.ImageRegistrationMethod();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
R.SetMetricAsMattesMutualInformation(50); </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
R.SetMetricSamplingPercentage(30.0);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
R.SetInterpolator(itk.simple.InterpolatorEnum.sitkLinear);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
R.SetOptimizerAsLBFGSB();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.BSplineTransform transform = new
itk.simple.BSplineTransform(3);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
R.SetInitialTransform( transform);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.Transform trans_f = R.Execute(static, moving);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
//resample image</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.ResampleImageFilter resample = new
itk.simple.ResampleImageFilter();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
resample.SetReferenceImage(static);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
resample.SetTransform(trans_f);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
resample.SetInterpolator(itk.simple.InterpolatorEnum.sitkBSpline);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Arial,sans-serif">
itk.simple.Image registered = resample.Execute(moving);</span></p>
<p class="MsoNormal"> </p></div>