[Insight-users] Use of VectorImageToImageAdaptor with GradientRecursiveGaussianImageFilter

Melanie Uks meluks2010 at googlemail.com
Mon Jul 4 06:14:48 EDT 2011


Hi all,

I try to write my own filter starting with the CompositeFilterExample
(Software Guide). Now I want to use the GradientRecursiveGaussianImageFilter
and extract one component of the vectors with the VectorImageToImageAdaptor.
I have some problems so far:

I get the following error:
    *error C2664: 'itk::ImageAdaptor<TImage,TAccessor>::SetImage' : cannot
convert parameter 1 from 'itk::Image<TPixel,VImageDimension> *' to
'itk::VectorImage<TPixel,VImageDimension> *'*
when I transfer the output of the gradient filter to the adapter:
m_ImageAdaptorFilter->SetImage(m_GradientFilter->GetOutput()
);

If the adaptor is working how do I graft the output?
 * error C2039: 'GraftOutput' : is not a member of
'itk::VectorImageToImageAdaptor<TPixelType,Dimension>'
*
I hope someone can help me!

Thanks a lot!

Melanie


*myEdgeDetectionImageFilter.h:*

...
#include "itkGradientRecursiveGaussianImageFilter.h"
#include "itkVectorImageToImageAdaptor.h"


namespace itk {

template <class TImageType>
class ITK_EXPORT MelEdgeDetectionImageFilter :
    public ImageToImageFilter<TImageType, TImageType>
{
public:

  ...
  /** ImageDimension constant    */
  itkStaticConstMacro(ImageDimension, unsigned int,
                      TImageType::ImageDimension);

    /** Define pixel types. */
  typedef typename TImageType::PixelType PixelType;

  /** Define image type**/
  typedef typename
itk::GradientRecursiveGaussianImageFilter<TImageType>::OutputImageType
VectorImageType;

  itkGetMacro( Sigma, PixelType);
  itkSetMacro( Sigma, PixelType);

protected:

  MelEdgeDetectionImageFilter();

  typedef GradientRecursiveGaussianImageFilter< TImageType >
GradientType;
*  *typedef VectorImageToImageAdaptor< VectorImageType, ImageDimension >
ImageAdaptorType;      * // IS THIS **THE RIGHT DEFINITION?*

  void GenerateData();

private:

  MelEdgeDetectionImageFilter(Self&);   // intentionally not implemented
  void operator=(const Self&);          // intentionally not implemented

  typename GradientType::Pointer     m_GradientFilter;
  typename ImageAdaptorType::Pointer m_ImageAdaptorFilter;

  PixelType m_Sigma;
};

} /* namespace itk */

*myEdgeDetectionImageFilter.txx:*
#include "myEdgeDetectionImageFilter.h"

namespace itk
{

template <class TImageType>
MelEdgeDetectionImageFilter<TImageType>
::MelEdgeDetectionImageFilter()
{
  m_GradientFilter = GradientType::New();
  m_ImageAdaptorFilter = ImageAdaptorType::New();

  m_ImageAdaptorFilter->SetImage(m_GradientFilter->GetOutput() );    *
// **THIS
IS NOT POSSIBLE*
  m_ImageAdaptorFilter->SetExtractComponentIndex(ImageDimension-1);

  m_Sigma = 1;
}

template <class TImageType>
void
MelEdgeDetectionImageFilter<TImageType>::
GenerateData()
{
  m_GradientFilter->SetInput( this->GetInput() );

*   m_ImageAdaptorFilter->GraftOutput( this->GetOutput() );
  m_ImageAdaptorFilter->Update();
  this->GraftOutput( m_ImageAdaptorFilter->GetOutput() );*     * // **THIS
IS NOT POSSIBLE BUT WHAT DO I USE INSTEAD?*
}

...
} /* end namespace itk */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110704/0594a276/attachment.htm>


More information about the Insight-users mailing list