[vtkusers] Noisy errors from vtkMINCImageReader when optional dimension attributes are missing
Elvis Stansvik
elvis.stansvik at orexplore.com
Wed Feb 24 09:31:41 EST 2016
2016-02-24 14:12 GMT+01:00 David Gobbi <david.gobbi at gmail.com>:
> 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.
>
Hm, I gave this a shot with
def _handleMINCError(obj, event):
pass
at module level and then
self.reader = vtkMINCImageReader()
self.reader.AddObserver(vtkCommand.ErrorEvent, _handleMINCError)
...
where I create the reader, but I'm still getting the errors printed.
I also tried with the string variant, using 'ErrorEvent' instead of
vtkCommand.ErrorEvent, and also giving a higher priority than the default
0.0.
Do things printed with vtkErrorMacro (like in vtkMINCImageAttributes)
really pass through this observer mechanism?
Thanks again for the help.
Elvis
> - 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/2279e64b/attachment.html>
More information about the vtkusers
mailing list