<div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">Hi David,</div></div><div class="im">
<br>
You must get the output and pass it back.<br>
If you want to disconnect the output from the pipeline use<br>
image->DisconnectPipeline();<br>
<br>
Try this:<br>
<br>
void ApplyThresholding(ImageType::Pointer &image)<br>
{<br>
typedef itk::BinaryThresholdImageFilter <ImageType, ImageType><br>
BinaryThresholdImageFilterType;<br>
<br>
BinaryThresholdImageFilterType::Pointer thresholdFilter<br>
= BinaryThresholdImageFilterType::New();<br>
thresholdFilter->SetInput(image);<br>
thresholdFilter->SetLowerThreshold(10);<br>
thresholdFilter->SetUpperThreshold(50);<br>
thresholdFilter->SetInsideValue(255);<br>
thresholdFilter->SetOutsideValue(0);<br>
thresholdFilter->InPlaceOn();<br>
thresholdFilter->Update();<br>
image = thresholdFilter->GetOutput();<br>
// OPTIONAL:<br>
// image->DisconnectPipeline();<br>
}<br>
<br>
PS: I am not 100% sure if this is the "best practice".<br>
<br>
Hope that helps,<br>
Markus<br></div></blockquote><div><br></div>Hi Markus,<div><br></div><div>You are right, if I change the function signature to pass the 'image' pointer by reference:</div><div><br></div><div>void ApplyThresholding(ImageType::Pointer &image)</div>
<div><br></div><div>and then assign 'image' to the pointer that is the output of the filter:</div><div><br></div><div>image = thresholdFilter->GetOutput();</div><div><br></div><div>the thresholded image is displayed. However, this works whether or not InPlaceOn has been called. What this has done is simply change 'image' in the calling function to point to a different image, rather than modify the image that 'image' was pointing to originally.</div>
<div><br clear="all">Can anyone clarify the idea/usage of the InPlaceOn option?<br><br></div><div>Thanks,</div><div><br></div><div>David</div></div></div>