Commit 0530d8671a007447b576eaf8d3a56f16d249f87f

Authored by tfmoraes
1 parent 65bd8595

ENH: Some little enhancements in the methods that creates 8 bits color table

Showing 1 changed file with 4 additions and 4 deletions   Show diff stats
invesalius/data/volume.py
... ... @@ -246,11 +246,11 @@ class Volume():
246 246 colors = zip(r,g,b)
247 247 ww = self.config['ww']
248 248 wl = self.TranslateScale(scale, self.config['wl'])
249   - inc = ww / 254.0
250   - for i,rgb in enumerate(colors):
251   - color_transfer.AddRGBPoint((wl - ww/2) + (i * inc), *[i/255.0 for i in rgb])
  249 + init = wl - ww/2.0
  250 + inc = ww / (len(colors) - 1.0)
  251 + for n,rgb in enumerate(colors):
  252 + color_transfer.AddRGBPoint(init + n * inc, *[i/255.0 for i in rgb])
252 253 self.color_transfer = color_transfer
253   - return color_transfer
254 254  
255 255 def CreateOpacityTable(self, scale):
256 256 if self.opacity_transfer_func:
... ...