Skip to content
Snippets Groups Projects
Commit 8ca808aa authored by Joshua Steer's avatar Joshua Steer
Browse files

Updated colourmap consistency throughout the code

parent 5fb65dd7
No related branches found
No related tags found
No related merge requests found
......@@ -20,8 +20,8 @@ class AmpScanGUI(QMainWindow):
self.vtkWidget = qtVtkWindow()
self.mainWidget = QWidget()
self.AmpObj = None
self.CMap = np.array([[212.0, 221.0, 225.0],
[31.0, 73.0, 125.0]])/255.0
# self.CMap = np.array([[212.0, 221.0, 225.0],
# [31.0, 73.0, 125.0]])/255.0
self.setCentralWidget(self.mainWidget)
self.createActions()
self.createMenus()
......@@ -76,7 +76,7 @@ class AmpScanGUI(QMainWindow):
self.RegObj = regObject(self.AmpObj)
self.RegObj.registration(steps=5, baseline='socket', target='limb',
reg = 'reglimb', direct=True)
self.RegObj.addActor(stype='reglimb', CMap=self.CMap)
self.RegObj.addActor(stype='reglimb', CMap=self.AmpObj.CMapN2P)
self.vtkWidget.renderActors(self.AmpObj.actors, ['reglimb',], shading=False)
self.vtkWidget.setScalarBar(self.AmpObj.actors['reglimb'])
......@@ -89,7 +89,7 @@ class AmpScanGUI(QMainWindow):
self.vtkWidget.setnumViewports(1)
self.AmpObj.addFE([FEname[0],])
self.AmpObj.lp_smooth('FE', n=1)
self.AmpObj.addActor(stype='FE', CMap=self.CMap)
self.AmpObj.addActor(stype='FE', CMap=self.AmpObj.CMap02P)
self.AmpObj.actors['FE'].setScalarRange(smin=0.0, smax=50)
self.vtkWidget.renderActors(self.AmpObj.actors, ['FE',])
self.vtkWidget.setScalarBar(self.AmpObj.actors['FE'])
......@@ -104,7 +104,7 @@ class AmpScanGUI(QMainWindow):
self.pSense.calcFaces(d=5)
self.pSense.importVert(vName[0])
self.pSense.importPress(pName[0])
self.pSense.addActor(CMap=self.CMap)
self.pSense.addActor(CMap=self.AmpObj.CMap02P)
self.AmpObj.actors['antS'] = self.pSense.actors['antS']
self.AmpObj.actors['socket'].setColor([1.0, 1.0, 1.0])
self.AmpObj.actors['socket'].setOpacity(1.0)
......
......@@ -15,7 +15,7 @@ import AmpScan.cython_ext as cyext
class analyseMixin(object):
def plot_slices(self, axis='Z', slWidth=3, stype=0):
def plot_slices(self, axis='Z', slWidth=10, stype=0):
if isinstance(stype, int):
stype = self.stype[stype]
data = getattr(self, stype)
......@@ -24,7 +24,7 @@ class analyseMixin(object):
# Define max Z from lowest point on brim
maxZ = data['vert'][data['edges'][ind, :], 2].min()
fig = plt.figure()
fig.set_size_inches(12, 9)
fig.set_size_inches(6, 4.5)
ax1 = fig.add_subplot(221, projection='3d')
ax2 = fig.add_subplot(222)
......@@ -60,13 +60,12 @@ class analyseMixin(object):
ax3.set_axis_off()
# Rendering of the rectification map
ax4 = fig.add_subplot(2,2,4)
CMap = np.array([[212.0, 221.0, 225.0],
[31.0, 73.0, 125.0]])/255.0
self.addActor(stype='reglimb', CMap = CMap)
self.addActor(stype='reglimb', CMap = self.CMapN2P)
Im = self.genIm(actor=['reglimb'])
ax4.imshow(Im, None)
ax4.set_axis_off()
plt.tight_layout()
plt.show()
@staticmethod
def create_slices(data, slices, axis='Z'):
......
......@@ -47,6 +47,14 @@ class AmpObject(alignMixin, trimMixin, smoothMixin, analyseMixin,
visMixin, feMixin, socketDesignMixin):
def __init__(self, Data, stype):
c1 = [31.0, 73.0, 125.0]
c3 = [170.0, 75.0, 65.0]
c2 = [212.0, 221.0, 225.0]
CMap1 = np.c_[[np.linspace(st, en) for (st, en) in zip(c1, c2)]]
CMap2 = np.c_[[np.linspace(st, en) for (st, en) in zip(c2, c3)]]
CMap = np.c_[CMap1[:, :-1], CMap2]
self.CMapN2P = np.transpose(CMap)/255.0
self.CMap02P = np.flip(np.transpose(CMap1)/255.0, axis=0)
self.stype = []
self.actors = {}
if stype in ['limb', 'socket', 'reglimb', 'regsocket', 'MRI']:
......
......@@ -91,16 +91,16 @@ class pressSense(object):
# Define face
f0 = np.array([[0, cols+1, 1],
[1, cols+1, cols+2]])
for row in xrange(rows):
for col in xrange(cols):
for row in range(rows):
for col in range(cols):
ind = row*cols*2 + col*2
ind2 = row*(cols+1) + col
f[[ind, ind+1], :] = f0 + ind2
ind = np.arange(0, cols*2*d, cols*2)[:, None]
for row in xrange(15):
for row in range(15):
inds = np.array([np.arange(2*d) + d*row*cols*2]*d)
inds += np.arange(0, cols*2*d, cols*2)[:, None]
for col in xrange(3):
for col in range(3):
sF[row*3 + col, :] = inds.flatten()
inds += 2*d
self.antS['faces'] = f
......@@ -120,16 +120,16 @@ class pressSense(object):
sF = np.zeros([45, 2*d**2], dtype=np.int64)
f0 = np.array([[0, cols+1, 1],
[1, cols+1, 2]])
for row in xrange(rows):
for col in xrange(cols):
for row in range(rows):
for col in range(cols):
ind = row*cols*2 + col*2
ind2 = row*(cols+1) + col
f[[ind, ind+1], :] = f0 + ind2
ind = np.arange(0, cols*2*d, cols*2)[:, None]
for row in xrange(15):
for row in range(15):
inds = np.array([np.arange(2*d) + d*row*cols*2]*d)
inds += np.arange(0, cols*2*d, cols*2)[:, None]
for col in xrange(3):
for col in range(3):
sF[row*3 + col, :] = inds.flatten()
inds += 2*d
self.antS['faces'] = f
......@@ -199,7 +199,7 @@ class pressSense(object):
self.lut = vtk.vtkLookupTable()
self.lut.SetNumberOfTableValues(bands)
self.lut.Build()
for i in xrange(bands):
for i in range(bands):
rgb = list(self.ctf.GetColor(float(i) / bands)) + [1]
self.lut.SetTableValue(i, rgb)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment