[Insight-users] CannyEdgeDetectionImageFilter GraftOutput() bug?

Karthik Krishnan Karthik.Krishnan at kitware.com
Wed Nov 16 14:31:49 EST 2005


Please update your CVS and let us know if  the fix works fine.

Thanks
karthik

Quan Chen wrote:

>Oh, another thing, is the last line in GenerateData() ok?
>this->GraftOutput(m_UpdateBuffer);
>
>It looks like the filter will use the m_UpdateBuffer as the output Buffer
>instead of the default one (which I attempt to graft).  I was trying to use
>this:
>typename OutputImageType::Pointer output = this->GetOutput(); at the start
>of the GenerateData()
>And then 
>   m_UpdateBuffer=output;
>  //Then do the double threshoulding upon the edge reponses
>  this->HysteresisThresholding();
>  
>  this->GraftOutput(m_UpdateBuffer); 
>
>Is that ok?
>
>-----Original Message-----
>From: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com] 
>Sent: Wednesday, November 09, 2005 5:27 PM
>To: Quan Chen
>Cc: insight-users at itk.org; Luis Ibanez
>Subject: Re: [Insight-users] CannyEdgeDetectionImageFilter GraftOutput()
>bug?
>
>
>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