[Insight-users] a problem in itk registration fuction

Carrie carrie_shi@sjtu.edu.cn
Sun May 9 14:52:33 EDT 2004


This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C4360F.EF6CA2A0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi all,
   I wrote some sentences to do the registration function with python.
But after using "StartRegistration()", the result array from
registration.GetLastTransformParameters() always is 0.  How can I solve
this problem? Some codes as followed:
            
imagefixed=itkFixedImage.GetOutput()
       imagemoving=itkMovingImage.GetOutput()
           
        registration = itk.itkImageRegistrationMethodF3F3_New()
        imageMetric  =
itk.itkMutualInformationImageToImageMetricF3F3_New()
        transform     = itk.itkQuaternionRigidTransform_New()
        optimizer    = itk.itkGradientDescentOptimizer_New()
        interpolator = itk.itkLinearInterpolateImageFunctionF3D_New()
 
         imageMetric.SetFixedImageStandardDeviation(0.4)
        imageMetric.SetMovingImageStandardDeviation(0.4)
        imageMetric.SetNumberOfSpatialSamples(50)
 
        imagefixed.Update()
imagemoving.Update()
 
        registration.SetOptimizer(optimizer.GetPointer())
        registration.SetTransform(transform.GetPointer())
        registration.SetInterpolator(interpolator.GetPointer())
        registration.SetMetric(imageMetric.GetPointer())
        registration.SetFixedImage(imagefixed)
        registration.SetMovingImage(imagemoving)
 
        registration.SetFixedImageRegion(imagefixed.GetBufferedRegion())
         
        transform.SetIdentity()
        initialParameters=transform.GetParameters()
        i=0
        for i in range(transform.GetNumberOfParameters()):
            initialParameters.SetElement(i,0.0)
        registration.SetInitialTransformParameters(initialParameters )
      
        def iterationUpdate():
            currentParameter = transform.GetParameters()
        iterationCommand = itk.itkPyCommand_New()
        iterationCommand.SetCommandCallable(iterationUpdate)
 
        optimizer.AddObserver(itk.itkIterationEvent(),
iterationCommand.GetPointer() )
        optimizer.SetNumberOfIterations(100)
            optimizer.SetLearningRate(20.0)
        optimizer.MaximizeOn()
        registration.SetMovingImage(imagemoving)
        registration.StartRegistration()
        solution = registration.GetLastTransformParameters()
  
The 7 elements in solution array(in the last sentence) are 0. why did
that happen?
Thx
Regards,
   
Carrie

------=_NextPart_000_0001_01C4360F.EF6CA2A0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 10">
<meta name=3DOriginator content=3D"Microsoft Word 10">
<link rel=3DFile-List href=3D"cid:filelist.xml@01C4360F.EEC7FE30">
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:PunctuationKerning/>
  <w:DrawingGridVerticalSpacing>7.8 =
