<DIV>I am using Microsft Visual C++ .NET 2003 compiler. What do you mean by "what optimiztion leve^l?". Even during execution without debuggage, the execution takes a lot of times compared with matlab</DIV>  <DIV>&nbsp;</DIV>  <DIV>Isabelle<BR><BR><B><I>"Lorensen, William E (Research)" &lt;lorensen@crd.ge.com&gt;</I></B> a écrit&nbsp;:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <META content="MSHTML 6.00.2900.2769" name=GENERATOR>  <DIV><SPAN class=245002312-29112005><FONT face=Arial color=#0000ff size=2>Which compiler are you using? What optimization level? ITK is very sensitive to optimization. On Windows you should build RelWithDebInfo or Release. Debug builds are very slow.</FONT></SPAN></DIV>  <DIV><SPAN class=245002312-29112005><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>  <DIV><SPAN class=245002312-29112005><FONT face=Arial color=#0000ff size=2>Bill</FONT></SPAN></DIV>  <BLOCKQUOTE dir=ltr
 style="MARGIN-RIGHT: 0px">  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> insight-users-bounces+lorensen=crd.ge.com@itk.org [mailto:insight-users-bounces+lorensen=crd.ge.com@itk.org]<B>On Behalf Of </B>Renaud Isabelle<BR><B>Sent:</B> Monday, November 28, 2005 5:04 PM<BR><B>To:</B> insight-users@itk.org<BR><B>Subject:</B> [Insight-users] my ITK code is slow: what is wrong? <BR><BR></FONT></DIV>  <DIV id=RTEContent>Hi,</DIV>  <DIV>&nbsp;</DIV>  <DIV>I translate a matlab procedure into C++ with ITK to make things quicker. Now, comparing both of them, I found that results are the same but my <STRONG>C++ version with ITK is twice slower than matlab</STRONG>, whereas the contrary was expected. Could someone tell me what is wrong with my code: is there things that I can improve and time that I can save?</DIV>  <DIV>&nbsp;</DIV>  <DIV>Here is what I did:</DIV>  <DIV><FONT size=2>  <DIV>&nbsp;</DIV> 
 <DIV><STRONG><EM>constructeur()</EM></STRONG></DIV>  <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;input = NULL;</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;image1 = NULL;</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;image2 = NULL;</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;coeff = NULL;</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;shiftx = NULL;</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;shifty = NULL;</EM></STRONG></DIV> 
 <DIV><STRONG><EM></EM></STRONG></FONT><FONT color=#008000 size=2></FONT>&nbsp;</DIV>  <DIV><FONT color=#008000 size=2><STRONG><EM>&nbsp; //filters</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>&nbsp; extractSlice = ExtractSliceFilter::New();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; extractRegion = ExtractRegionFilter::New();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; fft1 = FFTFilterType::New();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; fft2 = FFTFilterType! ::New(); </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; mult = MultiplyFilter::New(); </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; ifft = IFFTFilterType::New();</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></FONT><FONT color=#008000 size=2></FONT>&nbsp;</DIV>  <DIV><FONT color=#008000 size=2><STRONG><EM>&nbsp; //release extra data</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>&nbsp; extractSlice-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp;
 extractRegion-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; fft1-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; fft2-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; mult-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; ifft-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp;&nbsp;mult-&gt;SetInput1(fft1-&gt;GetOutput());</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; mult-&gt;SetInput2(fft2-&gt;GetOutput());</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; ifft-&gt;SetInput(mult-&gt;GetOutput()); </EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></DIV></FONT><FONT color=#0000ff size=2>  <DIV><STRONG><EM>void</EM></STRONG></FONT><FONT size=2><STRONG><EM> ComputeElastogram::SetInput( ImageType3D::ConstPointer image)</EM></STRONG></DIV> 
 <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;input = image;</EM></STRONG></DIV>  <DIV><STRONG><EM>extractSlice-&gt;SetInput(</EM></STRONG></FONT><FONT color=#0000ff size=2><STRONG><EM>this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;input);</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;calcul_deplacements();}</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV></FONT><FONT color=#0000ff size=2>  <DIV><STRONG><EM>void</EM></STRONG></FONT><FONT size=2><STRONG><EM> ComputeElastogram::calcul_deplacements() </EM></STRONG></DIV>  <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV></FONT><STRONG><EM><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> k1,k2,n;</FONT></EM></STRONG></DIV>  <DIV><FONT
 size=2><STRONG><EM></EM></STRONG></FONT>&nbsp;</DIV><FONT size=2>  <DIV><FONT color=#008000 size=2><STRONG><EM>//Creation des matrices de deplacement</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>ImageType::IndexType start;</EM></STRONG></DIV>  <DIV><STRONG><EM>start.Fill(0); </EM></STRONG></DIV>  <DIV><STRONG><EM>ImageType::SizeType sz;</EM></STRONG></DIV>  <DIV><STRONG><EM>sz[0] = dim_s[0]; </EM></STRONG></DIV>  <DIV><STRONG><EM>sz[1] = dim_s[1];</EM></STRONG></DIV!>   <DIV><STRONG><EM>ImageType::RegionType region;</EM></STRONG></DIV>  <DIV><STRONG><EM>region.SetSize( sz );</EM></STRONG></DIV>  <DIV><STRONG><EM>region.SetIndex( start );</EM></STRONG></DIV>  <DIV><STRONG><EM>shifty = ImageType::New();</EM></STRONG></DIV>  <DIV><STRONG><EM>shifty-&gt;SetRegions( region );</EM></STRONG></DIV>  <DIV><STRONG><EM>shifty-&gt;Allocate();</EM></STRONG></DIV>  <DIV><STRONG><EM>shiftx = ImageType::New();</EM></STRONG></DIV>  <DIV><STRONG><EM>shiftx-&gt;SetRegions( region
 );</EM></STRONG></DIV>  <DIV><STRONG><EM>shiftx-&gt;Allocate();</EM></STRONG></DIV></FONT>  <DIV><STRONG><EM></EM></STRONG></FONT><FONT size=2>&nbsp;</DIV>  <DIV><STRONG><EM>rowa = dim_fen[0]; cola = dim_fen[1];</EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>/*--------Cropped ROI-------------*/</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>ImageType3D::SizeType croppedSizee;</EM></STRONG></DIV>  <DIV><STRONG><EM>croppedSize[0] = dim_img[0];</EM></STRONG></FONT><FONT color=#008000 size=2><STRONG><EM>//dim_roi[0];</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>croppedSize[1] = dim_img[1];</EM></STRONG></FONT><FONT color=#008000 size=2><STRONG><EM>//dim_roi[1];</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>croppedSize[2] = 0;</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>ImageType3D::IndexType croppedStart;</EM></STRONG></DIV> 
 <DIV><STRONG><EM>croppedStart[0] = 0;</EM></STRONG></FONT><FONT color=#008000 size=2><STRONG><EM>//bords_c[0];</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>croppedStart[1] = 0;</EM></STRONG></FONT><FONT color=#008000 size=2><STRONG><EM>//bords_l[0];</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>croppedStart[2] = 0; </EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV>  <DIV><STRONG><EM>ImageType3D::RegionType croppedRegion;</EM></STRONG></DIV>  <DIV><STRONG><EM>croppedRegion.SetSize(croppedSize);</EM></STRONG></DIV>  <DIV><STRONG><EM>croppedRegion.SetIndex(croppedStart);</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>/*------------------------------------*/</EM></STRONG></DIV></FONT><FONT size=2>  <DIV></FONT><FONT color=#008000 size=2><STRONGG><EM>/*--------WINDOWS--------------------*/</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>ImageType::SizeType
 extractedSize;</EM></STRONG></DIV>  <DIV><STRONG><EM>extractedSize[0] =80;</EM></STRONG></DIV>  <DIV><STRONG><EM>extractedSize[1] = 20;</EM></STRONG></DIV>  <DIV><STRONG><EM>ImageType::IndexType extractedStart;</EM></STRONG></DIV>  <DIV><STRONG><EM>extractedStart.Fill(0); </EM></STRONG></DIV>  <DIV><STRONG><EM>ImageType::RegionType desiredRegion;</EM></STRONG></DIV>  <DIV><STRONG><EM>desiredRegion.SetSize(extractedSize); </EM></STRONG></DIV>  <DIV><STRONG><EM>desiredRegion.SetIndex(extractedStart); </EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>/*------------------------------------*/</EM></STRONG></FONT></DIV>  <DIV><EM><STRONG><FONT color=#008000 size=2>&nbsp;</DIV></FFONT></STRONG></EM><FONT size=2>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>/*--------Hanning Window--------------*/</EM></STRONG></FONT><FONT size=2><STRONG><EM> </EM></STRONG></DIV>  <DIV><STRONG><EM>ImageType::Pointer hanning = ImageType::New();</EM></STRONG></DIV> 
 <DIV><STRONG><EM>hanning-&gt;SetRegions( desiredRegion );</EM></STRONG></DIV>  <DIV><STRONG><EM>hanning-&gt;Allocate();</EM></STRONG></DIV>  <DIV></FONT><STRONG><EM><FONT color=#0000ff size=2>float</FONT><FONT size=2> **w = hanning_2D(dim_fen[1],dim_fen[0]);</FONT><FONT color=#008000 size=2>//taille de la fenetre 20lignes * 80colonnes</DIV></FONT></EM></STRONG><FONT size=2>  <DIV><STRONG><EM>ImageRegionIterator it(hanning, desiredRegion); </EM></STRONG></DIV>  <DIV></FONT><STRONG><EM><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>int</FONT></EM></STRONG><FONT size=2><STRONG><EM> i=0;i&lt;dim_fen[1];i++)</EM></STRONG></DIV>  <DIV></FONT><STRONG><EM><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>int</FONT></EM></STRONG><FONT size=2><STRONG><EM> j=0; j&lt;dim_fen[0]; j++)</EM></STRONG></DIV>  <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; it.Set(w[i][j]);</EM></STRONG></DIV> 
 <DIV><STRONG><EM>&nbsp; ++it;</EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></DIV>  <DIV><STRONG><EM>free_fmatrix_2d(w);</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>fhan = WindowFilter::New();</EM></STRONG></DIV>  <DIV><STRONG><EM>fhan-&gt;GetOutput()-&gt;ReleaseDataFlagOn();</EM></STRONG></DIV>  <DIV><STRONG><EM>fhan-&gt;SetInput1(hanning);</EM></STRONG></DIV>  <DIV><STRONG><EM>fhan-&gt;SetInput2(extractRegion-&gt;GetOutput());</EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>/*------------------------------------*/</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV></FONT><FONT size=2>&lt;   <DIV><STRONG><EM>ImageRegionIterator it1(shifty, shifty-&gt;GetLargestPossibleRegion()); </EM></STRONG></DIV>  <DIV><STRONG><EM>ImageRegionIterator it2(shiftx, shiftx-&gt;GetLargestPossibleRegion());</EM></STRONG></DIV></FONT><FONT size=2> 
 <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></FONT><FONT color=#008000 size=2>&nbsp;</DIV></FONT><FONT size=2>  <DIV><STRONG><EM>croppedStart[2] = 0;</EM></STRONG></DIV>  <DIV><STRONG><EM>croppedRegion.SetIndex(croppedStart); </EM></STRONG></DIV>  <DIV><STRONG><EM>extractSlice-&gt;SetExtractionRegion(croppedRegion);</EM></STRONG></DIV></FONT><FONT size=2>  <DIV></FONT><FONT size=2><STRONG><EM>extractSlice-&gt;Update();</EM></STRONG></FONT></DIV><DI! v><FONT size=2><STRONG><EM>ImageType2D::Pointer im0 = extractSlice-&gt;GetOutput();</EM></STRONG></DIV>  <DIV><STRONG><EM>im0-&gt;DisconnectPipeline(); </EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></FONT><FONT color=#008000 size=2></FONT>&nbsp;</DIV>  <DIV><FONT size=2><STRONG><EM>croppedStart[2] = 1;</EM></STRONG></DIV>  <DIV><STRONG><EM>croppedRegion.SetIndex(croppedStart); </EM></STRONG></DIV>  <DIV><STRONG><EM>extractSlice-&gt;SetExtractionRegion(croppedRegion);</EM></STRONG></DIV> 
 <DIV><STRONG><EM>extractSlice-&gt;Modified();</EM></STRONG></DIV>  <DIV></FONT><FONT size=2><STRONG><EM>extractSlice-&gt;Update();</EM></STRONG></FONT></DIV>  <DIV><FONT size=2><STRONG><EM>ImageType2D::Pointer im1 = extractSlice-&gt;GetOutput();</EM></STRONG></DIV>  <DIV><STRONG><EM>im1-&gt;DisconnectPipeline();</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>//-------------------------------------------------------------------</EM></STRONG></FONT></DIV>  <DIV><EM><STRONG><FONT color=#008000 size=2>&nbsp;</DIV></FONT></STRONG></EM><FONT size=2>  <DIV><STRONG><EM>it1.GoToBegin();</EM></STRONG></DIV>  <DIV><STRONG><EM>it2.GoToBegin(); </EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG>&nbsp;</DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>// Correlation </EM></STRONG></FONT></DIV>  <DIV><FONT size=2></FONT><FONT color=#0000ff
 size=2><STRONG><EM>for</EM></STRONG></FONT><FONT size=2><STRONG><EM>(k1 = 0; k1 &lt; dim_s[0]; k1++)</EM></STRONG></DIV>  <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>for</EM></STRONG></FONT><FONT size=2><STRONG><EM>(k2 = 0; k2 &lt; dim_s[1]; k2++)</EM></STRONG></DIV>  <DIV><STRONG><EM>{ </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; extractedStart[0] = k1*pas_fen[0]+ bords_c[0];</EM></STRONG></D! iv>   <DIV><STRONG><EM>&nbsp; extractedStart[1] = k2*pas_fen[1]+ bords_l[0];</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; desiredRegion.SetIndex(extractedStart); </EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; extractRegion-&gt;SetRegionOfInterest(desiredRegion); </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; extractRegion-&gt;SetInput(im0); </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; fhan-&gt;Update();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; image1 = fhan-&gt;GetOutput();</EM></STRONG></DIV> 
 <DIV><STRONG><EM>&nbsp; image1-&gt;DisconnectPipeline();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; extractRegion-&gt;SetInput(im1); </EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; fhan-&gt;Update();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; image2 = fhan-&gt;GetOutput();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; image2-&gt;DisconnectPipeline();</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; int</EM></STRONG></FONT><FONT size=2><STRONG><EM> *shft = shift(image1,image2);</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; it1.Set(shft[0]);</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; it2.Set(shft[1]);</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; ++it1;</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; ++it2;</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></FONT><FONT color=#008000 size=2><STRONG><EM>//k1</EM></STRONG></DIV></FONT><FONT
 size=2>  <DIV><STRONG><EM>}</EM></STRONG></FONT><FONT color=#008000 size=2><STRONG><EM>//k2 </EM></STRONG></FONT></DIV>  <DIV><EM><STRONG><FONT color=#008000 size=2>&nbsp;</DIV></FONT></STRONG></EM><FONT size=2>  <DIV><STRONG><EM>timer.Stop();</EM></STRONG></DIV>  <DIV><STRONG><EM>fprintf(fp, "\n Elapsed time: %f\n", timer.GetMeanTime());</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV></FONT><FONT size=2>  <DIV></FONT><FONT size=2><STRONG><EM>}</EM></STRONG></FONT></DIV>  <DIV><EM><STRONG><FONT size=2>&nbsp;</DIV></FONT></STRONG></EM><FONT color=#0000ff size=2>  <DIV><STRONG><EM>int</EM></STRONG></FONT><FONT size=2><STRONG><EM>* ComputeElastogram::shift( ImageType::Pointer image1, ImageType::Pointer image2) </EM></STRONG></DIV>  <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV></FONT><STRONG><EM><FONT color=#0000ff size=2>int</FONT><FONT size=2> *shft = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT></EM></STRONG><FONT
 size=2><STRONG><EM>[2];</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>this</EM></STRONG></FONT><FONT size=2><STRONG><EM>-&gt;calcul_coef(image2,image1);</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></FONT><FONT size=2></FONT>&nbsp;</DIV>  <DIV><FONT size=2><STRONG><EM>ImageType::IndexType index;</EM></STRONG></DIV>  <DIV><STRONG><EM>index[0] = 0; index[1] = 0;</EM></STRONG></DIV>  <DIV></FONT><STRONG><EM><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT></EM></STRONG><FONT size=2><STRONG><EM> row, col; </EM></STRONG></DIV>  <DIV><STRONG><EM>row=col=0;</EM></STRONG></DIV>  <DIV><STRONG><EM>ImageType::PixelType max = coeff-&gt;GetPixel(index); </EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>ImageRegionIterator it(coeff, coeff-&gt;GetLargestPossibleRegion()); </EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>while</EM></STRONG></FONT><FONT
 size=2><STRONG><EM>( !it.IsAtEnd() )</EM></STRONG></DIV>  <DIV><STRONG><EM>{</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>&nbsp; if</EM></STRONG></FONT><FONT size=2><STRONG><EM>(it.Get()&gt;max)</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; {</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; max = it.Get();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; index=it.GetIndex();</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; row = index[0];</EM></STRONG></DIV>  <DIV><STRONG><EM>&nbsp; col = index[1];</EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></DIV>  <DIV><STRONG><EM>++it;</EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV><STRONG><EM>shft[0] = - rowa * (row &gt; (</EM></STRONG></FONT><FONT color=#0000ff size=2><STRONG><EM>int</EM></STRONG></FONT><FONT size=2><STRONG><EM>)(rowa/2) ) + row;</EM></STRONG></DIV>  <DIV><STRONG><EM>shft[1] = - cola * (col &gt; (</EM></STRONG></FONT><STRONG><EM><FONT color=#0000ff
 size=2>int</FONT><FONT size=2>)(cola/2)) + col;</FONT></EM></STRONG><FONT size=2><STRONG><EM>}</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>return</EM></STRONG></FONT><FONT size=2><STRONG><EM> shft;</EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></DIV></FONT><FONT color=#0000ff size=2>  <DIV><STRONG><EM>void</EM></STRONG></FONT><FONT size=2><STRONG><EM> ComputeElastogram::calcul_coef( ImageType::Pointer image1, ImageType::Pointer image2) </EM></STRONG></DIV>  <DIV><STRONG><EM>{ </EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>// Forward FFT filter</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>fft1-&gt;SetInput( image1 );</EM></STRONG></DIV>  <DIV><STRONG><EM>fft2-&gt;SetInput( image2 );</EM></STRONG></DIV>  <DIV><STRONG><EM></EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>try</EM></STRONG></FONT><FONT size=2><STRONG><EM>{ ifft-&gt;Update(); }</EM></STRONG></DIV>  <DIV></FONT><FONT
 color=#0000ff size=2><STRONG><EM>catch</EM></STRONG></FONT><FONT size=2><STRONG><EM>(itk::ExceptionObject &amp;e){</EM></STRONG></DIV>  <DIV><STRONG><EM>CString msg;</EM></STRONG></DIV>  <DIV><STRONG><EM>msg.Format("Erreur %s in %s\n", e.GetDescription(), e.GetLocation());</EM></STRONG></DIV>  <DIV></FONT><FONT color=#0000ff size=2><STRONG><EM>return</EM></STRONG></FONT><FONT size=2><STRONG><EM>;</EM></STRONG></DIV>  <DIV><STRONG><EM>}</EM></STRONG></DIV>  <DIV></FONT><FONT color=#008000 size=2><STRONG><EM>// Iterator which traverse the image</EM></STRONG></DIV></FONT><FONT size=2>  <DIV><STRONG><EM>coeff = ifft-&gt;GetOutput();</EM></STRONG></DIV>  <DIV></FONT><FONT size=2><STRONG><EM>}</EM></STRONG></FONT></DIV>  <DIV><FONT size=2><STRONG><EM></EM></STRONG></FONT>&nbsp;</DIV>  <DIV><FONT size=2>Actually, I don't see what is wrong. I tried to release data and so on, but it seems to make any difference. </FONT></DIV>  <DIV><FONT size=2></FONT>&nbsp;</DIV>  <DIV>Please help,</DIV> 
 <DIV>&nbsp;</DIV>  <DIV><FONT size=2>Isabelle</DIV></FONT></DIV>  <div>  <HR SIZE=1>  <B><FONT color=#ff0000>Appel audio GRATUIT</FONT> partout dans le monde</B> avec le nouveau Yahoo! Messenger<BR><A href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez le ici !</A> </FONT></DIV></BLOCKQUOTE></BLOCKQUOTE>  <DIV><BR></DIV><p>
                <hr size=1> 
<b><font color=#FF0000>Appel audio GRATUIT</font> partout dans le monde</b> avec le nouveau Yahoo! Messenger<br> 
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez le ici !</a>