Commit 66c3a240 authored by Thomas Vincent's avatar Thomas Vincent

Scale 3d view display if largest axis is more than 3 times the smallest

one
parent 7fe68903
......@@ -61,6 +61,17 @@ except ImportError:
SFViewParamTree = None
# Monkey patch ScalarFieldView
from pkg_resources import parse_version
import silx
if parse_version(silx.version) < parse_version('0.10.0'):
from silx.gui.plot3d.scene import transform
class ScalarFieldView(ScalarFieldView):
def setOuterScale(self, sx=1., sy=1., sz=1.):
self._bbox.transforms = [transform.Scale(sx, sy, sz)]
def _useOpenGL():
"""Returns True if OpenGL is available and enabled
......@@ -508,7 +519,11 @@ class QSpaceView(Qt.QMainWindow):
widget.setText(label)
if self.__view3d is not None:
# swap scale, transition, labels as it is follows x, y, z convention
extents = np.array(binSteps) * np.array(qspace.shape)[::-1]
if extents.max() / extents.min() > 3.:
_logger.info("Rescale 3D View to display data as a cube")
self.__view3d.setOuterScale(*(1. / extents))
self.__view3d.setScale(*binSteps)
self.__view3d.setTranslation(*minBinEdge)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment