<br clear="all"><b>hello all,<br><br>I'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't 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 "itkRGBPixel.h"<br>
#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkResampleImageFilter.h"<br>#include "itkIdentityTransform.h"<br>
#include "itkLinearInterpolateImageFunction.h"<br><br><br>int main( int argc , char ** argv[])<br>{<br> <br> typedef itk::RGBPixel<unsigned char> PixelType;<br> typedef itk::Image< PixelType, 2 > ImageType;<br>
<br> typedef itk::ImageFileReader< ImageType > ImageReaderType;<br> ImageReaderType::Pointer ImageReader = ImageReaderType::New();<br> ImageReader->SetFileName("Things_new.jpg");<br> ImageReader->Update(); <br>
ImageType::Pointer image=ImageReader->GetOutput();<br> <br> typedef itk:: ResampleImageFilter <ImageType> FilterType;<br> FilterType::Pointer resampler = FilterType::New();<br><br> ImageType::SizeType size;<br>
size[0] = 200;<br> size[1] = 300;<br><br> ImageType::IndexType start;<br> start[0]=0;<br> start[1]=0;<br><br> <br> ImageType::PointType origin;<br> origin[0]=10.0;<br> origin[1]=25.5;<br><br> <br> ImageType::SpacingType spacing;<br>
spacing[0]=2.0;<br> spacing[1]=1.5;<br><br> resampler ->SetOutputSpacing(spacing);<br> resampler ->SetOutputOrigin(origin);<br> <br> resampler ->SetSize(size);<br> resampler ->SetOutputStartIndex(start);<br>
<br> resampler ->SetDefaultPixelValue( 100);<br><br> resampler ->SetInput(image);<br><br> typedef itk::LinearInterpolateImageFunction <ImageType, double> InterpolatorType;<br> InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>
<br> typedef itk::TranslationTransform <double,2> TransformType; <br> TransformType::Pointer transform=TransformType::New();<br><br> transform ->SetIdentity();<br><br> resampler ->SetInterpolator(interpolator);<br>
resampler ->SetTransform(transform);<br><br> resampler ->Update();<br><br> typedef unsigned char OutputPixelType;<br> typedef itk::Image< OutputPixelType, 2> OutputImageType;<br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br>
<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetFileName( "ImageResampled" );<br> writer->SetInput(resampler->GetOutput()); <br> writer->Update();<br><br> return EXIT_SUCCESS;<br>
}<br><b><br>and these are the generated errors :</b><br><br>1>Compiling...<br>1>ResamplingRGB.cxx<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(26) : error C2976: 'itk::ResampleImageFilter' : too few template arguments<br>
1> w:\registration_review\src\insighttoolkit\code\basicfilters\itkResampleImageFilter.h(79) : see declaration of 'itk::ResampleImageFilter'<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(27) : error C2955: 'itk::ResampleImageFilter' : use of class template requires template argument list<br>
1> w:\registration_review\src\insighttoolkit\code\basicfilters\itkResampleImageFilter.h(79) : see declaration of 'itk::ResampleImageFilter'<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(27) : error C2955: 'itk::ResampleImageFilter' : use of class template requires template argument list<br>
1> w:\registration_review\src\insighttoolkit\code\basicfilters\itkResampleImageFilter.h(79) : see declaration of 'itk::ResampleImageFilter'<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(27) : error C2514: 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' : class has no constructors<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(47) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(47) : error C2039: 'SetOutputSpacing' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(48) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(48) : error C2039: 'SetOutputOrigin' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(50) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(50) : error C2039: 'SetSize' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(51) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(51) : error C2039: 'SetOutputStartIndex' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(53) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(53) : error C2039: 'SetDefaultPixelValue' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(55) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(55) : error C2039: 'SetInput' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(60) : error C2039: 'TranslationTransform' : is not a member of 'itk'<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(60) : error C2143: syntax error : missing ';' before '<'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2653: 'TransformType' : is not a class or namespace name<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2065: 'Pointer' : undeclared identifier<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2146: syntax error : missing ';' before identifier 'transform'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2065: 'transform' : undeclared identifier<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C2653: 'TransformType' : is not a class or namespace name<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(61) : error C3861: 'New': identifier not found<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(63) : error C2227: left of '->SetIdentity' must point to class/struct/union/generic type<br>
1> type is ''unknown-type''<br>1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(65) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(65) : error C2039: 'SetInterpolator' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(66) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(66) : error C2039: 'SetTransform' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(68) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(68) : error C2039: 'Update' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(76) : error C2678: binary '->' : no operator found which takes a left-hand operand of type 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>' (or there is no acceptable conversion)<br>
1> w:\registration_review\src\insighttoolkit\code\common\itkSmartPointer.h(70): could be 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const'<br>1> while trying to match the argument list '(itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>)'<br>
1>..\..\src\ResamplingRGB\ResamplingRGB.cxx(76) : error C2039: 'GetOutput' : is not a member of 'itk::SmartPointer<itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType>>'<br>
1>Build log was saved at "file://w:\Registration_Review\bin\ResamplingRGB\ResamplingRGB.dir\Debug\BuildLog.htm"<br>1>ResamplingRGB - 34 error(s), 0 warning(s)<br>2>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------<br>
2>"Build all projects"<br>2>Build log was saved at "file://w:\Registration_Review\bin\ResamplingRGB\ALL_BUILD.dir\Debug\BuildLog.htm"<br>2>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>