Hi Robert,<br><br>thanks for your help. By following your instructions I received some errors:<br><br>warning C4346: &#39;itk::GradientRecursiveGaussianImageFilter&lt;TImageType&gt;::OutputImageType&#39; : dependent name is not a type<br>
1&gt;        prefix with &#39;typename&#39; to indicate a type<br>1&gt;        ...\myEdgeDetectionImageFilter.h(80) : see reference to class template instantiation &#39;itk::MelEdgeDetectionImageFilter&lt;TImageType&gt;&#39; being compiled<br>
1&gt;...\myEdgeDetectionImageFilter.h(61) : error C2923: &#39;itk::GradientToMagnitudeImageFilter&#39; : &#39;itk::GradientRecursiveGaussianImageFilter&lt;TImageType&gt;::OutputImageType&#39; is not a valid template type argument for parameter &#39;TInputImage&#39;<br>
<br>therefore I was defining<br><br>   <b> typedef typename itk::GradientRecursiveGaussianImageFilter&lt;TImageType&gt;::OutputImageType VectorImageType;<br></b><br>and replacing<br><br>  <i>  typedef GradientToMagnitudeImageFilter&lt; GradientType::OutputImageType, TImageType &gt; MagnitudeType;</i><br>
<div><br>with<br></div><br>     <b>typedef GradientToMagnitudeImageFilter&lt; VectorImageType, TImageType &gt; MagnitudeType;<br></b><br>Now it is working!<br><br>Thanks a lot!<br><br>melanie<br><br><br><br><div class="gmail_quote">
2011/6/21 robert tamburo <span dir="ltr">&lt;<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Melanie,<div><br></div><div>GradientRecursiveGaussianImageFilter  expects an output image type. You are giving it an output pixel type. You can &#39;cheat&#39; and use the default template parameter by </div><div><br></div>

<div>Replacing<div class="im"><br><div>  typedef GradientRecursiveGaussianImageFilter&lt; TImageType, VectorPixelType &gt;    GradientType;<br>  typedef GradientToMagnitudeImageFilter&lt; VectorPixelType, TImageType &gt; MagnitudeType;</div>

<div><br></div></div><div>by</div><div><br></div><div>  typedef GradientRecursiveGaussianImageFilter&lt; TImageType &gt;    GradientType;<br>  typedef GradientToMagnitudeImageFilter&lt; GradientType::OutputImageType, TImageType &gt; MagnitudeType;</div>

<div><b><br></b></div><div>and consequently removing ComponentType and VectorPixelType.</div><div><br></div><div><b><br></b></div><div><div class="gmail_quote"><div><div></div><div class="h5">On Tue, Jun 21, 2011 at 10:51 AM, Melanie Uks <span dir="ltr">&lt;<a href="mailto:meluks2010@googlemail.com" target="_blank">meluks2010@googlemail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">Hi all,<br><br>I try to write my own filter starting with the CompositeFilterExample (Software Guide). I could run the example filter and then I wanted to modify the filter by removing the GaussianFilter and adding a GradientRecursiveGaussianImageFilter and a GradientToMagnitudeImageFilter. I was not able to run the code again. I guess I made a mistake with the component vector type. The errors (more than 50 :-( ) do not help to solve the problem.<br>


Maybe one of you finds the problem. I highlight the code I changed:<br><br>------------------------------------------------------------------------------<br><br>#ifndef __myEdgeDetectionImageFilter_h<br>#define __myEdgeDetectionImageFilter_h<br>


<br>#include &quot;itkImageToImageFilter.h&quot;<br><b>#include &quot;itkGradientRecursiveGaussianImageFilter.h&quot; <br>#include &quot;itkGradientToMagnitudeImageFilter.h&quot; </b>   <br>#include &quot;itkThresholdImageFilter.h&quot;<br>


#include &quot;itkRescaleIntensityImageFilter.h&quot;<br><br><b>#include &quot;itkCovariantVector.h&quot;</b><br>#include &quot;itkNumericTraits.h&quot;<br><br><br>namespace itk {<br><br>template &lt;class TImageType&gt;<br>


class ITK_EXPORT MelEdgeDetectionImageFilter :<br>    public ImageToImageFilter&lt;TImageType, TImageType&gt;<br>{<br>public:<br><br>  typedef MelEdgeDetectionImageFilter               Self;<br>  typedef ImageToImageFilter&lt;TImageType,TImageType&gt; Superclass;<br>


  typedef SmartPointer&lt;Self&gt;                        Pointer;<br>  typedef SmartPointer&lt;const Self&gt;                  ConstPointer;<br><br>  /** Method for creation through object factory */<br>  itkNewMacro(Self);<br>


<br>  /** Run-time type information */<br>  itkTypeMacro(MelEdgeDetectionImageFilter, ImageToImageFilter);<br><br>  /** Display */<br>  void PrintSelf( std::ostream&amp; os, Indent indent ) const;<br><br>  /** ImageDimension constant    */<br>


