[Insight-users] RecursiveGaussianImageFilter
salah
salah at gris.uni-tuebingen.de
Thu May 12 17:58:26 EDT 2005
Hello everybody,
I am using the piece of code below to smooth an itk image (of type unsigned short).
The input image has intensity values in the range 0-1940,
The output of the bcaster (bcaster should cast float back to unsigned short) is a dark
image due to some voxel having the maximum intensity value (65535).
To debug thing thing, I displayed the float image resulting from m_Smoother. The image
is alright, but surprisingly the it has the intensity range (-3.867 -- 6241.296). I am wandering
how the negative values are resulted. I think they cause the wrongly cased output!!
Any ideas where do these negatives come from? how to properly smooth/cast??
many thanx,
Zein
//---------------------------------------------- cast to float
typedef itk::CastImageFilter< ImageType, FloatImageType > CastType;
CastType::Pointer caster = CastType::New();
caster->SetInput(m_InputImage);
caster->Update();
RecursiveGaussianImageFilterType::Pointer x_Smoother;
x_Smoother = RecursiveGaussianImageFilterType::New();
x_Smoother->SetInput( caster->GetOutput() );
x_Smoother->SetDirection( 0 ); // apply along X
x_Smoother->SetOrder( RecursiveGaussianImageFilterType::ZeroOrder );
x_Smoother->SetNormalizeAcrossScale( true );
x_Smoother->SetSigma( GetSigma() );
x_Smoother->UpdateLargestPossibleRegion();
m_Smoother->SetInput( x_Smoother->GetOutput());
m_Smoother->SetDirection( 1 ); // apply along Y
m_Smoother->SetOrder( RecursiveGaussianImageFilterType::ZeroOrder );
m_Smoother->SetNormalizeAcrossScale( true );
m_Smoother->SetSigma( GetSigma() );
m_Smoother->UpdateLargestPossibleRegion();
//---------------------------------------------- re-cast back
typedef itk::CastImageFilter< FloatImageType, ImageType > BackCastType;
BackCastType::Pointer bcaster = BackCastType::New();
bcaster->SetInput(m_Smoother->GetOutput() );
bcaster->Update();
m_SmoothedImage = bcaster->GetOutput();
More information about the Insight-users
mailing list