<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
h1
        {margin-top:12.0pt;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        page-break-after:avoid;
        font-size:16.0pt;
        font-family:Arial;
        font-weight:bold;}
h2
        {margin-top:12.0pt;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        page-break-after:avoid;
        font-size:14.0pt;
        font-family:Arial;
        font-weight:bold;
        font-style:italic;}
h3
        {margin-top:12.0pt;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        page-break-after:avoid;
        font-size:13.0pt;
        font-family:Arial;
        font-weight:bold;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
p.EPSRCHeading1, li.EPSRCHeading1, div.EPSRCHeading1
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;
        page-break-after:avoid;
        font-size:14.0pt;
        font-family:Calibri;
        font-weight:bold;}
p.EPSRCHeading2, li.EPSRCHeading2, div.EPSRCHeading2
        {margin-top:3.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        page-break-after:avoid;
        font-size:12.0pt;
        font-family:Calibri;
        text-transform:uppercase;
        font-weight:bold;
        font-style:italic;}
p.EPSRCHeading3, li.EPSRCHeading3, div.EPSRCHeading3
        {margin-top:3.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        page-break-after:avoid;
        font-size:11.0pt;
        font-family:Calibri;
        font-weight:bold;
        font-style:italic;}
p.EPSRCNormal, li.EPSRCNormal, div.EPSRCNormal
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        text-indent:17.0pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCBullets, li.EPSRCBullets, div.EPSRCBullets
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCBulletsCxSpFirst, li.EPSRCBulletsCxSpFirst, div.EPSRCBulletsCxSpFirst
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCBulletsCxSpMiddle, li.EPSRCBulletsCxSpMiddle, div.EPSRCBulletsCxSpMiddle
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCBulletsCxSpLast, li.EPSRCBulletsCxSpLast, div.EPSRCBulletsCxSpLast
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCNumbering, li.EPSRCNumbering, div.EPSRCNumbering
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCNumberingCxSpFirst, li.EPSRCNumberingCxSpFirst, div.EPSRCNumberingCxSpFirst
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCNumberingCxSpMiddle, li.EPSRCNumberingCxSpMiddle, div.EPSRCNumberingCxSpMiddle
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.EPSRCNumberingCxSpLast, li.EPSRCNumberingCxSpLast, div.EPSRCNumberingCxSpLast
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.StyleEPSRCNormalCentered, li.StyleEPSRCNormalCentered, div.StyleEPSRCNormalCentered
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        text-align:center;
        text-indent:17.0pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.CVList, li.CVList, div.CVList
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:36.0pt;
        text-align:justify;
        text-indent:-18.0pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
p.epsrcheading10, li.epsrcheading10, div.epsrcheading10
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;
        page-break-after:avoid;
        font-size:14.0pt;
        font-family:Calibri;
        font-weight:bold;}
p.epsrcheading20, li.epsrcheading20, div.epsrcheading20
        {margin-top:3.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        page-break-after:avoid;
        font-size:12.0pt;
        font-family:Calibri;
        text-transform:uppercase;
        font-weight:bold;
        font-style:italic;}
p.epsrcheading30, li.epsrcheading30, div.epsrcheading30
        {margin-top:3.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        page-break-after:avoid;
        font-size:11.0pt;
        font-family:Calibri;
        font-weight:bold;
        font-style:italic;}
p.epsrcnormal0, li.epsrcnormal0, div.epsrcnormal0
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        text-indent:17.0pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcbullets0, li.epsrcbullets0, div.epsrcbullets0
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcbulletscxspfirst, li.epsrcbulletscxspfirst, div.epsrcbulletscxspfirst
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcbulletscxspmiddle, li.epsrcbulletscxspmiddle, div.epsrcbulletscxspmiddle
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcbulletscxsplast, li.epsrcbulletscxsplast, div.epsrcbulletscxsplast
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcnumbering0, li.epsrcnumbering0, div.epsrcnumbering0
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcnumberingcxspfirst, li.epsrcnumberingcxspfirst, div.epsrcnumberingcxspfirst
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcnumberingcxspmiddle, li.epsrcnumberingcxspmiddle, div.epsrcnumberingcxspmiddle
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:19.85pt;
        margin-bottom:.0001pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.epsrcnumberingcxsplast, li.epsrcnumberingcxsplast, div.epsrcnumberingcxsplast
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:19.85pt;
        text-indent:-11.35pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.styleepsrcnormalcentered0, li.styleepsrcnormalcentered0, div.styleepsrcnormalcentered0
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:3.0pt;
        margin-left:0cm;
        text-align:center;
        text-indent:17.0pt;
        line-height:12.0pt;
        font-size:11.0pt;
        font-family:Calibri;}
