[Insight-users] What is the pipeline inside the itkGradientMagnitudeRecursiveGaussianImageFilter?

Xiaopeng Yang yxp233 at postech.ac.kr
Mon Dec 17 18:05:14 EST 2012


Hi,

 

Is my question too difficult? Please do me a favor to check my question. Any
idea would be very much appreciated. Or except ITK Software Guide, is there
any other manual which introduces the
itkGradientMagnitudeRecursiveGaussianImageFilter in very detail, including
pipeline and formulas?

 

Thank you so much!

 

Best,

Xiaopeng

 

From: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org]
On Behalf Of Xiaopeng Yang
Sent: Monday, December 17, 2012 9:14 PM
To: insight-users at itk.org; 'Insight Developers'
Subject: [Insight-users] What is the pipeline inside the
itkGradientMagnitudeRecursiveGaussianImageFilter?

 

Dear All,

 

I am trying to look through the
itkGradientMagnitudeRecursiveGaussianImageFilter to figure out the pipeline
of this filter to visualize the computation process of image gradient
calculation from a CT volume dataset using this filter. However, the source
code of this filter makes me confused about the pipeline in this filter due
to my limited programming skill.

 

This filter consists of two major steps as far as I know: 1) image smoothing
using itkRecursiveGaussianImageFilter, and 2) image gradient calculation
using a finite difference method (Does anybody know what formula was used
for the finite difference method? I checked the source code but could not
get it). 

 

For step 1, I wrote a code to get the smoothed image. But I am not sure
whether my code would get the same smoothed image as
itkGradientMagnitudeRecursiveGaussianImageFilter or not. Please check my
code and point out which part I missed or is not correct.  Thank you very
much!

 

// Setup types

  typedef itk::Image< float,  3 >   FloatImageType;

  typedef itk::Image< unsigned char, 3 >   UnsignedCharImageType;

 

  typedef itk::ImageFileReader< FloatImageType >  readerType;

 

  typedef itk::RecursiveGaussianImageFilter<

                  FloatImageType, FloatImageType >  filterType;

 

  // Create and setup a reader

  readerType::Pointer reader = readerType::New();

  reader->SetFileName( "D:/Hybrid Method/Hybrid/LEJ/Diffusion_filter/3D.dcm"
);

 

  // Create and setup a gaussian filter

  filterType::Pointer m_DerivativeFilter = filterType::New();

  m_DerivativeFilter->SetInput( reader->GetOutput() );

  //m_DerivativeFilter->SetDirection(1); // "x" axis

  m_DerivativeFilter->SetFirstOrder();

  m_DerivativeFilter->SetSigma(1.3);

  m_DerivativeFilter->SetNormalizeAcrossScale(true);

  m_DerivativeFilter->ReleaseDataFlagOn();

  

  filterType::Pointer m_SmoothingFilters[2]; 

 

  for( unsigned int i = 0; i< 2; i++ )

  {

          m_SmoothingFilters[ i ] = filterType::New();

          m_SmoothingFilters[ i ]->SetZeroOrder();

          m_SmoothingFilters[ i ]->SetNormalizeAcrossScale( true ); 

          m_SmoothingFilters[ i ]->SetSigma( 1.3 );

  }

 

  m_SmoothingFilters[0]->SetInput( m_DerivativeFilter->GetOutput() );

 

  for( unsigned int i = 1; i< 2; i++ )

  {

          m_SmoothingFilters[ i ]->SetInput(
m_SmoothingFilters[i-1]->GetOutput() );

  }

  

  typedef itk::CastImageFilter< FloatImageType, UnsignedCharImageType >

                                                   CastFilterType;

 

 

  CastFilterType::Pointer caster1 = CastFilterType::New();

 

  caster1->SetInput( m_SmoothingFilters[1]->GetOutput() ); 

  

  typedef  itk::ImageFileWriter<  UnsignedCharImageType  > WriterType;

 

  WriterType::Pointer writer1 = WriterType::New();

 

  writer1->SetFileName( "RecusiveGaussian.dcm" );

 

  writer1->SetInput(caster1->GetOutput());

 

  writer1->Update();

 

 

return EXIT_SUCCESS;

 

Best regards,

Xiaopeng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121218/b7999bf8/attachment.htm>


More information about the Insight-users mailing list