[Insight-users] GradientRecursiveGaussianImageFilter

Luis Ibanez luis.ibanez@kitware.com
Mon, 16 Dec 2002 10:21:04 -0500


Hi Waltraut


> 
> 4) How can display GradientRecursiveGaussianImageFilter in vtk?  How can it
> write into a file?
 >

The output of the GradientRecursiveGaussianImageFilter is an
image whose pixels are of type "CovariantVector".

Covariant vector are the appropriate representation type for
gradients and normals to surfaces (gradients can be seen as
the normals to isosurfaces).

The data for each pixel is contiguous. That is, if you are
using 3D. the gradient vector of the first pixel will be
stored in memory with the three coordinates conguously then
the three components of the gradient vector for the second
pixel,... and so on.  Like:

            x0 y0 z0 x1 y1 z1 x2 y2 z2 ...

Probably the simplest way to visuallize this is by extracting
the components and generating scalar images by component.

So you get one image whose pixels are:

             x0 x1 x2 x3 ..... etc

another with pixel values

             y0 y1 y2 y3 ..... etc

and finally, another image with pixel values

             z0 z1 z2 z3 .... etc

This separation is easily done with the filter:

VectorIndexSelectionCastImageFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1Functor_1_1VectorIndexSelectionCast.html

This filter takes an image of vectors as input and
generates an image of scalars composed by the Nth
component of all the input vector. The component number
is selected with the SetIndex() method.

An example of this filter can found in the files:

Insight/Examples/Filtering/VectorCurvatureAnisotropicDiffusionImageFilter.cxx
Insight/Examples/Filtering/VectorGradientAnisotropicDiffusionImageFilter.cxx

Where they are used to save one of the components of a 2D Image of
vectors as a image of scalars.

You can take this image of scalars, export it to VTK and
visualize it with the ImageViewer for example.


Please let us know if you encounter any problems.


Thanks


Luis



-------------------------------------

> I tried with itktovtk pipline 	
> 	typedef itk::VTKImageExport<myImageType> ImageExportType;
> 
> 	// Create the itk::VTKImageExport instance and connect it to the
> 	// itk::CurvatureFlowImageFilter.
> 	ImageExportType::Pointer itkExporter = ImageExportType::New();
> 	itkExporter->SetInput(gradient);
> 
> 	// Create the vtkImageImport and connect it to the
> 	// itk::VTKImageExport instance.
> 	vtkImageImport* vtkImporter = vtkImageImport::New();  
> 	ConnectPipelines(itkExporter, vtkImporter);
> 	vtkImporter->Update();
> 
> and I get the following mistake:
> 
> D:\user\henrich\mediframedezember\Mediframe\SOURCE\COMPONENTS\Segmentation\S
> nakeModel.cpp(310) : error C2664: 'SetInput' : Konvertierung des Parameters
> 1 von 'class itk::SmartPointer<class
> itk::GradientRecursiveGaussianImageFilter<class itk::Image<d
> ouble,3>,class itk::Image<class itk::CovariantVector<double,3>,3> > >' in
> 'const class itk::Image<double,3> *' nicht moeglich
>         Kein benutzerdefinierter Konvertierungsoperator verfuegbar, der
> diese Konvertierung durchfuehren kann, oder der Operator kann nicht
> aufgerufen werden
> Fehler beim Ausführen von cl.exe.
> 
> MediFrame.exe - 1 Fehler, 0 Warnung(en)
>