[Insight-users] Re: make problem
Burak Özkalaycı
bozkalayci at gmail.com
Wed Oct 10 06:47:34 EDT 2007
I figured out that to have a working segmentationLevelSetFunction I
have to implement the CalculateSpeedImage in a subclass. That's why I
changed my code a little bit and I attach it with the make error log.
Thanks again
Burak
Revised code
===============================
// file name : tpls_main.cpp
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#ifdef __BORLANDC__
#define ITK_LEAN_AND_MEAN
#endif
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkSegmentationLevelSetFunction.h"
template <class TImageType, class TFeatureImageType>
class myLevelSetFunction:itk::SegmentationLevelSetFunction<TImageType,
TFeatureImageType>
{
void CalculateSpeedImage()
{
this->SetSpeedImage(this->GetFeatureImage);
}
};
int main( int argc, char *argv[] )
{
// Input Image
typedef float InputPixelType;
const unsigned int Dimension = 3;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
// Internal Image
typedef float InternalPixelType;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
// Output Image
typedef float OutputPixelType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef itk::ImageFileReader< InternalImageType > ReaderType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
// Read write initialization
ReaderType::Pointer reader1 = ReaderType::New();
ReaderType::Pointer reader2 = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader1->SetFileName( argv[1] );
reader2->SetFileName( argv[2] );
writer->SetFileName( argv[3] );
// MAIN ALGORITHM CAN START HERE !!
typedef myLevelSetFunction<InternalImageType, InternalImageType>
LSFunctionType;
LSFunctionType::Pointer LS_function = LSFunctionType::New();
return 0;
}
===============================
the make error log:
===============================
make
Scanning dependencies of target tpls_main
[100%] Building CXX object CMakeFiles/tpls_main.dir/tpls_main.o
/home/xonobo/itk/InsightToolkit-3.2.0/Code/Common/itkSegmentationLevelSetFunction.h:
In function 'int main(int, char**)':
/home/xonobo/itk/InsightToolkit-3.2.0/Code/Common/itkSegmentationLevelSetFunction.h:52:
error: 'typedef class
itk::SmartPointer<itk::SegmentationLevelSetFunction<itk::Image<float,
3u>, itk::Image<float, 3u> > >
itk::SegmentationLevelSetFunction<itk::Image<float, 3u>,
itk::Image<float, 3u> >::Pointer' is inaccessible
/home/xonobo/CPP/itk_based/itkTPLS/tpls_main.cpp:80: error: within this context
/home/xonobo/itk/InsightToolkit-3.2.0/Code/Common/itkLevelSetFunction.h:75:
error: 'static itk::SmartPointer<itk::LevelSetFunction<TImageType> >
itk::LevelSetFunction<TImageType>::New() [with TImageType =
itk::Image<float, 3u>]' is inaccessible
/home/xonobo/CPP/itk_based/itkTPLS/tpls_main.cpp:80: error: within this context
/home/xonobo/CPP/itk_based/itkTPLS/tpls_main.cpp:80: error: conversion
from 'itk::SmartPointer<itk::LevelSetFunction<itk::Image<float, 3u> >
>' to non-scalar type
'itk::SmartPointer<itk::SegmentationLevelSetFunction<itk::Image<float,
3u>, itk::Image<float, 3u> > >' requested
make[2]: *** [CMakeFiles/tpls_main.dir/tpls_main.o] Error 1
make[1]: *** [CMakeFiles/tpls_main.dir/all] Error 2
make: *** [all] Error 2
===============================
More information about the Insight-users
mailing list