<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-02-24 15:31 GMT+01:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">2016-02-24 14:12 GMT+01:00 David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span>:<br></span><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Elvis,<div><br></div><div>You can silence all errors by adding an observer for the ErrorEvent.</div><div><br></div><div>def observer(obj, event):</div><div>    pass</div><div><br></div><div>reader.AddObserver(vtk.vtkCommand.ErrorEvent, observer)</div><div><br></div><div>This will cause all errors to be redirected to the observer.</div></div></blockquote><div><br></div></span><div>Hm, I gave this a shot with<br><br>def _handleMINCError(obj, event):<br>    pass<br><br></div><div>at module level and then<br><br>        self.reader = vtkMINCImageReader()<br>        self.reader.AddObserver(vtkCommand.ErrorEvent, _handleMINCError)<br>        ...<br><br></div><div>where I create the reader, but I'm still getting the errors printed.<br><br></div><div>I also tried with the string variant, using 'ErrorEvent' instead of vtkCommand.ErrorEvent, and also giving a higher priority than the default 0.0.<br></div><div><br></div><div>Do things printed with vtkErrorMacro (like in vtkMINCImageAttributes) really pass through this observer mechanism?<br></div></div></div></div></blockquote><div><br></div><div>Looking at the code, it seems that it should. So something else is fishy.<br><br></div><div>Grateful for any ideas.<br><br></div><div>Elvis<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Thanks again for the help.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Elvis<br></div></font></span><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span><font color="#888888"><div><br></div><div> - David</div></font></span><div><div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 24, 2016 at 5:41 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi all,<br><br></div>In reading a MINC (1.0) image, I get errors printed:<br><br>ERROR: In /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx, line 760<br>vtkMINCImageAttributes (0x1e5c010): The attribute zspace:step was not found.<br><br>ERROR: In /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx, line 760<br>vtkMINCImageAttributes (0x1e5c010): The attribute zspace:start was not found.<br><br>ERROR: In /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx, line 760<br>vtkMINCImageAttributes (0x1e5c010): The attribute yspace:step was not found.<br><br>ERROR: In /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx, line 760<br>vtkMINCImageAttributes (0x1e5c010): The attribute yspace:start was not found.<br><br>ERROR: In /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx, line 760<br>vtkMINCImageAttributes (0x1e5c010): The attribute xspace:step was not found.<br><br>ERROR: In /build/vtk6-GxcjsY/vtk6-6.2.0+dfsg1/IO/MINC/vtkMINCImageAttributes.cxx, line 760<br>vtkMINCImageAttributes (0x1e5c010): The attribute xspace:start was not found.<br><br></div>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<br><br>    vtkMINCImageAttributes::GetAttributeValueAsDouble<br><br></div>(which is used by the reader) unconditionally prints an error with vtkErrorMacro if the requested attribute does not exist :/<br><br></div>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.<br><br></div>Cheers,<br></div>Elvis<br></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>