  itkStaticConstMacro(ImageDimension, unsigned int,<br>                      TImageType::ImageDimension);<br><br>    /** Define pixel types. */<br>  typedef typename TImageType::PixelType PixelType;<br> <b> typedef typename float   ComponentType;<br>


  typedef typename itk::CovariantVector&lt; ComponentType, <br>                        ImageDimension  &gt;      VectorPixelType;</b><br>  <br><br>  itkGetMacro( Threshold, PixelType);<br>  itkSetMacro( Threshold, PixelType);<br>


<br><b>  itkGetMacro( Sigma, PixelType);<br>  itkSetMacro( Sigma, PixelType);</b><br><br>protected:<br><br>  MelEdgeDetectionImageFilter();<br><br>protected:<br><br>  typedef ThresholdImageFilter&lt; TImageType &gt;     ThresholdType;<br>


 <b> typedef GradientRecursiveGaussianImageFilter&lt; TImageType, VectorPixelType &gt;    GradientType;<br>  typedef GradientToMagnitudeImageFilter&lt; VectorPixelType, TImageType &gt; MagnitudeType;</b><br>  typedef RescaleIntensityImageFilter&lt; TImageType, TImageType &gt;  RescalerType;<br>


<br>  void GenerateData();<br><br>private:<br><br>  MelEdgeDetectionImageFilter(Self&amp;);   // intentionally not implemented<br>  void operator=(const Self&amp;);          // intentionally not implemented<br><br><br><b>  typename GradientType::Pointer     m_GradientFilter;<br>


  typename MagnitudeType::Pointer    m_MagnitudeFilter;</b><br>  typename ThresholdType::Pointer    m_ThresholdFilter;<br>  typename RescalerType::Pointer     m_RescaleFilter;<br><br>  PixelType m_Threshold;<br><br> <b> PixelType m_Sigma;</b><br>


};<br><br>} /* namespace itk */<br><br>#ifndef ITK_MANUAL_INSTANTIATION<br>#include &quot;myEdgeDetectionImageFilter.txx&quot;<br>#endif<br><br>#endif<br><br><br>
------------------------------------------------------------------------------<br><br>#ifndef __myEdgeDetectionImageFilter_txx<br>#define __myEdgeDetectionImageFilter_txx<br><br>#include &quot;myEdgeDetectionImageFilter.h&quot;<br>


<br>namespace itk <br>{<br><br>template &lt;class TImageType&gt;<br>MelEdgeDetectionImageFilter&lt;TImageType&gt;<br>::MelEdgeDetectionImageFilter()<br>{<br>  <b>m_GradientFilter = GradientType::New();<br>  m_MagnitudeFilter = MagnitudeType::New();</b><br>


  m_ThresholdFilter = ThresholdType::New();<br>  m_RescaleFilter = RescalerType::New();<br><br> <b> m_MagnitudeFilter-&gt;SetInput(m_GradientFilter-&gt;GetOutput() );<br>  m_ThresholdFilter-&gt;SetInput( m_MagnitudeFilter-&gt;GetOutput() );</b><br>


  m_RescaleFilter-&gt;SetInput( m_ThresholdFilter-&gt;GetOutput() );<br><br>  m_Threshold = 1;<br> <b> m_Sigma = 1;</b><br><br>  m_RescaleFilter-&gt;SetOutputMinimum(<b>NumericTraits&lt;PixelType&gt;::Zero</b>);<br>  m_RescaleFilter-&gt;SetOutputMaximum(NumericTraits&lt;PixelType&gt;::max());<br>


}<br><br>template &lt;class TImageType&gt;<br>void<br>MelEdgeDetectionImageFilter&lt;TImageType&gt;::<br>GenerateData()<br>{<br> <b> m_GradientFilter-&gt;SetInput( this-&gt;GetInput() );</b><br><br>  m_ThresholdFilter-&gt;ThresholdBelow( this-&gt;m_Threshold );<br>


<br>  m_RescaleFilter-&gt;GraftOutput( this-&gt;GetOutput() );<br>  m_RescaleFilter-&gt;Update();<br>  this-&gt;GraftOutput( m_RescaleFilter-&gt;GetOutput() );<br>}<br><br>template &lt;class TImageType&gt;<br>void<br>MelEdgeDetectionImageFilter&lt;TImageType&gt;::<br>


PrintSelf( std::ostream&amp; os, Indent indent ) const<br>{<br>  Superclass::PrintSelf(os,indent);<br><br>  os<br>    &lt;&lt; indent &lt;&lt; &quot;Threshold:&quot; &lt;&lt; this-&gt;m_Threshold<br>    &lt;&lt; std::endl;<br>


<b>  os<br>    &lt;&lt; indent &lt;&lt; &quot;Sigma:&quot; &lt;&lt; this-&gt;m_Sigma<br>    &lt;&lt; std::endl;</b><br>}<br><br>} /* end namespace itk */<br><br>#endif<br><br><br>Thanks a lot for your help!<br><br>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br>