[vtkusers] Newbie question about vtkMeshQuality

Andriy Fedorov fedorov at bwh.harvard.edu
Tue Apr 26 15:56:50 EDT 2005


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



More information about the vtkusers mailing list