[Insight-users] "In place" filtering

David Doria daviddoria at gmail.com
Sun Oct 24 18:19:03 EDT 2010


I don't believe the following will work. The idea is to pass an image to a
function and smooth it "in place".

ImageType::Pointer image = get image from somewhere...
SmoothImage(image);

where:

void SmoothImage(ImageType::Pointer image)
{
 // Create and setup a mean filter
 typedef itk::MeanImageFilter<
  ImageType, ImageType >  filterType;

  filterType::Pointer meanFilter = filterType::New();
  meanFilter->SetInput(image);
  meanFilter->Update();

  image = meanFilter->GetOutput();
}

Of course you can do this:

ImageType::Pointer image = get image from somewhere...
ImageType::Pointer output = ImageType::Pointer::New();
SmoothImage(image, output);

void SmoothImage(ImageType::Pointer image, ImageType::Pointer output)
{
 // Create and setup a mean filter
 typedef itk::MeanImageFilter<
  ImageType, ImageType >  filterType;

  filterType::Pointer meanFilter = filterType::New();
  meanFilter->SetInput(image);
  meanFilter->Update();

  output = meanFilter->GetOutput();
}

but that seems a bit awkward.

Is there a pattern that makes sense for this "in place filtering" style
function?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101024/c0be3d4d/attachment.htm>


More information about the Insight-users mailing list