p.cvlist0, li.cvlist0, div.cvlist0
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:36.0pt;
        text-align:justify;
        text-indent:-18.0pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
span.emailstyle25
        {font-family:Arial;
        color:windowtext;}
span.EmailStyle41
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>

</head>

<body bgcolor=white lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Hi there,</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Thanks for the swift
response Bao. I've sent you the data files. For completeness, I've posted these
pared down code snippets of my CPU and </span></font><font size=2
 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>GPU</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
code (I've excluded all code that I don't think is relevant). Note that _source
and _target are itk::Image&lt;int,3&gt; objects and as one is a geometric
transform of the other they should not require histogram matching.</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>The CPU version that works
fine:</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::Image&lt;float,3&gt; InternalImageType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::Vector&lt;float,3&gt; VectorPixelType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::Image&lt;VectorPixelType,3&gt; DeformationFieldType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::DemonsRegistrationFilter&lt;InternalImageType,InternalImageType,</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DeformationFieldType&gt;
RegistrationFilterType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegistrationFilterType::Pointer
demons=RegistrationFilterType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::CastImageFilter&lt;ImageType,InternalImageType&gt; CastFilterType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CastFilterType::Pointer
sourceCast=CastFilterType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CastFilterType::Pointer
targetCast=CastFilterType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetCast-&gt;SetInput(_target);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sourceCast-&gt;SetInput(_source);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetMovingImage(sourceCast-&gt;GetOutput());</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetFixedImage(targetCast-&gt;GetOutput());</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetNumberOfIterations(50);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetSmoothDisplacementField(true);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetStandardDeviations(10.0);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetMaximumRMSError(0.01);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;Update();
</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>The </span></font><font
 size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>GPU</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
version I am having problems with:</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::GPUImage&lt;float,3&gt; GPUImageType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::Vector&lt;float,3&gt; VectorPixelType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::GPUImage&lt;VectorPixelType,3&gt; DeformationFieldType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::GPUDemonsRegistrationFilter&lt;GPUImageType,GPUImageType,</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DeformationFieldType&gt;
RegistrationFilterType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GPUImageType::Pointer
gpuSource=GPUImageType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GPUImageType::Pointer
gpuTarget=GPUImageType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegistrationFilterType::Pointer
demons=RegistrationFilterType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
itk::CastImageFilter&lt;ImageType,GPUImageType&gt; CastFilterType;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CastFilterType::Pointer
sourceCast=CastFilterType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CastFilterType::Pointer
targetCast=CastFilterType::New();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetCast-&gt;SetInput(_target);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sourceCast-&gt;SetInput(_source);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetMovingImage(sourceCast-&gt;GetOutput());</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetFixedImage(targetCast-&gt;GetOutput());</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetNumberOfIterations(50);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetSmoothDisplacementField(true);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetStandardDeviations(10.0);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;UseMovingImageGradientOn();</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;SetMaximumRMSError(0.01);</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; demons-&gt;Update();
</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Thanks again, Gareth</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b>
insight-users-bounces@itk.org [mailto:insight-users-bounces@itk.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Baohua Wu<br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>19 July 2012</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>14:59</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> Gareth Price<br>
<b><span style='font-weight:bold'>Cc:</span></b> insight-users@itk.org; James
Gee<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Insight-users] GPU
Demons registration in ITK 4.2</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Gareth,</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Sorry for the problem you
experienced. I am a main developer for GPU demons in ITK4.2. Would you please
send me the images and the testing parameters you used? </span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Thank you for reporting this
issue!</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Bao</span></font></p>

</div>

<blockquote style='border:none;border-left:solid black 1.5pt;padding:0cm 0cm 0cm 4.0pt;
margin-left:3.75pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>----- Original Message ----- </span></font></p>

</div>

<div style='font-color:black'>

