diff --git a/volumina/colortables.py b/volumina/colortables.py index 9bd7df3fc..e5cd7ac70 100644 --- a/volumina/colortables.py +++ b/volumina/colortables.py @@ -113,6 +113,7 @@ def partlyJetTransparent(N=256, ratio = 2./3): QColor(240, 230, 140).rgba(), #khaki QColor(69, 69, 69).rgba()] # dark grey + random256 = [ QColor(201, 200, 200).rgba(), QColor(0, 0, 255).rgba(), @@ -392,7 +393,25 @@ def create_random_8bit(): '''Create a colortable suitable for 8bit data. Creates a pseudo-random colortable in the 8bit range''' - return random256; + + # don't return random256 directly. Otherwise the list will be changed by some code directly, + # and everything gets messed up. + # use a creator instead + #return random256; + return [color for color in random256] + +def create_random_8bit_zero_transparent(): + '''Create a colortable suitable for 8bit data. + + Creates a pseudo-random colortable in the 8bit range + Replace zero(th) Color with transparent''' + temp = random256 + temp[0] = QColor(0, 0, 0, 0).rgba() + + # don't return random256 directly. Otherwise the list will be changed by some code directly, + # and everything gets messed up. + # use a creator instead + return [color for color in temp] def create_random_16bit(): '''Create a colortable suitable for 16bit data. diff --git a/volumina/pixelpipeline/imagesources.py b/volumina/pixelpipeline/imagesources.py index ebd8f99b6..aec48abd6 100644 --- a/volumina/pixelpipeline/imagesources.py +++ b/volumina/pixelpipeline/imagesources.py @@ -418,11 +418,14 @@ def toImage( self ): tImg = time.time() img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32) if not issubclass( a.dtype.type, np.integer ): - raise NotImplementedError() #FIXME: maybe this should be done in a better way using an operator before the colortable request which properly handles #this problem warnings.warn("Data for colortable layers cannot be float, casting",RuntimeWarning) a = np.asanyarray(a, dtype=np.uint32) + warnings.warn("As a workaround, volumina/volumina/pixelpipeline/imagesource.py, comment the raise NotImplementedError; Or adjust your data-set to be np.integer conform",RuntimeWarning) + #TODO raise Error just stopped but doesn't handle anything. + # The Warning and conversion did the job + raise NotImplementedError() # If we have a masked array with a non-trivial mask, ensure that mask is made transparent. _colorTable = self._colorTable diff --git a/volumina/sliceSelectorHud.py b/volumina/sliceSelectorHud.py index 313583e09..21e684a7f 100644 --- a/volumina/sliceSelectorHud.py +++ b/volumina/sliceSelectorHud.py @@ -434,6 +434,7 @@ def _get_pos_widget(name, backgroundColor, foregroundColor): spinbox = DelayedSpinBox(750) spinbox.setAlignment(Qt.AlignCenter) + #set the information that will be viewed, if hovered over the Coordination Box spinbox.setToolTip("{0} Spin Box".format(name)) spinbox.setButtonSymbols(QAbstractSpinBox.NoButtons) spinbox.setMaximumHeight(20) @@ -490,6 +491,16 @@ def createQuadViewStatusBar(self, xbackgroundColor, xforegroundColor, ybackgroundColor, yforegroundColor, zbackgroundColor, zforegroundColor): + """ + adds the following properties to the lower part of the view + X value (X Spin Box) + Y value + Z value + Busy-waiting box (invisible) + Position + Time Spin Box + + """ self.xLabel, self.xSpinBox = _get_pos_widget('X', xbackgroundColor, xforegroundColor) @@ -500,6 +511,11 @@ def createQuadViewStatusBar(self, zbackgroundColor, zforegroundColor) + #partial connection means: + #The partial object is created by definition of the connection, + #not when the event is triggered. + #That means: _handlePositionBoxValueChanged() is called when connecting, so that it will + #always handle the contents that have changed in the viewer. self.xSpinBox.delayedValueChanged.connect( partial(self._handlePositionBoxValueChanged, 'x') ) self.ySpinBox.delayedValueChanged.connect( partial(self._handlePositionBoxValueChanged, 'y') ) self.zSpinBox.delayedValueChanged.connect( partial(self._handlePositionBoxValueChanged, 'z') ) @@ -640,6 +656,11 @@ def _onTimeSliderChanged(self): self.timeSpinBox.setValue(self.timeSlider.value()) def _handlePositionBoxValueChanged(self, axis, value): + """ + Take the old values of the spinBoxes + and change the value of the given axis + Emit the signal with the new position + """ new_position = [self.xSpinBox.value(), self.ySpinBox.value(), self.zSpinBox.value()] changed_axis = ord(axis) - ord('x') new_position[changed_axis] = value diff --git a/volumina/widgets/.gitignore b/volumina/widgets/.gitignore new file mode 100644 index 000000000..882c025cf --- /dev/null +++ b/volumina/widgets/.gitignore @@ -0,0 +1 @@ +session.vim