DeMarcoLab/juno

Flat elements not working in ElementCreator

DavidDierickx opened this issue · 0 comments

Cannot create flat elements in ElementCreator (such as a simple diffraction grating). I believe this is because Napari can't draw the volume. I'm not 100% sure on if the cause is napari failing to display a valid element or if there is some error in the element creation itself.

Steps to recreate:

  • Open ElementCreator
  • Set exponent to 0

Error message received:

"WARNING: QWindowsWindow::setGeometry: Unable to set geometry 1920x1133+0+23 (frame: 1936x1172-8-8) on QWidgetWindow/"_QtMainWindowClassWindow" on "\.\DISPLAY1". Resulting geometry: 1920x1017+0+23 (frame: 1936x1056-8-8) margins: 8, 31, 8, 8 minimum size: 778x1133 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=794,1172 maxtrack=0,0)
ERROR: Failure to load viewer: Traceback (most recent call last):
File "C:\Users\Dadie1\Github\juno\juno\ui\ElementCreation.py", line 464, in update_visualisation
self.viewer.layers["Element"].data = arr3d
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\napari\layers\image\image.py", line 453, in data
self._update_dims()
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\napari\layers\base\base.py", line 705, in _update_dims
self.refresh() # This call is need for invalidate cache of extent in LayerList. If you remove it pleas ad another workaround.
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\napari\layers\base\base.py", line 1211, in refresh
self._update_thumbnail()
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\napari\layers\image\image.py", line 903, in _update_thumbnail
image = np.max(image, axis=0)
File "<array_function internals>", line 180, in amax
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\numpy\core\fromnumeric.py", line 2793, in amax
return _wrapreduction(a, np.maximum, 'max', axis, None, out,
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\numpy\core\fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

WARNING: Error drawing visual <Volume at 0x2083a87ef40>
WARNING: Traceback (most recent call last):
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\app\backends_qt.py", line 903, in paintGL
self._vispy_canvas.events.draw(region=None)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\util\event.py", line 453, in call
self._invoke_callback(cb, event)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\util\event.py", line 471, in _invoke_callback _handle_exception(self.ignore_callback_errors,
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback cb(event)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\scene\canvas.py", line 218, in on_draw
self._draw_scene()
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\scene\canvas.py", line 277, in _draw_scene
self.draw_visual(self.scene)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\scene\canvas.py", line 315, in draw_visual
node.draw()
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\scene\visuals.py", line 103, in draw
self._visual_superclass.draw(self)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\visuals\visual.py", line 451, in draw
self._program.draw(self._vshare.draw_mode,
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\visuals\shaders\program.py", line 102, in draw
Program.draw(self, *args, **kwargs)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\program.py", line 526, in draw
canvas.context.flush_commands()
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\context.py", line 172, in flush_commands self.glir.flush(self.shared.parser)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\glir.py", line 582, in flush
self._shared.flush(parser)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\glir.py", line 504, in flush
parser.parse(self._filter(self.clear(), parser))
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\glir.py", line 822, in parse
self._parse(command)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\glir.py", line 792, in _parse
ob.set_data(*args)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\glir.py", line 1647, in set_data
glTexSubImage3D(self._target, 0, x, y, z, format, gtype, data)
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\vispy\gloo\glir.py", line 1614, in glTexSubImage3D
_gl.glTexSubImage3D(target, level, xoffset, yoffset, zoffset,
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\OpenGL\latebind.py", line 43, in call
return self._finalCall( *args, **named )
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\OpenGL\wrapper.py", line 889, in wrapperCall
raise err
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\OpenGL\wrapper.py", line 882, in wrapperCall
result = wrappedOperation( *cArguments )
File "C:\Users\Dadie1\Anaconda3\envs\juno_custom\lib\site-packages\OpenGL\error.py", line 230, in glCheckError
raise self._errorClass(
OpenGL.error.GLError: GLError(
err = 1281,
description = b'invalid value',
baseOperation = glTexSubImage3D,
pyArgs = (
GL_TEXTURE_3D,
0,
0,
0,
0,
201,
201,
0,
GL_LUMINANCE,
GL_FLOAT,
array([], shape=(0, 201, 201, 1), dtype=float32),
),
cArgs = (
GL_TEXTURE_3D,
0,
0,
0,
0,
201,
201,
0,
GL_LUMINANCE,
GL_FLOAT,
array([], shape=(0, 201, 201, 1), dtype=float32),
),
cArguments = (
GL_TEXTURE_3D,
0,
0,
0,
0,
201,
201,
0,
GL_LUMINANCE,
GL_FLOAT,
array([], shape=(0, 201, 201, 1), dtype=float32),
)
)"