[Insight-users] Question: Inconsistent results by making Gaussianfilter as member variables and local variables

ask ITK askitk at gmail.com
Tue Jan 31 17:30:01 EST 2006


I get inconsistent results by making my gaussian filter as member variable
and local variable

Below is my code:
==========================================================
void ImageProcessor::GaussianSmoothing(ImagePtr input, void* output,
double sigma)
{
	ImageType::IndexType index;
	index[0] = 100 ; index[1] = 100 ; index[2] = 0 ;

	GaussianFilterPointer lm_GaussianFilter = GaussianFilterType::New() ;

	m_GaussianFilter->SetInput( input);
	m_GaussianFilter->SetVariance( sigma*sigma );
	m_GaussianFilter->Update();
	
	lm_GaussianFilter->SetInput( input);
	lm_GaussianFilter->SetVariance( sigma*sigma );
	lm_GaussianFilter->Update();

	ImagePtr *tempoutput = (ImagePtr*)output;

//	*tempoutput = m_GaussianFilter->GetOutput();
	*tempoutput = lm_GaussianFilter->GetOutput();

	ImagePtr local = ImageType::New();
	local = lm_GaussianFilter->GetOutput();

	ImagePtr member = ImageType::New();
	member = m_GaussianFilter->GetOutput();
		
	printf("\nLOCAL Filtered pixel value = %f\n", local->GetPixel(index));
	printf("\nMember Filtered pixel value = %f\n", member->GetPixel(index));
}
=========================================================

Please notice that the
m_GaussianFilter is the member variable of a class ImageProcessor
The result from m_GaussianFilter remain unchanged after the 1st call
of the function...i.e. after I calling the whole function once, the
results will not be changed even I change the input sigma...

while the local variable lm_GaussianFilter can provide correct results.....
Please advice for such inconsistent situation...
thanks a lot!!!


More information about the Insight-users mailing list