[Insight-users] FW: DiscreteGaussianImageFilter in function

Arunachalam Kana Kana.Arunachalam at fh-wels.at
Fri Apr 1 11:24:21 EDT 2011


Hi ,

itkCastImageFilter convert imagedata types.
I also saw in your code that you did not setmaximumerror(). Please read the itk manual about discretegaussianimagefilter, and the itk doxygen html.

All the best,
Regards,
Kana

From: G G [mailto:greenlander1986 at gmail.com]
Sent: 01 April 2011 15:43
To: Arunachalam Kana
Cc: insight-users at itk.org
Subject: Re: [Insight-users] DiscreteGaussianImageFilter in function

You are right, but I have to display "unsigned char" image... Do you know name of filter, which convert float image to unsigned char image?
Thanks a lot
2011/4/1 Arunachalam Kana <Kana.Arunachalam at fh-wels.at<mailto:Kana.Arunachalam at fh-wels.at>>
Hi,

Writing the error message will give a better idea for us about what you are facing.

Anyways from what i know, the outputimagetype for discretegaussian is a float image.  So in your definition
typedef itk::DiscreteGaussianImageFilter< TImageType, TImageType > DiscreteGaussianFilterType;
TImageType should be of float type. So your input image should be a float too.  If this is true then i don't know the bug.
If your input image is not float then you should change the definition as
typedef itk::DiscreteGaussianImageFilter< TImageType, TOutputImageType > DiscreteGaussianFilterType;
TOutputImageType should be a float image.

This is the only thought sparked in my mind. Please check for this.

All the best
Regards,
Kana

From: insight-users-bounces at itk.org<mailto:insight-users-bounces at itk.org> [mailto:insight-users-bounces at itk.org<mailto:insight-users-bounces at itk.org>] On Behalf Of G G
Sent: 01 April 2011 11:37
To: insight-users
Subject: [Insight-users] DiscreteGaussianImageFilter in function

Hi, I dont solve it, so I try to ask here...
I have this function

template<typename TImageTypePointer, typename TImageType> void WatershedCompute::
    discreteGaussianFilter(TImageTypePointer inputImage, void *poutputImage)
{
    typedef itk::DiscreteGaussianImageFilter< TImageType, TImageType > DiscreteGaussianFilterType;
    DiscreteGaussianFilterType::Pointer discreteGaussianFilter = DiscreteGaussianFilterType::New();
    discreteGaussianFilter->SetInput( inputImage );
    const double gaussianVariance = this->params->Get_discrete_gaussian_variance();
    const unsigned int maxKernelWidth = this->params->Get_discrete_gaussian_kernel_width();
    discreteGaussianFilter->SetVariance( gaussianVariance );
    discreteGaussianFilter->SetMaximumKernelWidth( maxKernelWidth );
    discreteGaussianFilter->Update(); // this line
    TImageTypePointer *Pout = (TImageTypePointer *)poutputImage;
    *Pout = discreteGaussianFilter->GetOutput();
    return;
}

And in // this line I have "error"... I dont know, if it is error, because I get code from another function, which I dont call, I dont know what is the problem :(


I have another function for example

template<typename TImageTypePointer, typename TImageType> void WatershedCompute::
    rescaleIntensityFilter(TImageTypePointer inputImage, void *poutputImage, int min, int max)
{
    typedef itk::RescaleIntensityImageFilter< TImageType, TImageType > RescaleFilterType;
    RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
    rescaler->SetOutputMinimum( min );
    rescaler->SetOutputMaximum( max );
    rescaler->SetInput( inputImage );
    rescaler->Update();
    TImageTypePointer *Pout = (TImageTypePointer *)poutputImage;
    *Pout = rescaler->GetOutput();
    return;
}

When I call only rescaleIntensityFilter and dont call discreteGaussianFilter it is OK. Could someone help me, please?
Thanks a lot :-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110401/3be40c4d/attachment.htm>


More information about the Insight-users mailing list