Example #1
0
    def add_data(self, data):

        if data in self._layer_artist_container:
            return True

        if data.ndim != 3:
            QMessageBox.critical(self, "Error",
                                 "Data should be 3-dimensional ({0} dimensions found)".format(data.ndim),
                                 buttons=QMessageBox.Ok)
            return False

        if len(self._layer_artist_container) > 0:
            required_shape = self._layer_artist_container[0].shape
            if data.shape != required_shape:
                QMessageBox.critical(self, "Error",
                                     "Shape of dataset ({0}) does not agree "
                                     "with shape of existing datasets in volume "
                                     "rendering ({1})".format(data.shape, required_shape),
                                     buttons=QMessageBox.Ok)
                return False

        layer_artist = VolumeLayerArtist(data, vispy_viewer=self)

        if len(self._layer_artist_container) == 0:
            self._options_widget.set_limits(*layer_artist.bbox)

        self._layer_artist_container.append(layer_artist)

        return True
Example #2
0
    def __init__(self, *args, **kwargs):
        super(VispyVolumeViewer, self).__init__(*args, **kwargs)
        if not OPENGL_INSTALLED:
            self.close()
            QMessageBox.critical(self, "Error",
                                 "The PyOpenGL package is required for the "
                                 "3D volume rendering viewer",
                                 buttons=QMessageBox.Ok)

        # TODO: how to get text value from volume_toolbar...
        self.show_status('hello')