<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I implemented a function to <STRONG>compute the envelop</STRONG> of my raw image <STRONG>imageInitiale</STRONG>. This works fine:</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>void ComputeSignalAnalytic()<BR>{<BR>&nbsp; //Declarations<BR>&nbsp; WorkImageType::RegionType region = imageInitiale-&gt;GetBufferedRegion();&nbsp; </STRONG></DIV>
<DIV><STRONG>&nbsp; enveloppeImage-&gt;SetRegions(region);<BR>&nbsp; enveloppeImage-&gt;SetSpacing(imageInitiale-&gt;GetSpacing());<BR>&nbsp; enveloppeImage-&gt;SetOrigin( imageInitiale-&gt;GetOrigin());<BR>&nbsp; enveloppeImage-&gt;Allocate();</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp; typedef itk::ImageRegionConstIterator&lt;ImageType3D&gt; ConstIteratorType;<BR>&nbsp; ConstIteratorType inputIt(imageInitiale, region);</STRONG></DIV>
<DIV><STRONG>&nbsp; IteratorType outputIt(enveloppeImage, region);</STRONG></DIV>
<DIV><STRONG>&nbsp; inputIt.GoToBegin();<BR>&nbsp; outputIt.GoToBegin();</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp; int i;<BR>&nbsp; int nn =nextpow2(width);<BR>&nbsp; float* VectImgR = (float*)malloc(nn*sizeof(float));<BR>&nbsp; float* VectImgI = (float*)malloc(nn*sizeof(float));<BR>&nbsp;<BR>&nbsp; while(!inputIt.IsAtEnd())<BR>&nbsp; {</STRONG></DIV>
<DIV><BR><STRONG>&nbsp;for(i=0;i&lt;nn;i++) VectImgI[i] = VectImgR[i] = 0.0;</STRONG></DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp; for(i=0;i&lt;width;i++) <BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;VectImgR[i] = (float)inputIt.Get(); <BR>&nbsp;&nbsp;++inputIt;<BR>&nbsp;&nbsp;&nbsp; }</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp;hilbert(VectImgR,VectImgI,nn);//Hilbert</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp;for(i=0;i&lt;width;i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;outputIt.Set(sqrt( SQUARE(VectImgR[i])+SQUARE(VectImgI[i]) ));<BR>&nbsp;&nbsp;++outputIt;<BR>&nbsp;}</STRONG></DIV>
<DIV><BR><STRONG>&nbsp; }&nbsp; &nbsp;</STRONG></DIV>
<DIV><STRONG>&nbsp; free(VectImgR);<BR>&nbsp; free(VectImgI);<BR>} </STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>This is called like this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV><STRONG>ImageType3D::ConstPointer imageInitiale&nbsp; = reader-&gt;GetOutput();<BR>WorkImageType::Pointer enveloppeImage;</STRONG></DIV></DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</STRONG></DIV>
<DIV><STRONG>ComputeSignalAnalytic();</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>But for now, I'm triing to compute the envelop of my image in a filter instead. I'm doing exactly the same thing but in a filter: </DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>template&lt;class TInputImage, class TOutputImage&gt;<BR>void<BR>EnvelopImageFilter&lt;TInputImage, TOutputImage&gt;<BR>::GenerateInputRequestedRegion()<BR>{<BR>&nbsp; Superclass::GenerateInputRequestedRegion();<BR>&nbsp; if ( this-&gt;GetInput() )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; InputImagePointer image =<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const_cast&lt; typename Superclass::InputImageType * &gt;( this-&gt;GetInput() );<BR>&nbsp;&nbsp;&nbsp; image-&gt;SetRequestedRegionToLargestPossibleRegion();<BR>&nbsp;&nbsp;&nbsp; }<BR>}</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>template&lt;class TInputImage, class TOutputImage&gt;<BR>void<BR>EnvelopImageFilter&lt;TInputImage, TOutputImage&gt;<BR>::EnlargeOutputRequestedRegion(DataObject *data)<BR>{<BR>&nbsp; Superclass::EnlargeOutputRequestedRegion(data);<BR>&nbsp; data-&gt;SetRequestedRegionToLargestPossibleRegion();<BR>}</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>template&lt;class TInputImage, class TOutputImage&gt;<BR>void<BR>EnvelopImageFilter&lt;TInputImage, TOutputImage&gt;<BR>::GenerateData()<BR>{<BR>&nbsp; typedef TInputImage&nbsp; InputImageType;<BR>&nbsp; typedef TOutputImage OutputImageType;</STRONG></DIV>
<DIV><STRONG>&nbsp; typename InputImageType::ConstPointer input = this-&gt;GetInput();<BR>&nbsp; typename OutputImageType::Pointer output = this-&gt;GetOutput();</STRONG></DIV>
<DIV><STRONG>&nbsp; typedef typename InputImageType::PixelType InputPixelType;<BR>&nbsp; typedef typename OutputImageType::PixelType OutputPixelType;<BR>&nbsp; <BR>&nbsp; // Allocate the output<BR>&nbsp; this-&gt;AllocateOutputs();</STRONG></DIV>
<DIV><STRONG>&nbsp; // Iterator which traverse the input<BR>&nbsp; ImageRegionConstIterator&lt;InputImageType&gt; itInput(input, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input-&gt;GetRequestedRegion());</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp; unsigned int i;<BR>&nbsp; int width = input-&gt;GetRequestedRegion().GetSize()[0]; <BR>&nbsp; int nn =nextpow2(width);<BR>&nbsp; float* VectImgR = (float*)malloc(nn*sizeof(float));<BR>&nbsp; float* VectImgI = (float*)malloc(nn*sizeof(float)); </STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp; // iterator for the output<BR>&nbsp;&nbsp; ImageRegionIterator&lt;OutputImageType&gt; itOut(output, output-&gt;GetRequestedRegion());</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp;&nbsp; ProgressReporter progress(this,0,output-&gt;GetRequestedRegion().GetNumberOfPixels());</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp; itInput.GoToBegin();<BR>&nbsp; itOut.GoToBegin();<BR>&nbsp; while ( ! itInput.IsAtEnd() )<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; for(i=0;i&lt;nn;i++) VectImgI[i] = VectImgR[i] = 0.0;</STRONG></DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp; for(i=0;i&lt;width;i++) <BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; &nbsp;VectImgR[i] = static_cast&lt;float&gt;(itInput.Get());<BR>&nbsp;&nbsp;++ itInput;<BR>&nbsp;&nbsp;&nbsp; }</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp; hilbert(VectImgR,VectImgI,nn);//Hilbert</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp; for(i=0;i&lt;width;i++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itOut.Set((OutputPixelType)( SQUARE(VectImgR[i])+SQUARE(VectImgI[i]) ));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++itOut;<BR>&nbsp;&nbsp;&nbsp; progress.CompletedPixel();<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }&nbsp; <BR>&nbsp; <BR>&nbsp; free(VectImgR);<BR>&nbsp; free(VectImgI); &nbsp;<BR>}</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>Exactly the same code is done&nbsp;in my function GenerateData(). However,&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>envelopFilter-&gt;SetInput(imageInitiale);<BR>envelopFilter-&gt;Update();<BR>enveloppeImage = envelopFilter-&gt;GetOutput();&nbsp;</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>doesn't produce the same result.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Could anyone tell me why? </DIV>
<DIV>&nbsp;</DIV>
<DIV>Please help me to handle it,</DIV>
<DIV>&nbsp;</DIV>
<DIV>isabelle</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>