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