<div>I don't believe the following will work. The idea is to pass an image to a function and smooth it "in place".</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">ImageType::Pointer image = get image from somewhere...</div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8">SmoothImage(image);</div><div><br></div><div>where:</div><div><br></div><div>void SmoothImage(ImageType::Pointer image)</div><div>{</div><div> // Create and setup a mean filter</div>
<div> typedef itk::MeanImageFilter<</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> ImageType, ImageType > filterType;</div><div> </div><div> filterType::Pointer meanFilter = filterType::New();</div>
<div> meanFilter->SetInput(image);</div><div> meanFilter->Update();</div><div><br></div><div> image = meanFilter->GetOutput();</div><div>}</div><div><br></div><div>Of course you can do this:</div><div><br></div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>ImageType::Pointer image = get image from somewhere...</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">ImageType::Pointer output = ImageType::Pointer::New();</div>
<div>SmoothImage(image, output);</div></div><div><br></div><div>void SmoothImage(ImageType::Pointer image, ImageType::Pointer output)</div><div><div>{</div><div> // Create and setup a mean filter</div><div> typedef itk::MeanImageFilter<</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> ImageType, ImageType > filterType;</div><div> </div><div> filterType::Pointer meanFilter = filterType::New();</div><div> meanFilter->SetInput(image);</div>
<div> meanFilter->Update();</div><div><br></div><div> output = meanFilter->GetOutput();</div><div>}</div></div><div><br></div><div>but that seems a bit awkward.</div><div><br>Is there a pattern that makes sense for this "in place filtering" style function?</div>
<div><br></div>Thanks,<br><br>David<br>