<div>I don&#39;t believe the following will work. The idea is to pass an image to a function and smooth it &quot;in place&quot;.</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&lt;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  ImageType, ImageType &gt;  filterType;</div><div> </div><div>  filterType::Pointer meanFilter = filterType::New();</div>
<div>  meanFilter-&gt;SetInput(image);</div><div>  meanFilter-&gt;Update();</div><div><br></div><div>  image = meanFilter-&gt;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&lt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>  ImageType, ImageType &gt;  filterType;</div><div> </div><div>  filterType::Pointer meanFilter = filterType::New();</div><div>  meanFilter-&gt;SetInput(image);</div>
<div>  meanFilter-&gt;Update();</div><div><br></div><div>  output = meanFilter-&gt;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 &quot;in place filtering&quot; style function?</div>
<div><br></div>Thanks,<br><br>David<br>