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

Bill Lorensen bill.lorensen at gmail.com
Mon Jun 17 12:07:59 EDT 2013


You misspelled the filter name:
  typedef itk::BinaryFillHoleImageFilter<Binary2DImageType>
HoleFillFilterType;

should be
 typedef itk::BinaryFillholeImageFilter<Binary2DImageType>
HoleFillFilterType;

FillHole -> Fillhole

Thanks for providing a complete example and cmake file. It saves all of us
a lot of time...

Bill




On Sun, Jun 16, 2013 at 7:16 PM, dakai <wang.hongkai at gmail.com> wrote:

> 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.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>



-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130617/a063c371/attachment.htm>


More information about the Insight-users mailing list