def plot_slices_invivo(legendOn=True): datatag = 'Vingmed data cardiac 2STB 1' #datatag = 'motion phantom 16x' #datatag.append('Vingmed data liver 2STB 1') #datatag.append('Vingmed data liver 2STB 2') #datatag.append('Vingmed data cardiac 2STB 1') #datatag.append('Vingmed data cardiac 4MLA 1') multiFile = True capon = CaponProcessor(datatag, multiFile) capon.sliceRangeStart.mvToMin() capon.sliceAngleStart.mvToMin() capon.sliceRangeEnd.mvToMax() capon.sliceAngleEnd.mvToMax() # set parameters for capon processor capon.image_idx.updateValue(0) capon.Ky.updateValue(2) # incoherent interpolation in range capon.Kx.updateValue(1) # in azimuth #capon.L.updateValue() capon.K.updateValue(2) capon.minDynRange.updateValue(-20) capon.maxDynRange.updateValue(20) capon.minDynRangeCapon.updateValue(-20) capon.maxDynRangeCapon.updateValue(20) capon.show_legends.updateValue(1) capon.apod.updateValue(0) #'Apodization: 0=uniform, 1=hamming' # position profile capon.profilePos = [-13.83174473246271, 96.50653026882506, 0.0] ax = [] for i in range(4): figure = pl.figure() ax.append(figure.add_subplot(1, 1, 1)) Nbs = [0, 3] for Nb in Nbs: capon.Nb.updateValue(Nb) if capon.Nb.value > 0: capon.d.updateValue(d_BS) else: capon.d.updateValue(d_ES) capon.processData() capon.plot(ax[0], ax[1], ax[2], ax[3]) if Nb == 0: x = capon.x_aslice das_profile = capon.img_das_aslice capon_profile = capon.img_cap_aslice else: capon_bs_profile = capon.img_cap_aslice fig = pl.figure() ax = fig.add_subplot(1, 1, 1) ax.plot(x, das_profile, c=(0.25, 0.25, 1.00), ls=':', lw=2.0, label='DAS') ax.plot(x, capon_profile, c=(1.00, 0.25, 0.25), ls='-.', lw=2.0, label='ES-Capon') ax.plot(x, capon_bs_profile, c=(0.0, 0.0, 0.0), ls='-', lw=2.0, label='BS-Capon') ax.set_ylim([capon.minDynRange.value, capon.maxDynRange.value]) ax.set_title('Lateral intensity at %d mm range' % capon.profilePos[1], fontsize='large') ax.set_xlabel('Width [mm]', fontsize='large') ax.set_ylabel('Lateral intensity [dB]', fontsize='large') if legendOn: ax.legend(loc=1, markerscale=0.5) #fig.savefig('invivo_slice', bbox_inches='tight', pad_inches=0.5) fig.savefig('invivo_slice.png', dpi=300, bbox_inches='tight', pad_inches=0.5)
def process_and_plot_invivo_image(Nb=0): datatag = 'Vingmed data cardiac 2STB 1' multiFile = True capon = CaponProcessor(datatag, multiFile) # set parameters for capon processor #capon.image_idx.updateValue(15) capon.sliceRangeStart.mvToMin() capon.sliceAngleStart.mvToMin() capon.sliceRangeEnd.mvToMax() capon.sliceAngleEnd.mvToMax() capon.Ky.updateValue(2) # incoherent interpolation in range capon.Kx.updateValue(1) # in azimuth capon.Nb.updateValue(Nb) if capon.Nb.value > 0: capon.d.updateValue(d_BS) else: capon.d.updateValue(d_ES) #capon.L.updateValue() capon.K.updateValue(2) capon.minDynRange.updateValue(-20) capon.maxDynRange.updateValue(20) capon.minDynRangeCapon.updateValue(-20) capon.maxDynRangeCapon.updateValue(20) capon.show_legends.updateValue(1) capon.apod.updateValue(0) #'Apodization: 0=uniform, 1=hamming' # position profile capon.profilePos = [-13.83174473246271, 96.50653026882506, 0.0] capon.processData() fig = [] ax = [] filename = [] if Nb == 0: filename = ['das_invivo', 'capon_invivo', 'ax1_invivo', 'ax2_invivo'] else: filename = ['das_invivo', 'capon_bs_invivo', 'ax1_bs_invivo', 'ax2_bs_invivo'] for i in range(4): figure = pl.figure() ax.append(figure.add_subplot(1,1,1)) fig.append(figure) axc = capon.plot(ax[0],ax[1],ax[2], ax[3]) #for i in range(2): #ax[i].invert_yaxis() #fig[i].tight_layout() from datetime import datetime d = datetime.time(datetime.now()) for i in range(4): if i is 1 and Nb is not 0: colorBarFig = pl.figure() cbar = colorBarFig.colorbar(axc, ticks=[capon.minDynRange.value, 0, capon.maxDynRange.value], orientation='vertical')#, shrink=0.5) cbar.ax.set_yticklabels([r'$\leq$%d dB'%capon.minDynRange.value, '0 dB', r'$\geq$%d dB'%capon.maxDynRange.value]) colorBarFig.savefig('colorBarInvivo.png', dpi=300, bbox_inches='tight', pad_inches=0.5) if i < 2: ax[i].set_aspect('equal')#, 'datalim') #fig[i].savefig('%s_axes%d_%d%d%d%d'%(filename, i, d.hour, d.minute, d.second, d.microsecond), bbox_inches='tight', pad_inches=0.5) fig[i].savefig('%s.png'%(filename[i]), dpi=300, bbox_inches='tight', pad_inches=0.5)
def process_and_plot_invivo_image(Nb=0): datatag = 'Vingmed data cardiac 2STB 1' multiFile = True capon = CaponProcessor(datatag, multiFile) # set parameters for capon processor #capon.image_idx.updateValue(15) capon.sliceRangeStart.mvToMin() capon.sliceAngleStart.mvToMin() capon.sliceRangeEnd.mvToMax() capon.sliceAngleEnd.mvToMax() capon.Ky.updateValue(2) # incoherent interpolation in range capon.Kx.updateValue(1) # in azimuth capon.Nb.updateValue(Nb) if capon.Nb.value > 0: capon.d.updateValue(d_BS) else: capon.d.updateValue(d_ES) #capon.L.updateValue() capon.K.updateValue(2) capon.minDynRange.updateValue(-20) capon.maxDynRange.updateValue(20) capon.minDynRangeCapon.updateValue(-20) capon.maxDynRangeCapon.updateValue(20) capon.show_legends.updateValue(1) capon.apod.updateValue(0) #'Apodization: 0=uniform, 1=hamming' # position profile capon.profilePos = [-13.83174473246271, 96.50653026882506, 0.0] capon.processData() fig = [] ax = [] filename = [] if Nb == 0: filename = ['das_invivo', 'capon_invivo', 'ax1_invivo', 'ax2_invivo'] else: filename = [ 'das_invivo', 'capon_bs_invivo', 'ax1_bs_invivo', 'ax2_bs_invivo' ] for i in range(4): figure = pl.figure() ax.append(figure.add_subplot(1, 1, 1)) fig.append(figure) axc = capon.plot(ax[0], ax[1], ax[2], ax[3]) #for i in range(2): #ax[i].invert_yaxis() #fig[i].tight_layout() from datetime import datetime d = datetime.time(datetime.now()) for i in range(4): if i is 1 and Nb is not 0: colorBarFig = pl.figure() cbar = colorBarFig.colorbar( axc, ticks=[capon.minDynRange.value, 0, capon.maxDynRange.value], orientation='vertical') #, shrink=0.5) cbar.ax.set_yticklabels([ r'$\leq$%d dB' % capon.minDynRange.value, '0 dB', r'$\geq$%d dB' % capon.maxDynRange.value ]) colorBarFig.savefig('colorBarInvivo.png', dpi=300, bbox_inches='tight', pad_inches=0.5) if i < 2: ax[i].set_aspect('equal') #, 'datalim') #fig[i].savefig('%s_axes%d_%d%d%d%d'%(filename, i, d.hour, d.minute, d.second, d.microsecond), bbox_inches='tight', pad_inches=0.5) fig[i].savefig('%s.png' % (filename[i]), dpi=300, bbox_inches='tight', pad_inches=0.5)
def plot_slices_invivo(legendOn=True): datatag = 'Vingmed data cardiac 2STB 1' #datatag = 'motion phantom 16x' #datatag.append('Vingmed data liver 2STB 1') #datatag.append('Vingmed data liver 2STB 2') #datatag.append('Vingmed data cardiac 2STB 1') #datatag.append('Vingmed data cardiac 4MLA 1') multiFile = True capon = CaponProcessor(datatag, multiFile) capon.sliceRangeStart.mvToMin() capon.sliceAngleStart.mvToMin() capon.sliceRangeEnd.mvToMax() capon.sliceAngleEnd.mvToMax() # set parameters for capon processor capon.image_idx.updateValue(0) capon.Ky.updateValue(2) # incoherent interpolation in range capon.Kx.updateValue(1) # in azimuth #capon.L.updateValue() capon.K.updateValue(2) capon.minDynRange.updateValue(-20) capon.maxDynRange.updateValue(20) capon.minDynRangeCapon.updateValue(-20) capon.maxDynRangeCapon.updateValue(20) capon.show_legends.updateValue(1) capon.apod.updateValue(0) #'Apodization: 0=uniform, 1=hamming' # position profile capon.profilePos = [-13.83174473246271, 96.50653026882506, 0.0] ax = [] for i in range(4): figure = pl.figure() ax.append(figure.add_subplot(1,1,1)) Nbs = [0, 3] for Nb in Nbs: capon.Nb.updateValue(Nb) if capon.Nb.value > 0: capon.d.updateValue(d_BS) else: capon.d.updateValue(d_ES) capon.processData() capon.plot(ax[0],ax[1],ax[2], ax[3]) if Nb == 0: x = capon.x_aslice das_profile = capon.img_das_aslice capon_profile = capon.img_cap_aslice else: capon_bs_profile = capon.img_cap_aslice fig = pl.figure() ax = fig.add_subplot(1,1,1) ax.plot(x, das_profile, c=(0.25,0.25,1.00), ls=':', lw=2.0, label='DAS') ax.plot(x, capon_profile, c=(1.00,0.25,0.25), ls='-.', lw=2.0, label='ES-Capon') ax.plot(x, capon_bs_profile, c=(0.0,0.0,0.0), ls='-', lw=2.0, label='BS-Capon') ax.set_ylim([capon.minDynRange.value, capon.maxDynRange.value]) ax.set_title('Lateral intensity at %d mm range'%capon.profilePos[1], fontsize='large') ax.set_xlabel('Width [mm]', fontsize='large') ax.set_ylabel('Lateral intensity [dB]', fontsize='large') if legendOn: ax.legend(loc=1, markerscale=0.5) #fig.savefig('invivo_slice', bbox_inches='tight', pad_inches=0.5) fig.savefig('invivo_slice.png', dpi=300, bbox_inches='tight', pad_inches=0.5)