[vtkusers] Noisy errors from vtkMINCImageReader when optional dimension attributes are missing

David Gobbi david.gobbi at gmail.com
Wed Feb 24 08:12:25 EST 2016


Hi Elvis,

You can silence all errors by adding an observer for the ErrorEvent.

def observer(obj, event):
    pass

reader.AddObserver(vtk.vtkCommand.ErrorEvent, observer)

This will cause all errors to be redirected to the observer.

 - David


On Wed, Feb 24, 2016 at 5:41 AM, Elvis Stansvik <
elvis.stansvik at orexplore.com> wrote:

> Hi all,
>
> In reading a MINC (1.0) image, I get errors printed:
>
> ERROR: In
> /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx,
> line 760
> vtkMINCImageAttributes (0x1e5c010): The attribute zspace:step was not
> found.
>
> ERROR: In
> /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx,
> line 760
> vtkMINCImageAttributes (0x1e5c010): The attribute zspace:start was not
> found.
>
> ERROR: In
> /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx,
> line 760
> vtkMINCImageAttributes (0x1e5c010): The attribute yspace:step was not
> found.
>
> ERROR: In
> /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx,
> line 760
> vtkMINCImageAttributes (0x1e5c010): The attribute yspace:start was not
> found.
>
> ERROR: In
> /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx,
> line 760
> vtkMINCImageAttributes (0x1e5c010): The attribute xspace:step was not
> found.
>
> ERROR: In
> /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx,
> line 760
> vtkMINCImageAttributes (0x1e5c010): The attribute xspace:start was not
> found.
>
> But these attributes are optional (and the reader correctly assumes 0 for
> the start attributes, and 1.0 for the step attributes). But it seems the
> function
>
>     vtkMINCImageAttributes::GetAttributeValueAsDouble
>
> (which is used by the reader) unconditionally prints an error with
> vtkErrorMacro if the requested attribute does not exist :/
>
> Is there any way (from Python, VTK 6.2) that I can selectively suppress
> this somehow? I'd rather not have stuff printed on stderr for things that
> are harmless.
>
> Cheers,
> Elvis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160224/61582e88/attachment.html>


More information about the vtkusers mailing list