[Insight-users] 3D watershed segmentation problem

G G greenlander1986 at gmail.com
Sat Apr 2 05:51:54 EDT 2011


Hi I have this code:

    const unsigned int InputDimension = 3;
    typedef float InternalPixelType;
    typedef itk::Image< InternalPixelType, InputDimension >
InternalImageType;
    typedef itk::ImageFileReader< InternalImageType > ReaderType;
    ReaderType::Pointer reader = ReaderType::New();
    try
    {
        reader->SetFileName(this->filepath.c_str());
    }
    catch(...)
    {
        return;
    }
    reader->Update();

    const unsigned int OutputDimension = 3;
    typedef itk::RGBPixel<unsigned char> RGBPixelType;
    typedef itk::Image< RGBPixelType, OutputDimension > RGBImageType;
    typedef  itk::ImageFileWriter< RGBImageType > WriterType;
    WriterType::Pointer writer = WriterType::New();
    writer->SetFileName( "outputimage.mhd" );

        typedef   itk::GradientMagnitudeRecursiveGaussianImageFilter<
                                                        InternalImageType,
                                                        InternalImageType
                                                            >
GradientMagnitudeFilterType;

        GradientMagnitudeFilterType::Pointer gradienMagnitudeFilter =
GradientMagnitudeFilterType::New();
        gradienMagnitudeFilter->SetInput( reader->GetOutput() );
        gradienMagnitudeFilter->SetSigma( 1.0 );

        typedef  itk::WatershedImageFilter< InternalImageType >
WatershedFilterType;
        WatershedFilterType::Pointer watershedFilter =
WatershedFilterType::New(); // *from this code i gave error*
        watershedFilter->SetInput( gradienMagnitudeFilter->GetOutput() );
        watershedFilter->SetThreshold(
this->params->Get_watershed_threshold() );
        watershedFilter->SetLevel( this->params->Get_watershed_flood_value()
);

        typedef itk::Functor::ScalarToRGBPixelFunctor< unsigned long >
ColorMapFunctorType;
        typedef WatershedFilterType::OutputImageType  LabeledImageType;
        typedef itk::UnaryFunctorImageFilter<
                                        LabeledImageType,
                                        RGBImageType,
                                        ColorMapFunctorType
                                                        >
ColorMapFilterType;

        ColorMapFilterType::Pointer colorMapFilter =
ColorMapFilterType::New();
        colorMapFilter->SetInput(  watershedFilter->GetOutput() );

        writer->SetInput( colorMapFilter->GetOutput() );

        try
        {
            writer->Update();
        }
        catch( itk::ExceptionObject & excep )
        {
            cerr << "Exception !" << endl;
            cerr << excep.GetDescription() << endl;
            return;
        }


I thing, that it is not wrong, but I get this errors from VS2008

Error    1    error LNK2001: unresolved external symbol "protected: virtual
void __thiscall itk::WatershedMiniPipelineProgressCommand::PrintSelf(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
itk::Indent)const " (?PrintSelf at WatershedMiniPipelineProgressCommand@itk@
@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
WatershedCompute.obj    WatershedSegmentation

Error    2    error LNK2001: unresolved external symbol "public: virtual
void __thiscall itk::WatershedMiniPipelineProgressCommand::Execute(class
itk::Object const *,class itk::EventObject const &)"
(?Execute at WatershedMiniPipelineProgressCommand@itk@@UAEXPBVObject at 2
@ABVEventObject at 2@@Z)    WatershedCompute.obj    WatershedSegmentation

Error    3    error LNK2001: unresolved external symbol "public: virtual
void __thiscall itk::WatershedMiniPipelineProgressCommand::Execute(class
itk::Object *,class itk::EventObject const &)"
(?Execute at WatershedMiniPipelineProgressCommand@itk@@UAEXPAVObject at 2
@ABVEventObject at 2@@Z)    WatershedCompute.obj    WatershedSegmentation

Error    4    fatal error LNK1120: 3 unresolved externals
C:\InsightApplications-3.20.0\src\muj_test6\Release\WatershedSegmentation.exe
WatershedSegmentation

I dont know, where is the problem :( In my other project it works fine...
I will be very happyif you help me
Thank you everybody
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110402/12047f20/attachment.htm>


More information about the Insight-users mailing list