[Insight-users] How to use non member ITK filters...

Bill Lorensen bill.lorensen at gmail.com
Tue Mar 18 10:36:05 EDT 2008


typedef itk::itkMaskImageFilter should be typedef itk::MaskImageFilter

On Tue, Mar 18, 2008 at 5:45 AM, gp kekule <kekuleitk at gmail.com> wrote:
> Dear all
>
> I am new to ITK. I am wondering if I can use itkMaskImageFilter for
> processing
>
> 1. Input graylevel image
>
> 2. Binary image
>
> Here is my CXX file is.....
>
>
>
> #include"itkImage.h"
>
> #include"itkImageFileReader.h"
>
> #include"itkImageFileWriter.h"
>
> #include"itkMaskImageFilter.h"
>
> intmain( int argc, char * argv[] )
>
> {
>
>
>
> typedef unsigned char InputPixelType;
>
> typedef unsigned char OutputPixelType;
>
>
>
> typedef itk::Image< InputPixelType, 2 > InputImageType;
>
> typedef itk::Image< OutputPixelType, 2 > OutputImageType;
>
> typedef itk::itkMaskImageFilter<
>
> InputImageType,InputImageType, OutputImageType > FilterType;
>
>
>
> typedef itk::ImageFileReader< InputImageType > ReaderType;
>
>
>
> ReaderType::Pointer reader = ReaderType::New();
>
> ReaderType::Pointer reader2 = ReaderType::New();
>
> FilterType::Pointer filter = FilterType::New();
>
> WriterType::Pointer writer = WriterType::New();
>
> reader->SetFileName( "input.png");
>
> reader2->SetFileName( "binary_image.png");
>
>
>
> filter->SetInput1(reader->GetOutput());
>
> filter->SetInput2(reader2->GetOutput());
>
> filter->Update();
>
> writer->SetInput( filter->GetOutput() );
>
> writer->SetFileName( "output.png" );
>
> writer->Update();
>
> return EXIT_SUCCESS;
>
> }
>
>
>
> And CMakeList.txt is as fallows
>
> PROJECT(Otsu_mask)
>
> # Find ITK.
> FIND_PACKAGE(ITK REQUIRED)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ENDIF(ITK_FOUND)
>
> ADD_EXECUTABLE(itkMaskImageFilter itkMaskImageFilter.cxx )
> TARGET_LINK_LIBRARIES(itkMaskImageFilter ITKIO itkbasicfilters ITKCommon)
>
>
>
> I am  getting error as
>
> error C2039: 'itkMaskImageFilter' : is not a member of 'itk'
>
>
>
> Looking forward to receive ur reply.
>
> BW
>
> Dave
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list