[Insight-users] Linking problem with itkBinaryImageToStatisticsLabelMapFilter

Roman Grothausmann roman.grothausmann at helmholtz-berlin.de
Wed Jan 27 11:13:43 EST 2010


Dear mailing list members,


I need the sum of grey values in labels now so I changed my code (see 
below) from itkBinaryImageToShapeLabelMapFilter to 
itkBinaryImageToStatisticsLabelMapFilter. Now it still compiles but I 
get a lot linking errors (see further below).

What can I do about that? I tried with the new statistics API but that 
didn't help either.

Any help is very much appreciated
Roman


_____________________________


     typedef unsigned short LabelType;
     typedef itk::StatisticsLabelObject< LabelType, dim > LabelObjectType;
     typedef itk::LabelMap< LabelObjectType > LabelMapType;

     typedef itk::BinaryImageToStatisticsLabelMapFilter<OutputImageType, 
GreyImageType, LabelMapType > ConverterType;
     ConverterType::Pointer converter = ConverterType::New();
     converter->SetInput(thr->GetOutput());
     converter->SetFeatureImage(vtkitkf->GetOutput());
     converter->SetFullyConnected(true); //true: 26-connectivity; false: 
6-connectivity
     converter->SetComputePerimeter(false);
     converter->Update();

     vtkPoints* fpoints = vtkPoints::New();
     FILE *off;
     off= fopen ((fn + ".fdat").data(),"w");
     double c_x, c_y, c_z;

     LabelMapType::Pointer labelMap = converter->GetOutput();
     for( unsigned int label=1; 
label<=labelMap->GetNumberOfLabelObjects(); label++ )
         {
         const LabelObjectType * labelObject = labelMap->GetLabelObject( 
label );
//         c_x= labelObject->GetCentroid()[0];
//         c_y= labelObject->GetCentroid()[1];
//         c_z= labelObject->GetCentroid()[2];
         c_x= labelObject->GetCenterOfGravity()[0];
         c_y= labelObject->GetCenterOfGravity()[1];
         c_z= labelObject->GetCenterOfGravity()[2];
         fprintf(off, "%d\t%f\t%f\t%f\t%ld\t%f\n",label, c_x, c_y, c_z, 
labelObject->GetSize(), labelObject->GetSum());
         fpoints->InsertNextPoint(c_x, c_y, c_z);
         }
     fclose(off);

_______________________________________________

Scanning dependencies of target ana_04 

[ 25%] Building CXX object CMakeFiles/ana_04.dir/ana_04.o 

Linking CXX executable ana_04 

CMakeFiles/ana_04.dir/ana_04.o: In function 
`itk::ObjectFactory<itk::Statistics::DenseFrequencyContainer2>::Create()':
ana_04.cxx:(.text._ZN3itk13ObjectFactoryINS_10Statistics24DenseFrequencyContainer2EE6CreateEv[itk::ObjectFactory<itk::Statistics::DenseFrequencyContainer2>::Create()]+0xe): 
undefined reference to `typeinfo for 
itk::Statistics::DenseFrequencyContainer2'
ana_04.cxx:(.text._ZN3itk13ObjectFactoryINS_10Statistics24DenseFrequencyContainer2EE6CreateEv[itk::ObjectFactory<itk::Statistics::DenseFrequencyContainer2>::Create()]+0x4f): 
undefined reference to `typeinfo for 
itk::Statistics::DenseFrequencyContainer2'
CMakeFiles/ana_04.dir/ana_04.o: In function 
`itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::GetFrequency(unsigned long) 
const':
ana_04.cxx:(.text._ZNK3itk10Statistics9HistogramIdNS0_24DenseFrequencyContainer2EE12GetFrequencyEm[itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::GetFrequency(unsigned long) 
const]+0x28): undefined reference to 
`itk::Statistics::DenseFrequencyContainer2::GetFrequency(unsigned long) 
const'
CMakeFiles/ana_04.dir/ana_04.o: In function 
`itk::Statistics::DenseFrequencyContainer2::New()':
ana_04.cxx:(.text._ZN3itk10Statistics24DenseFrequencyContainer23NewEv[itk::Statistics::DenseFrequencyContainer2::New()]+0x3c): 
undefined reference to 
`itk::Statistics::DenseFrequencyContainer2::DenseFrequencyContainer2()'
CMakeFiles/ana_04.dir/ana_04.o: In function 
`itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::SetToZero()':
ana_04.cxx:(.text._ZN3itk10Statistics9HistogramIdNS0_24DenseFrequencyContainer2EE9SetToZeroEv[itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::SetToZero()]+0x20): 
undefined reference to 
`itk::Statistics::DenseFrequencyContainer2::SetToZero()'
CMakeFiles/ana_04.dir/ana_04.o: In function 
`itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::Initialize(itk::Array<unsigned 
long> const&)':
ana_04.cxx:(.text._ZN3itk10Statistics9HistogramIdNS0_24DenseFrequencyContainer2EE10InitializeERKNS_5ArrayImEE[itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::Initialize(itk::Array<unsigned 
long> const&)]+0x5c3): undefined reference to 
`itk::Statistics::DenseFrequencyContainer2::Initialize(unsigned long)'
CMakeFiles/ana_04.dir/ana_04.o: In function 
`itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::IncreaseFrequency(unsigned 
long, unsigned long)':
ana_04.cxx:(.text._ZN3itk10Statistics9HistogramIdNS0_24DenseFrequencyContainer2EE17IncreaseFrequencyEmm[itk::Statistics::Histogram<double, 
itk::Statistics::DenseFrequencyContainer2>::IncreaseFrequency(unsigned 
long, unsigned long)]+0x30): undefined reference to 
`itk::Statistics::DenseFrequencyContainer2::IncreaseFrequency(unsigned 
long, unsigned long)'
collect2: ld returned 1 exit status
make[2]: *** [ana_04] Fehler 1
make[1]: *** [CMakeFiles/ana_04.dir/all] Fehler 2
make: *** [all] Fehler 2

-- 
Roman Grothausmann

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Bereich Funktionale Materialien
Institut für angewandte Materialforschung
Hahn-Meitner-Platz 1
D-14109 Berlin	

Tel.: +49-(0)30-8062-2816
Fax.: +49-(0)30-8062-3059

Vorsitzender des Aufsichtsrats: Prof. Dr. Dr. h.c. mult. Joachim Treusch
Stellvertretende Vorsitzende: Dr. Beatrix Vierkorn-Rudolph
Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Prof. Dr. Dr. h.c. 
Wolfgang Eberhardt, Dr. Ulrich Breuer
Sitz der Gesellschaft: Berlin
Handelsregister: AG Charlottenburg, 89 HRB 5583



More information about the Insight-users mailing list