[Insight-developers] Combining CompositeFilterExample and CannyEdgeDetectionImageFilter

Shlomo Kashani. shlomo_kashani at yahoo.com
Sun Jul 2 09:23:36 EDT 2006


Hi,
   
  I am writing a composite filter based amongst others on the CompositeFilterExample, the CannyEdgeDetectionImageFilter.cxx (which is based On 3 other filters) and several more filters which I havent written yet. I sucessfuly used the example CompositeFilterExample to convert CannyEdgeDetectionImageFilter to a composite 
  filter in which the sequential filtering operation is done in the GenerateData() methood. Even though the filtering operation works well, I have a problem understanding the pipeline operation in the CompositeFilterExample class. The constructor sets up a pipeline as follows:
   
  template <class TImageType>
  CompositeIrisRecognitionFilter<TImageType>
  ::CompositeIrisRecognitionFilter()
  {  
    m_CastToRealFilter = CastToRealFilter::New();
    m_CannyFilter = CannyFilter::New();
    m_RescaleFilter = RescaleFilter::New();    
    
    // Set up the pipeline, this is MY code based exactly on CompositeFilterExample
    m_CannyFilter->SetInput( m_CastToRealFilter->GetOutput() );
    // Set the variance for the Gaussian smoothing filter
    m_CannyFilter->SetVariance(m_GaussianVariance);
    m_RescaleFilter->SetInput( m_CannyFilter->GetOutput() );                
              
    //  Default variance for the canny edge detector, tested on 
    //  the UPOL iris image database
    m_GaussianVariance=50.0;
  }
   
  And the GenerateData() methood executes the pipeline as folows: 
   
  template <class TImageType>
  void
  CompositeIrisRecognitionFilter<TImageType>::
  GenerateData()
  {
    //  The output of an edge filter is 0 or 1
    m_RescaleFilter->SetOutputMinimum(   0 );
    m_RescaleFilter->SetOutputMaximum( 255 );
   
    // Run the pipeline
    m_CastToRealFilter->SetInput( this->GetInput() );
    m_RescaleFilter->GraftOutput( this->GetOutput() );
    m_RescaleFilter->Update();
    this->GraftOutput( m_RescaleFilter->GetOutput() );                                 
  }
   
  My questions are: 
  1-why are the pipeline set up and pipeline executions placed in two different methods? I placed both in the GenerateData methood And as expected it was still working. Is there an architectual advantage to the seperation of  operations? I think it adds confusion and breaks the logic sequential order of operations
  2-How does GraftOutput work exactly, why do I have to use it twice in this case? 
  3-is the invocation of the methood this->GetInput() equivalent to reader->GetOutput() in a non Composite filter (e.g one that does everything in the main methhod)? 
   
  Thank you very much for your help,
   
  Shlomo.

 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20060702/3cc53414/attachment.html


More information about the Insight-developers mailing list