diff --git a/AmpScan/AmpScanGUI.py b/AmpScan/AmpScanGUI.py index 26b93fca5f817e1797e9b21d3e8aacff4db6d5b7..4b244217db64e6a29321bd95e75f06a5f6c17914 100644 --- a/AmpScan/AmpScanGUI.py +++ b/AmpScan/AmpScanGUI.py @@ -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) diff --git a/AmpScan/analyse.py b/AmpScan/analyse.py index ea76f20454be079848fab1081bb3ce197413d398..67c59bd3467ebf2e74536043617f60e63294e125 100644 --- a/AmpScan/analyse.py +++ b/AmpScan/analyse.py @@ -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'): diff --git a/AmpScan/core.py b/AmpScan/core.py index 0875d7e4e3617b954cdaca861ebe7b6d317ce4a6..027a86dec54733a2dadcc52f45560f772baf777c 100644 --- a/AmpScan/core.py +++ b/AmpScan/core.py @@ -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']: diff --git a/AmpScan/pressSens.py b/AmpScan/pressSens.py index eb966fb71e1905c19847f528ab401448adaf2955..e2c2c94304ae2305dc6610858b484288875a240d 100644 --- a/AmpScan/pressSens.py +++ b/AmpScan/pressSens.py @@ -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)