[Insight-users] BinaryFillHoleImageFilter not recognized as a member of itk

dakai wang.hongkai at gmail.com
Sun Jun 16 19:16:51 EDT 2013


Hello,

Maybe this question is week, but I cannot figure out the answer. I am using
ITK4.4, Microsoft Visual Studio Professional 2012 in windows 8. I built
ITK4.4 using Cmake 2.8.11.1 without problem. Then I tried to compile my own
exe using the itkBinaryFillHoleImageFilter, and Visual Studio told me:
"error C2039: 'BinaryFillHoleImageFilter' : is not a member of 'itk'".
Actually, before the compilation, visual studio already told me the line 
"typedef itk::BinaryFillHoleImageFilter<Binary2DImageType>
HoleFillFilterType;" has problem:"Error: qualified name not allowed."

I also tried other filters under ITK\Modules\Filtering\LabelMap\, and they
have the same problem.

I know the filters under ITK\Modules\Filtering\LabelMap\ all came from
Gaëtan's contribution
(http://www.insight-journal.org/browse/publication/176), but as I googled
itkBinaryFillHoleImageFilter, it seems nobody had the same problem as mine. 

My codes and cmake file are as below.

Thank you!

Hongkai


#include <fstream>
#include "itkImage.h"
#include "itkBinaryThresholdImageFilter.h"
#include "itkSliceBySliceImageFilter.h"
#include "itkBinaryFillholeImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "stdlib.h"

int main(int argc, char *argv[] )
{

  const  unsigned int   Dimension = 3;
  typedef   float  InputPixelType;
  typedef   unsigned char  BinaryPixelType;
  typedef   float  OutputPixelType;    
  typedef itk::Image< InputPixelType,  Dimension >   InputImageType;
  typedef itk::Image< BinaryPixelType,  Dimension >   BinaryImageType;
  typedef itk::Image< BinaryPixelType,  2 >   Binary2DImageType;
  typedef itk::Image< OutputPixelType, Dimension >   OutputImageType;

  typedef itk::ImageFileReader< InputImageType  >  ReaderType;
  typedef itk::ImageFileWriter< BinaryImageType >  WriterType;
  ReaderType::Pointer reader = ReaderType::New();
  WriterType::Pointer writer = WriterType::New();
  reader->SetFileName( argv[1] );
  writer->SetFileName( argv[2] );
  reader->Update();


  //----------- Thresholding filter -------------------------------//
  typedef itk::BinaryThresholdImageFilter< InputImageType, BinaryImageType > 
ThresholdFilterType;
  ThresholdFilterType::Pointer ThresholdFilter = ThresholdFilterType::New();
  ThresholdFilter->SetOutsideValue( 0 );
  ThresholdFilter->SetInsideValue( 1 );
  ThresholdFilter->SetLowerThreshold( -100 );
  ThresholdFilter->SetUpperThreshold( 1e30 );
  
  //------------ Slice by slice filling holes -----------------------//
  typedef itk::SliceBySliceImageFilter< BinaryImageType, BinaryImageType>
SbSFilterType;
  SbSFilterType::Pointer SbSFilter = SbSFilterType::New();

  typedef itk::BinaryFillHoleImageFilter<Binary2DImageType>
HoleFillFilterType;
  HoleFillFilterType::Pointer HoleFillFilter = HoleFillFilterType::New();
  SbSFilter->SetFilter(HoleFillFilter);
  

  //Assemble the processing pipeline
  ThresholdFilter->SetInput( reader->GetOutput() );
  SbSFilter->SetInput(ThresholdFilter->GetOutput());
  writer->SetInput(SbSFilter->GetOutput() );
  writer->Update();

  return EXIT_SUCCESS;

}



CMake list:
PROJECT(MyProject)

FIND_PACKAGE(ITK)

IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
  "ITK not found. Please set ITK_DIR.")
ENDIF(ITK_FOUND)

ADD_EXECUTABLE(MyProject MyProject.cxx )
TARGET_LINK_LIBRARIES(MyProject 
  ${ITK_LIBRARIES}
  )




--
View this message in context: http://itk-users.7.n7.nabble.com/BinaryFillHoleImageFilter-not-recognized-as-a-member-of-itk-tp31707.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list