[Insight-users] Problem with: MetricType::Pointer metric = MetricType::New()

motes motes mort.motes at gmail.com
Sat Jun 20 07:20:25 EDT 2009


Correction it does not work from main either. But I just needed to link
against ITKNumerics in my CMakeLists.txt file.

Problem solved.


On Sat, Jun 20, 2009 at 12:11 PM, motes motes <mort.motes at gmail.com> wrote:

> I have this class:
>
> class MyImgReg{
> public:
>
>     static const unsigned int Dimension = 2;
>     typedef float PixelType;
>     typedef itk::Image< PixelType, Dimension > FixedImageType;
>     typedef itk::Image< PixelType, Dimension > MovingImageType;
>     typedef itk::TranslationTransform< double, Dimension > TransformType;
>     typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
>     typedef itk::MeanSquaresImageToImageMetric< FixedImageType,
> MovingImageType > MetricType;
>     typedef itk:: LinearInterpolateImageFunction< MovingImageType, double >
> InterpolatorType;
>     typedef itk::ImageRegistrationMethod<FixedImageType, MovingImageType >
> RegistrationType;
>
>     void setupComponents(){
>         MetricType::Pointer metric = MetricType::New();
>
>     }
> };
>
> I call it from main:
>
> int main( int argc, char* argv[] ){
>     MyImgReg reg;
>     reg.setupComponents();
>    return 0;
> }
>
> But get the error:
>
> error LNK2001: unresolved external symbol "protected: virtual void
> __thiscall itk::CostFunction::PrintSelf(class std::basic_ostream<char,struct
> std::char_traits<char> > &,class itk::Indent)const "
> (?PrintSelf at CostFunction@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D
> @std@@@std@@VIndent at 2@@Z)
>
> Using Visual Studio 2008.
>
> I works fine if I just have everything in the main function, but I prefer
> to split things up in smaller chunks, any ideas?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090620/a080d2a1/attachment.htm>


More information about the Insight-users mailing list