[Insight-users] Maybe bug in HistogramMatchingImageFilter ??

Bryn blloyd at bwh.harvard.edu
Fri Oct 14 09:00:42 EDT 2005


Hi all,

I just wanted to use the itkHistogramMatchingImageFilter, to match the 
intensity distribution between two images.

I get the following (linking) error:
------------------------------------------------------
blloyd at neptun:~/Kitware/Tools/HistogramMatchingFilter/build$ make
Building dependencies. cmake.depends...
Building object file main.o...
Building executable 
/home/blloyd/Kitware/Tools/HistogramMatchingFilter/build/histo...
main.o(.gnu.linkonce.t._ZN3itk10Statistics23DenseFrequencyContainer3NewEv+0x59): 
In function `itk::Statistics::DenseFrequencyContainer::New()':
: undefined reference to 
`itk::Statistics::DenseFrequencyContainer::DenseFrequencyContainer[in-charge]()'
main.o(.gnu.linkonce.t._ZN3itk13ObjectFactoryINS_10Statistics23DenseFrequencyContainerEE6CreateEv+0xd): 
In function 
`itk::ObjectFactory<itk::Statistics::DenseFrequencyContainer>::Create()':
: undefined reference to `typeinfo for 
itk::Statistics::DenseFrequencyContainer'
main.o(.gnu.linkonce.t._ZN3itk13ObjectFactoryINS_10Statistics23DenseFrequencyContainerEE6CreateEv+0x4e): 
In function 
`itk::ObjectFactory<itk::Statistics::DenseFrequencyContainer>::Create()':
: undefined reference to `typeinfo for 
itk::Statistics::DenseFrequencyContainer'
main.o(.gnu.linkonce.t._ZNK3itk10Statistics9HistogramIfLj1ENS0_23DenseFrequencyContainerEE12GetFrequencyERKm+0x23): 
In function `itk::Statistics::Histogram<float, 
(unsigned)1,itk::Statistics::DenseFrequencyContainer>::GetFrequency(unsigned 
long const&) const':
: undefined reference to 
`itk::Statistics::DenseFrequencyContainer::GetFrequency(unsigned long) 
const'
main.o(.gnu.linkonce.t._ZN3itk10Statistics9HistogramIfLj1ENS0_23DenseFrequencyContainerEE10InitializeERKNS_4SizeILj1EEE+0x15e): 
In function `itk::Statistics::Histogram<float, (unsigned)1, 
itk::Statistics::DenseFrequencyContainer>::Initialize(itk::Size<(unsigned)1> 
const&)':
: undefined reference to 
`itk::Statistics::DenseFrequencyContainer::Initialize(unsignedlong)'
main.o(.gnu.linkonce.t._ZN3itk10Statistics9HistogramIfLj1ENS0_23DenseFrequencyContainerEE9SetToZeroEv+0x18): 
In function `itk::Statistics::Histogram<float, (unsigned)1, 
itk::Statistics::DenseFrequencyContainer>::SetToZero()':
: undefined reference to 
`itk::Statistics::DenseFrequencyContainer::SetToZero()'
main.o(.gnu.linkonce.t._ZN3itk10Statistics9HistogramIfLj1ENS0_23DenseFrequencyContainerEE17IncreaseFrequencyERKmf+0x2a): 
In function `itk::Statistics::Histogram<float, (unsigned)1, 
itk::Statistics::DenseFrequencyContainer>::IncreaseFrequency(unsigned 
long const&,float)':
: undefined reference to 
`itk::Statistics::DenseFrequencyContainer::IncreaseFrequency(unsigned 
long, float)'
collect2: ld returned 1 exit status
make[1]: *** 
[/home/blloyd/Kitware/Tools/HistogramMatchingFilter/build/histo] Error 1
make: *** [default_target] Error 2




Is this a bug? I couldn't find a test for this class.

Thanks, Bryn


My code is:
-----------------------
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkHistogramMatchingImageFilter.h"

int main( int argc, const char *argv[] )
{
  if( argc < 4 )
    {
    std::cerr << "Missing Parameters " << std::endl;
    std::cerr << "Usage: " << argv[0];
    std::cerr << " inputImageFile  modelImage  outputImageFile ";
    return 1;
    }
 
  const    unsigned int    Dimension = 3;
  typedef  float           PixelType;
 
  typedef itk::Image< PixelType, Dimension >  InputImageType;
 
  typedef itk::ImageFileReader< InputImageType  > ImageReaderType;
  ImageReaderType::Pointer  reader1  = ImageReaderType::New();
  ImageReaderType::Pointer  reader2  = ImageReaderType::New();
   reader1->SetFileName(  argv[1] );
   reader2->SetFileName(  argv[2] );


  typedef itk::HistogramMatchingImageFilter<
                            InputImageType,
                            InputImageType >    HistoImageFilterType;

  HistoImageFilterType::Pointer histo = HistoImageFilterType::New();
   histo->SetSourceImage( reader1->GetOutput() );
   histo->SetReferenceImage( reader2->GetOutput() );
   histo->SetNumberOfHistogramLevels(256);
  
  typedef itk::ImageFileWriter< InputImageType >  WriterType;
  WriterType::Pointer      writer =  WriterType::New();
  writer->SetFileName( argv[3] );
    writer->SetInput( histo->GetOutput()   );
    writer->Update();
   
  return 0;
}



More information about the Insight-users mailing list