[Insight-users] Runtime error while performing update.
Luis Ibanez
luis.ibanez at kitware.com
Fri Jul 16 10:27:10 EDT 2004
Hi Ruby,
1) It is likely that your application is throwing an
Exception. Please put a try/catch block around the
code that triggers the execution or your ITK-VTK
pipeline, and print out the description message
returned by the eventual exception.
2) About your choice of pixel type:
You should consider :
A- What is the actual dynamic range of the input image
B- What are you going to do with the GradientMagnitude image
C- How strong are the gradients in your image.
In typical medical images, gradient magnitudes are not too
large, because they usually lack strong discontinuities.
An easy experiment for you is to declare first your image
as "float", run it through the GradientMagnitude filter
declared as ImageFloat to ImageFloat, and then use the
MaximumMinimum image calculator in order to find the
max and min values of the gradient magnitude. It is quite
likely that the minimum will be zero. If you find that the
maximum is a small integer number (e.g. 35 or 55...), then
you may want to use floats for computing the gradient magnitude
in your actual application, or at least introduce some rescaling
filter like the RescaleIntensityImageFilter.
If the maximum gradient magnitude turns out to be a large integer
then you will have to analyze what sort of operations are you
doing with those integers afterward, since you may risk to
saturate the integer range with the subsequent operations.
The choice of pixel type is critical in a medical application
and deserves to be carefully analyzed.
Regards,
Luis
---------------------
Ruby Shamir wrote:
> Hi all,
>
> I tried to convert vtkImageData to itk::image (using
> VTKImageToImageFilter)
>
> , filter it with GradientMagnitudeImageFilter and then
>
> to convert it back to vtkImageData (using ImageToVTKImageFilter).
>
> When tried to call update() the program terminates and display a
> message:
>
> "This application has requested the Runtime to terminate it in an
> unusual way.
> Please contact the application's support team for more information"
>
> (See code below)
>
> My questions are:
>
> 1. Why does it happen and how to avoid it?
>
> 2. How can I now what image type to define?
> (the data is 3D, but how can I know which pixel type to choose (I
> choose unsigned int because for no reason))
>
>
>
> vtkImageData * showVolume::cleanImageData (vtkImageData *
> originalImageData){
>
> typedef itk::Image<unsigned int, 3> ImageType;
>
> typedef itk::ImageToVTKImageFilter<ImageType>
> itkToVtkConnectorType;
> typedef itk::VTKImageToImageFilter<ImageType>
> vtkToItkConnectorType;
>
> typedef itk::GradientMagnitudeImageFilter<ImageType,ImageType>
> gradientFilterType;
> typedef itk::DiscreteGaussianImageFilter<ImageType, ImageType>
> gaussianFilterType;
>
> itkToVtkConnectorType::Pointer itkToVtkConnector =
> itkToVtkConnectorType::New();
> vtkToItkConnectorType::Pointer vtkToItkConnector =
> vtkToItkConnectorType::New();
> gradientFilterType::Pointer gradientFilter =
> gradientFilterType::New();
>
> vtkToItkConnector->SetInput(originalImageData);
>
> gradientFilter ->SetInput(vtkToItkConnector->GetOutput());
> gradientFilter ->Update();
>
> itkToVtkConnector->SetInput(gradientFilter->GetOutput());
>
> return (itkToVtkConnector->GetOutput());
>
> }
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list