&#30917;</w:DrawingGridVerticalSpacing>
  =
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEve=
ry>
  =
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
  <w:Compatibility>
   <w:SpaceForUL/>
   <w:BalanceSingleByteDoubleByteWidth/>
   <w:DoNotLeaveBackslashAlone/>
   <w:ULTrailSpace/>
   <w:DoNotExpandShiftReturn/>
   <w:AdjustLineHeightInTable/>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	mso-pagination:none;
	font-size:10.5pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:SimSun;
	mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	mso-style-noshow:yes;
	mso-ansi-font-size:9.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:Arial;
	mso-ascii-font-family:Arial;
	mso-fareast-font-family:SimSun;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:windowtext;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
 /* Page Definitions */
 @page
	{mso-page-border-surround-header:no;
	mso-page-border-surround-footer:no;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:42.55pt;
	mso-footer-margin:49.6pt;
	mso-paper-source:0;
	layout-grid:15.6pt;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
	{mso-style-name:\666E\901A\8868\683C;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=3DZH-CN link=3Dblue vlink=3Dpurple =
style=3D'tab-interval:21.0pt;text-justify-trim:
punctuation'>

<div class=3DSection1 style=3D'layout-grid:15.6pt'>

<p class=3DMsoNormal><font size=3D3 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
12.0pt;font-family:Arial'>Hi all,<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:6.0pt;text-indent:-6.0pt;mso-char-indent-count:
-.5'><font size=3D3 face=3DArial><span lang=3DEN-US =
style=3D'font-size:12.0pt;
font-family:Arial'><span style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span>I wrote some sentences to do the =
registration
function with python. But after using &#8220;<span =
class=3DGramE>StartRegistration(</span>)&#8221;,
the result array from registration.GetLastTransformParameters() always =
is 0. <span
style=3D'mso-spacerun:yes'>&nbsp;</span>How can I solve this problem? =
Some codes as
followed:<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:9.0pt;
mso-bidi-font-size:10.0pt;font-family:Arial'><span =
style=3D'mso-tab-count:1'>&nbsp; </span><span
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span><font =
color=3D"#003366"><span
style=3D'color:#003366'><o:p></o:p></span></font></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;mso-para-margin-left:.43gd;
text-indent:31.5pt;mso-char-indent-count:3.5'><span class=3DGramE><font =
size=3D1
color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:Arial;color:#003366'>imagefixed=3D</span></font></span=
><font
size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:9.0pt;
mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'>itkFixedImage.=
GetOutput()<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span><span =
style=3D'mso-tab-count:
1'> </span><span style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span =
class=3DGramE>imagemoving=3D</span>itkMovingImage.GetOutput()<o:p></o:p><=
/span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
style=3D'mso-tab-count:1'>&nbsp;&nbsp; =
</span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration</span> =3D =
itk.itkImageRegistrationMethodF3F3_New()<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>imageMetric<span style=3D'mso-spacerun:yes'>&nbsp; =
</span>=3D</span>
itk.itkMutualInformationImageToImageMetricF3F3_New()<o:p></o:p></span></f=
ont></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>transform</span><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp; </span>=3D<span
style=3D'mso-tab-count:1'> =
</span>itk.itkQuaternionRigidTransform_New()<o:p></o:p></span></font></p>=


<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>optimizer</span><span =
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;
</span>=3D =
itk.itkGradientDescentOptimizer_New()<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>interpolator</span> =3D
itk.itkLinearInterpolateImageFunctionF3D_New()<o:p></o:p></span></font></=
p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><o:p>&nb=
sp;</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-tab-count:1'>&nbsp; </span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span =
class=3DGramE>imageMetric.SetFixedImageStandardDeviation(</span>0.4)<o:p>=
</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>imageMetric.SetMovingImageStandardDeviation(</span>0.4)<o:p=
></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>imageMetric.SetNumberOfSpatialSamples(</span>50)<o:p></o:p>=
</span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><o:p>&nb=
sp;</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>imagefixed.Update()</span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;mso-para-margin-left:.43gd;
text-indent:31.5pt;mso-char-indent-count:3.5'><span class=3DGramE><font =
size=3D1
color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:9.0pt;mso-bidi-font-size:
10.0pt;font-family:Arial;color:#003366'>imagemoving.Update()</span></font=
></span><font
size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:9.0pt;
mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><o:p></o:p></s=
pan></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><o:p>&nb=
sp;</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetOptimizer(</span>optimizer.GetPointer())<o:=
p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetTransform(</span>transform.GetPointer())<o:=
p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetInterpolator(</span>interpolator.GetPointer=
())<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetMetric(</span>imageMetric.GetPointer())<o:p=
></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetFixedImage(</span>imagefixed)<o:p></o:p></s=
pan></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetMovingImage(</span>imagemoving)<o:p></o:p><=
/span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><o:p>&nb=
sp;</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetFixedImageRegion(</span>imagefixed.GetBuffe=
redRegion())<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;
</span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>transform.SetIdentity()</span><o:p></o:p></span></font></p>=


<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>initialParameters=3D</span>transform.GetParameters()<o:p></=
o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>i=3D0<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>for</span> i in =
range(transform.GetNumberOfParameters()):<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
</span><span =
class=3DGramE>initialParameters.SetElement(</span>i,0.0)<o:p></o:p></span=
></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.SetInitialTransformParameters(</span>initialPa=
rameters
)<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>def</span> iterationUpdate():<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
</span><span class=3DGramE>currentParameter</span> =3D =
transform.GetParameters()<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>iterationCommand</span> =3D =
itk.itkPyCommand_New()<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>iterationCommand.SetCommandCallable(</span>iterationUpdate)=
<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><o:p>&nb=
sp;</o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>optimizer.AddObserver(</span>itk.itkIterationEvent(),
iterationCommand.GetPointer() )<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>optimizer.SetNumberOfIterations(</span>100)<o:p></o:p></spa=
n></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-tab-count:1'>&nbsp; </span><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span =
class=3DGramE>optimizer.SetLearningRate(</span>20.0)<o:p></o:p></span></f=
ont></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>optimizer.MaximizeOn()</span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span =
class=3DGramE>registration.SetMovingImage(</span>imagemoving)<o:p></o:p><=
/span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>registration.StartRegistration()</span><o:p></o:p></span></=
font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span><span
class=3DGramE>solution</span> =3D =
registration.GetLastTransformParameters()<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:4.5pt;text-indent:-4.5pt;mso-char-indent-count:
-.5'><font size=3D1 color=3D"#003366" face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial;color:#003366'><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;</span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:6.0pt;mso-para-margin-left:.57gd;
text-indent:6.0pt;mso-char-indent-count:.5'><font size=3D3 =
face=3DArial><span
lang=3DEN-US style=3D'font-size:12.0pt;font-family:Arial'>The 7 elements =
in solution
<span class=3DGramE>array(</span>in the last sentence) are 0. <span =
class=3DGramE>why</span>
did that happen?<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:6.0pt;mso-para-margin-left:.57gd;
text-indent:6.0pt;mso-char-indent-count:.5'><font size=3D3 =
face=3DArial><span
lang=3DEN-US =
style=3D'font-size:12.0pt;font-family:Arial'>Thx<o:p></o:p></span></font>=
</p>

<p class=3DMsoNormal =
style=3D'margin-left:6.0pt;mso-para-margin-left:.57gd;
text-indent:6.0pt;mso-char-indent-count:.5'><font size=3D3 =
face=3DArial><span
lang=3DEN-US =
style=3D'font-size:12.0pt;font-family:Arial'>Regards,<o:p></o:p></span></=
font></p>

<p class=3DMsoNormal =
style=3D'margin-left:6.0pt;mso-para-margin-left:.57gd;
text-indent:6.0pt;mso-char-indent-count:.5'><font size=3D3 =
face=3DArial><span
lang=3DEN-US style=3D'font-size:12.0pt;font-family:Arial'><span =
style=3D'mso-tab-count:
1'>&nbsp;&nbsp; </span><o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'margin-left:6.0pt;mso-para-margin-left:.57gd;
text-indent:6.0pt;mso-char-indent-count:.5'><font size=3D3 =
face=3DArial><span
lang=3DEN-US =
style=3D'font-size:12.0pt;font-family:Arial'>Carrie<o:p></o:p></span></fo=
nt></p>

</div>

</body>

</html>

------=_NextPart_000_0001_01C4360F.EF6CA2A0--




More information about the Insight-users mailing list