[vtkusers] vtkImageGradient.cxx changes, why??

Asad A. Abu-Tarif tarifa at rpi.edu
Fri Dec 7 00:01:59 EST 2001


Hi,
I sent an email earlier today asking about a code that I used to run fine
on vtk3.12 and it started giving me trouble when I upgraded to vtk3.2.
The code basically inputs a structured points data set with scalar
type VTK_UNSIGNED_CHAR to vtkImageGradient, vtkImageGradientMagnitude
and then to vtkImageNonMaximumSuppression.
The problem I'm facing is that vtkImageNonMaximumSuppression
complains about vtkImageGradient output being of scalar type
VTK_UNSIGNED_CHAR while the output of vtkImageGradientMagnitude
has a VTK_FLOAT scalar type.
The changes below that caused this (in vtk3.2 and vtk4.0) in effect limit
the use of those classes to data set types of VTK_FLOAT.

The question is, is there a good reason why we can't find the gradient of
a data set with VTK_UNSIGNED_CHAR scalars?? Why did you make the
change?? I know it makes sense to have vtkImageGradient always output
a VTK_FLOAT. However, if you do that, you shouldn't require that
vtkImageGradientMagnitude
and vtkImageNonMaximumSuppression have the scalar type of the input
and the output the same!!

The changes still exist in vtk4.0 and hence we still can't find the gradient
of a data set unless its scalars are of type VTK_FLOAT!!

Regards,
Asad

================Line 104===================================
outData->SetScalarType(VTK_FLOAT);
================end-Line 104================================

==========Lines 258 to 264=======================================
// this filter expects that input is the same type as output.
  if (outData->GetScalarType() != VTK_FLOAT)
    {
    vtkErrorMacro(<< "Execute: output ScalarType, " <<
outData->GetScalarType()
                  << ", must be float\n");
    return;
    }
==========end-Lines 258 to 264=======================================






More information about the vtkusers mailing list