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