<p class=MsoNormal style='margin-left:36.0pt;background:#E4E4E4'><b><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:
bold'>From:</span></font></b><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> <a href="mailto:gee@mail.med.upenn.edu"
title="gee@mail.med.upenn.edu">James Gee</a> </span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><b><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial;font-weight:bold'>To:</span></font></b><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> <a
href="mailto:baohua@mail.med.upenn.edu" title="baohua@mail.med.upenn.edu">Baohua
Wu</a> ; <a href="mailto:stnava@gmail.com" title="stnava@gmail.com">Avants
Brian</a> </span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><b><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial;font-weight:bold'>Sent:</span></font></b><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> </span></font><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Thursday, July
 19, 2012</span></font><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font><font size=2 face=Arial><span
 style='font-size:10.0pt;font-family:Arial'>9:30 AM</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><b><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial;font-weight:bold'>Subject:</span></font></b><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> Fwd:
[Insight-users] GPU Demons registration in ITK 4.2</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
<br>
Sent from my iPhone</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-right:0cm;margin-bottom:12.0pt;margin-left:
36.0pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
Begin forwarded message:</span></font></p>

</div>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite>

<div>

<p class=MsoNormal style='margin-right:0cm;margin-bottom:12.0pt;margin-left:
36.0pt'><b><font size=3 face="Times New Roman"><span style='font-size:12.0pt;
font-weight:bold'>From:</span></font></b> Gareth Price &lt;<a
href="mailto:Gareth.Price@physics.cr.man.ac.uk">Gareth.Price@physics.cr.man.ac.uk</a>&gt;<br>
<b><span style='font-weight:bold'>Date:</span></b> July 19, 2012 8:24:40 AM EDT<br>
<b><span style='font-weight:bold'>To:</span></b> &lt;<a
href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>
<b><span style='font-weight:bold'>Subject:</span></b> <b><span
style='font-weight:bold'>[Insight-users] GPU Demons registration in ITK 4.2</span></b></p>

</div>

</blockquote>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Hi there,</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I was wondering if someone
might be able to offer advice regarding the new ITK 4.2 GPU implementation of
the demons algorithm.</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I have an application using
the standard CPU implementation to register 3D CT images (512x512x~70 voxels).
This behaves perfectly when registering synthetic deformations to their
original image. I typically use a smoothing kernel standard deviation of 10.0
with no update field smoothing. With my images, the metric reduces
exponentially as expected from ~8000 to 350 over 50 iterations with the RMS
update field change showing a similar but slower trend from ~0.08 to 0.04.
After 50 iterations the solutions have made good progress towards the original
images. </span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Porting this code to the GPU
implementation following the examples in the
itkGPUDemonsRegistrationFilterTests (i.e. swapping the internal image type for
GPUImageType and GPUDemonsRegistrationFilter for DemonsRegistrationFilter)
provides an immediate ~x15 increase in speed on my machine (GeForce GTX480).
However using the same input data and smoothing parameters, the metric and RMS
update field trends, although still exponential show changes from ~8000 to 1500
(metric) and ~0.3 to 0.2 (update field). The result is that the deformation
field produced is much too large. Changing smoothing parameters does not change
this behaviour, whilst enabling update field smoothing crashes the process (in
GPUDemonsRegistrationFilter::ApplyUpdate). It is very strange that the
similarity metric is continuing to reduce as the deformation field pushes the
moving image through and past its correct fixed image alignment.</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Would someone be able to
tell me if this is expected behaviour/are known bugs, or offer advice if I am
using the GPU registration filter incorrectly?</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Many thanks, Gareth</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<div>

<div class=MsoNormal align=center style='margin-left:36.0pt;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center>

</span></font></div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>****************************************************************<br>
This e-mail and any files transmitted with it are confidential<br>
and solely for the use of the intended recipient. If you have<br>
received this e-mail in error you should not disseminate,<br>
distribute or copy it. Please notify the sender immediately and<br>
delete this e-mail from your system.<br>
****************************************************************</span></font></p>

</div>

</div>

</blockquote>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite>

<div>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>_____________________________________<br>
Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a></span></font></p>

</div>

</blockquote>

</blockquote>

</div>


<DIV><P><HR>
****************************************************************<BR>
This e-mail and any files transmitted with it are confidential<BR>
and solely for the use of the intended recipient. If you have<BR>
received this e-mail in error you should not disseminate,<BR>
distribute or copy it. Please notify the sender immediately and<BR>
delete this e-mail from your system.<BR>
****************************************************************<BR>

</P></DIV>
</body>

</html>