[vtkusers] Newbie question about vtkMeshQuality

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Apr 26 15:58:08 EDT 2005


Andriy,

	Use the documentation of VTK. For example go to the doxygen of the 
class you wish to use:

http://www.vtk.org/doc/nightly/html/classvtkMeshQuality.html

	Then scroll, you'll find a 'Tests' section, which will lead you to:

http://www.vtk.org/doc/nightly/html/c2_vtk_t_8.html#c2_vtk_t_vtkMeshQuality

	In this case the choice is easy since there is only one test written in 
c++:

http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Cxx/MeshQuality.cxx?root=VTK&content-type=text/plain

This gives you an example on how to use this class:

<snip>
   vtkUnstructuredGridReader* mr = vtkUnstructuredGridReader::New();
   vtkUnstructuredGrid* ug;
   vtkMeshQuality* iq = vtkMeshQuality::New();

   mr->SetFileName( fname );
   mr->Update();

   ug = mr->GetOutput();    // <-- this is the line you need
   iq->SetInput( ug );
</snip>


HTH
Mathieu

Andriy Fedorov wrote:
> I know this is something very simple... I am trying to use 
> itkMeshQuality with a tetrahedral 3D mesh. Here's the code:
> 
> #include "vtkUnstructuredGrid.h"
> #include "vtkUnstructuredGridReader.h"
> #include "vtkMeshQuality.h"
> #include "vtkDataSet.h"
> #include <iostream>
> 
> int main(int argc, char **argv){
>  if(argc<2)
>    return -1;
> 
>  vtkUnstructuredGridReader *vtk_mesh_reader =
>    vtkUnstructuredGridReader::New();
>  vtkMeshQuality *mesh_qual = vtkMeshQuality::New();
>  vtkDataObject *output_mesh;
> 
>  vtk_mesh_reader->SetFileName(argv[1]);
>  vtk_mesh_reader->Update();
>  vtkDataSet *input_mesh = vtkDataSet::SafeDownCast(
>    vtk_mesh_reader);
>  mesh_qual->SetInput(input_mesh);
>  mesh_qual->Update();
>  output_mesh = mesh_qual->GetOutput();
> 
>  return 0;
> }
> 
> When I run it, I have failure here:
> 
> ERROR: In 
> /home/fedorov/SPL/slicer2/Lib/linux-x86/VTK/Common/vtkSource.cxx, line 384
> vtkMeshQuality (0x8069318): Required input 0 is not assigned. Skipping 
> execution.
> 
> I realize it shuld be possible to figure out from the code, but I 
> already spent couple of hours w/o success (my VTK experience approaches 
> 0).  Can somebody give me a quick hint what I am missing? Thanks a lot!
> 
> Andriy Fedorov
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic. 
> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 




More information about the vtkusers mailing list