[Insight-users] CannyEdgeDetectionImageFilter GraftOutput() bug?
Karthik Krishnan
Karthik.Krishnan at kitware.com
Wed Nov 9 18:27:18 EST 2005
Thanks. That was a bug. There was no need for the output to be
allocated. Its fixed in CVS.
How were you trying to graft the output ?
thanks
karthik
Quan Chen wrote:
> I was trying to use GraftOutput() to set the output of
> CannyEdgeDetectionImageFilter. However, I find that the image does
> not change. I did same thing for other filters like Sigmoid and
> AnisotropicDiffusion, and they worked well. If I
> use g_OutputImage=cannyFilter->GetOutput(); g_OutputImage->DisconnectPipeline();
> it worked well.
>
> I read the CannyEdgeDetection code for a while. Because I am still
> not familiar with the ITK architecture, I am not sure about my
> findings. But it seems to me that the beginning of the GenerateData()
> function just re-allocate the output buffer:
> template< class TInputImage, class TOutputImage >
> void
> CannyEdgeDetectionImageFilter< TInputImage, TOutputImage >
> ::GenerateData()
> {
> // Need to allocate output buffer
> typename OutputImageType::Pointer output = this->GetOutput();
> output->SetBufferedRegion(output->GetRequestedRegion());
> output->Allocate();
>
>
> And at last line
>
> this->GraftOutput(m_UpdateBuffer);
>
> Sets the output buffer to be m_UpdateBuffer.
> Both m_UpdateBuffer and m_UpdateBuffer1 was allocated in
> AllocateUpdateBuffer():
>
>
> template <class TInputImage, class TOutputImage>
> void
> CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>
> ::AllocateUpdateBuffer()
> {
> // The update buffer looks just like the input.
>
> typename TInputImage::ConstPointer input = this->GetInput();
>
> m_UpdateBuffer->CopyInformation( input );
> m_UpdateBuffer->SetRequestedRegion(input->GetRequestedRegion());
> m_UpdateBuffer->SetBufferedRegion(input->GetBufferedRegion());
> m_UpdateBuffer->Allocate();
>
> m_UpdateBuffer1->CopyInformation( input );
> m_UpdateBuffer1->SetRequestedRegion(input->GetRequestedRegion());
> m_UpdateBuffer1->SetBufferedRegion(input->GetBufferedRegion());
> m_UpdateBuffer1->Allocate();
> }
>
> Can anyone from development team confirm it is sth wrong with the
> code? Or it just I use it incorrectly.
>
>
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list