[vtkusers] vtk errors and function return values

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Mar 3 05:22:00 EST 2009


On Mon, Mar 2, 2009 at 10:58 PM, Greg Book <gbook at gbook.org> wrote:
> I'm trying to figure out how error reporting works in VTK. A lot of VTK
> functions like SetInputConnection do not seem to return anything, either on
> error or success. If my program is going through its pipeline, how can I
> check for an error in one of the steps? Like if I specify a dicom file in
> the dicom reader, how do I know if it was read successfully?
>
> Basically I have a very simple program and I'm getting a blank screen, but
> I'd like to know how to debug it. Like how does one check if objects are
> valid along the pipeline?

Any time an error it found a vtkErrorMacro (it's a macro) is used. It
will trigger a specific event: ErrorEvent. You could watch that. On
win32 system a default window should pop up and display the error log.
On *nix it is displayed on the console.

IO implementation in VTK should provide a CanRead function so that a
user can check whether a file can be read. Be careful with the return
code, this is not just a boolean (check the doc).

HTH
-- 
Mathieu



More information about the vtkusers mailing list