[Insight-users] how to create a new function

Alberto albermnz at gmail.com
Thu Jul 10 04:31:38 EDT 2008


Dear all,
I would like to know how to create a funtion that can make a dilatation when
I call it. THe input parameter is an image and the output parameter is also
an image.This is the code:

const unsigned int Dimension = 3;

  typedef unsigned char   InputPixelType;
  typedef unsigned char   OutputPixelType;

  typedef itk::Image< InputPixelType,  Dimension >   InputImageType;
  typedef itk::Image< OutputPixelType, Dimension >   OutputImageType;

  typedef itk::ImageFileReader< InputImageType  >  ReaderType;
  typedef itk::ImageFileWriter< OutputImageType >  WriterType;

  typedef itk::BinaryBallStructuringElement< InputPixelType,Dimension  >
StructuringElementType;

  typedef itk::GrayscaleDilateImageFilter<InputImageType, OutputImageType,
StructuringElementType >  DilateFilterType;

  ReaderType::Pointer reader = ReaderType::New();
  WriterType::Pointer writerDilation = WriterType::New();
    DilateFilterType::Pointer grayscaleDilate = DilateFilterType::New();

  StructuringElementType  structuringElement;
  structuringElement.SetRadius( 1 );
  structuringElement.CreateStructuringElement();

  reader->SetFileName( argv[1] );

  grayscaleDilate->SetKernel( structuringElement );
  grayscaleDilate->SetInput( reader->GetOutput() );
  grayscaleDilate->Update();

  writerDilation->SetFileName( argv[2] );
  writerDilation->SetInput( grayscaleDilate->GetOutput() );
  writerDilation->Update();


Is there any example how to do it?
Best regards
Albert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080710/313e4ade/attachment.htm>


More information about the Insight-users mailing list