<br clear="all"><b>hello all,<br><br>I&#39;m
trying to do a resampling of an RGB image and I have a question about if <br>I should take into account additional parameters to define the
template, because this image isn&#39;t&nbsp; an image of one band.<br>This is the code that I implemented:<br></b><br>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif<br><br>#include &quot;itkRGBPixel.h&quot;<br>
#include &quot;itkImage.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br>#include &quot;itkResampleImageFilter.h&quot;<br>#include &quot;itkIdentityTransform.h&quot;<br>
#include &quot;itkLinearInterpolateImageFunction.h&quot;<br><br><br>int main( int argc , char ** argv[])<br>{<br>&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp; typedef itk::RGBPixel&lt;unsigned char&gt;&nbsp; PixelType;<br>&nbsp; typedef itk::Image&lt; PixelType, 2 &gt; ImageType;<br>
&nbsp; <br>&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt;&nbsp; ImageReaderType;<br>&nbsp; ImageReaderType::Pointer&nbsp; ImageReader = ImageReaderType::New();<br>&nbsp; ImageReader-&gt;SetFileName(&quot;Things_new.jpg&quot;);<br>&nbsp; ImageReader-&gt;Update(); <br>
&nbsp; ImageType::Pointer image=ImageReader-&gt;GetOutput();<br>&nbsp; <br>&nbsp; typedef itk:: ResampleImageFilter &lt;ImageType&gt; FilterType;<br>&nbsp; FilterType::Pointer resampler = FilterType::New();<br><br>&nbsp; ImageType::SizeType size;<br>
&nbsp; size[0] = 200;<br>&nbsp; size[1] = 300;<br><br>&nbsp; ImageType::IndexType start;<br>&nbsp; start[0]=0;<br>&nbsp; start[1]=0;<br><br>&nbsp;<br>&nbsp; ImageType::PointType origin;<br>&nbsp; origin[0]=10.0;<br>&nbsp; origin[1]=25.5;<br><br>&nbsp;<br>&nbsp; ImageType::SpacingType spacing;<br>
&nbsp; spacing[0]=2.0;<br>&nbsp; spacing[1]=1.5;<br><br>&nbsp; resampler -&gt;SetOutputSpacing(spacing);<br>&nbsp; resampler -&gt;SetOutputOrigin(origin);<br>&nbsp; <br>&nbsp; resampler -&gt;SetSize(size);<br>&nbsp; resampler -&gt;SetOutputStartIndex(start);<br>
<br>&nbsp; resampler -&gt;SetDefaultPixelValue( 100);<br><br>&nbsp; resampler -&gt;SetInput(image);<br><br>&nbsp; typedef itk::LinearInterpolateImageFunction &lt;ImageType, double&gt; InterpolatorType;<br>&nbsp; InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>
&nbsp; <br>&nbsp; typedef itk::TranslationTransform &lt;double,2&gt; TransformType; <br>&nbsp; TransformType::Pointer transform=TransformType::New();<br><br>&nbsp; transform -&gt;SetIdentity();<br><br>&nbsp; resampler -&gt;SetInterpolator(interpolator);<br>
&nbsp; resampler -&gt;SetTransform(transform);<br><br>&nbsp; resampler -&gt;Update();<br><br>&nbsp; typedef unsigned char OutputPixelType;<br>&nbsp; typedef itk::Image&lt; OutputPixelType, 2&gt; OutputImageType;<br>&nbsp; typedef itk::ImageFileWriter&lt; OutputImageType &gt;&nbsp; WriterType;<br>
<br>&nbsp; WriterType::Pointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer =&nbsp; WriterType::New();<br>&nbsp; writer-&gt;SetFileName( &quot;ImageResampled&quot; );<br>&nbsp; writer-&gt;SetInput(resampler-&gt;GetOutput());&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; writer-&gt;Update();<br><br>&nbsp;return EXIT_SUCCESS;<br>
}<br><b><br>and these are the generated errors :</b><br><br>1&gt;Compiling...<br>1&gt;ResamplingRGB.cxx<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(26) : error C2976: &#39;itk::ResampleImageFilter&#39; : too few template arguments<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\basicfilters\itkResampleImageFilter.h(79) : see declaration of &#39;itk::ResampleImageFilter&#39;<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(27) : error C2955: &#39;itk::ResampleImageFilter&#39; : use of class template requires template argument list<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\basicfilters\itkResampleImageFilter.h(79) : see declaration of &#39;itk::ResampleImageFilter&#39;<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(27) : error C2955: &#39;itk::ResampleImageFilter&#39; : use of class template requires template argument list<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\basicfilters\itkResampleImageFilter.h(79) : see declaration of &#39;itk::ResampleImageFilter&#39;<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(27) : error C2514: &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; : class has no constructors<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(47) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(47) : error C2039: &#39;SetOutputSpacing&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(48) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(48) : error C2039: &#39;SetOutputOrigin&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(50) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(50) : error C2039: &#39;SetSize&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(51) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(51) : error C2039: &#39;SetOutputStartIndex&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(53) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(53) : error C2039: &#39;SetDefaultPixelValue&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(55) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(55) : error C2039: &#39;SetInput&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(60) : error C2039: &#39;TranslationTransform&#39; : is not a member of &#39;itk&#39;<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(60) : error C2143: syntax error : missing &#39;;&#39; before &#39;&lt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2653: &#39;TransformType&#39; : is not a class or namespace name<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2065: &#39;Pointer&#39; : undeclared identifier<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2146: syntax error : missing &#39;;&#39; before identifier &#39;transform&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2065: &#39;transform&#39; : undeclared identifier<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2653: &#39;TransformType&#39; : is not a class or namespace name<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C3861: &#39;New&#39;: identifier not found<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(63) : error C2227: left of &#39;-&gt;SetIdentity&#39; must point to class/struct/union/generic type<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type is &#39;&#39;unknown-type&#39;&#39;<br>1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(65) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(65) : error C2039: &#39;SetInterpolator&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(66) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(66) : error C2039: &#39;SetTransform&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(68) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(68) : error C2039: &#39;Update&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(76) : error C2678: binary &#39;-&gt;&#39; : no operator found which takes a left-hand operand of type &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39; (or there is no acceptable conversion)<br>
1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be &#39;TObjectType *itk::SmartPointer&lt;TObjectType&gt;::operator -&gt;(void) const&#39;<br>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while trying to match the argument list &#39;(itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;)&#39;<br>
1&gt;..\..\src\ResamplingRGB\ResamplingRGB.cxx(76) : error C2039: &#39;GetOutput&#39; : is not a member of &#39;itk::SmartPointer&lt;itk::ResampleImageFilter&lt;TInputImage,TOutputImage,TInterpolatorPrecisionType&gt;&gt;&#39;<br>
1&gt;Build log was saved at &quot;file://w:\Registration_Review\bin\ResamplingRGB\ResamplingRGB.dir\Debug\BuildLog.htm&quot;<br>1&gt;ResamplingRGB - 34 error(s), 0 warning(s)<br>2&gt;------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------<br>
2&gt;&quot;Build all projects&quot;<br>2&gt;Build log was saved at &quot;file://w:\Registration_Review\bin\ResamplingRGB\ALL_BUILD.dir\Debug\BuildLog.htm&quot;<br>2&gt;ALL_BUILD - 0 error(s), 0 warning(s)<br>========== Build: 1 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========<br>
<br><b>Thanks for the help that you can give me.</b><br><br>-- <br><br>Leidy Paola Dorado-Muņoz<br>Graduate Student<br>