def colocalization(self):
     imgR = self.Images[0].npimage
     imgG = self.Images[1].npimage
     self.m_colocalizationHeatmap = colocalizationDetection.coloc(imgR,imgG)
     #Histogram = colocalizationDetection.getAngleHistogram(imgR, imgG, self.m_dims)
     pearsonCoeff = colocalizationDetection.calcPearsonCorrelationCoeff(imgR, imgG)
     MR, MG = colocalizationDetection.calcMandersColocalizationCoeffs(imgR, imgG)
     overlap = colocalizationDetection.calcOverlapCoeff(imgR, imgG)
     self.recalculateResult()    
Exemple #2
0
	def colocalization(self):
		self.main_window.statusBar().showMessage('beginning colocalization calculations')
		imgR = self.m_npimages[0]
		imgG = self.m_npimages[1]
		#worker.smooth_image_according_to_heatmatrix(imgG, self.heatmatrix, self.m_factor)
		if self.heatmatrix != []:
			imgG = worker.smooth_image_according_to_heatmatrix_new(imgG, self.heatmatrix, self.m_factor)
		
		
		
		#Histogram = colocalizationDetection.getAngleHistogram(imgR, imgG, self.m_dims)
		pearsonCoeff = colocalizationDetection.calcPearsonCorrelationCoeff(imgR, imgG)
		MR, MG = colocalizationDetection.calcMandersColocalizationCoeffs(imgR, imgG)
		overlap = colocalizationDetection.calcOverlapCoeff(imgR, imgG)
		self.m_colocalizationHeatmap = colocalizationDetection.createColocHeatmap(imgR,imgG)
		self.m_colocalizationHeatmap = colocalizationDetection.coloc(imgR,imgG)
		self.recalculateResult()
		
		print overlap
		message='Pearson = %.3f '%pearsonCoeff+' Manders Green = %.3f '%MG+' Manders Red = %.3f '%MR+' overlap coeff= %.3f '%overlap
		self.main_window.statusBar().showMessage(message)
 def connectSignals(self):
     QtCore.QObject.connect(self.ui.actionColocalization, QtCore.SIGNAL("triggered()"), self.colocalization)
     QtCore.QObject.connect(self.ui.actionToggle_colocalization_heatmap, QtCore.SIGNAL("triggered()"), self.toggleColocalizationHeatmap)
     QtCore.QObject.connect(self.ui.actionToggle_Images, QtCore.SIGNAL("triggered()"), self.toggleImages)
     self.ui.setSigmaSlider.valueChanged.connect(self.setSigmaSliderChanged)
     self.ui.setSigmaSpinBox.valueChanged.connect(self.setSigmaSpinBoxChanged)
     self.ui.thresholdSlider.valueChanged.connect(self.thresholdSliderChanged)
     self.ui.thresholdSpinBox.valueChanged.connect(self.thresholdSpinBoxChanged)
     self.ui.doSmoothingButton.clicked.connect(self.doSmoothing)
     self.ui.thresholdButton.clicked.connect(self.doThreshold)
     self.ui.actionOpen_File.triggered.connect(self.getFilename)
     self.ui.actionSave_File.triggered.connect(self.saveFile)
     self.ui.actionSave_Features.triggered.connect(self.saveFeatures)
     self.ui.actionReset.triggered.connect(self.reset)
     self.ui.actionShow_covariance_matrix.triggered.connect(self.showCovar)
     self.ui.actionCalculate_distance_matrix.triggered.connect(self.calcDistanceMatrix)
     self.ui.actionShow_Heatmatrix.triggered.connect(self.showHeatmatrix)
     self.ui.addFileButton.clicked.connect(self.getFilename)
     self.ui.zoomInButton.clicked.connect(self.zoomInButton_clicked)
     self.ui.zoomOutButton.clicked.connect(self.zoomOutButton_clicked)
     self.ui.findConnectedComponentsButton.clicked.connect(self.findConnectedComponents)
     self.ui.cutOffButton.clicked.connect(self.cutOff)
     QtCore.QObject.connect(self.scene, QtCore.SIGNAL("cursorMoved(float, float, float)"), self.displayStats)
     
     if 0:
         self.addFile('/home/herrmannsdoerfer/Desktop/SampleCells/01-control/confocal/Pos075_S001C0 - AveProj.tif')
         self.addFile('/home/herrmannsdoerfer/Desktop/SampleCells/01-control/confocal/Pos075_S001C1 - AveProj.tif')
         
     
     if 0:
         self.addFile('/home/herrmannsdoerfer/Desktop/SampleCells/01-control/confocal/Pos081_S001C0 - AveProj.tif')
         self.addFile('/home/herrmannsdoerfer/Desktop/SampleCells/01-control/confocal/Pos081_S001C1 - AveProj.tif')
         imgR, imgG = colocalizationDetection.coloc(self.Images[0].npimage,self.Images[1].npimage)
         self.Images[0].npimage =imgR
         self.Images[1].npimage =imgG
         self.recalculateResult()
     
     if 0:
         self.Images.append(ImageData())
         self.Images.append(ImageData())
         imgR=np.zeros((3810,2960,4))
         imgG=np.zeros((3810,2960,4))
         self.m_numberImages=2
         imgR[...,2]=vigra.impex.readImage('/home/herrmannsdoerfer/Desktop/SampleCellsUnedited/01-control/storm/Pos11_2_aligned.tif', index = 0).swapaxes(0,1).view(np.ndarray).astype(np.float32)[:,:,0]
         imgG[...,1]=vigra.impex.readImage('/home/herrmannsdoerfer/Desktop/SampleCellsUnedited/01-control/storm/Pos11_2_aligned.tif', index = 1).swapaxes(0,1).view(np.ndarray).astype(np.float32)[:,:,0]
         self.Images[0].npimage =imgR
         self.Images[1].npimage =imgG
         self.showHeatmatrix()
     
     if 0:
         self.addFile('/home/herrmannsdoerfer/master/workspace/PythonPrograms/Colocalization/ColocBlockRed.txt')
         self.addFile('/home/herrmannsdoerfer/master/workspace/PythonPrograms/Colocalization/ColocBlockGreen.txt')
         self.showHeatmatrix()
         
     if 0:
         self.addFile('/home/herrmannsdoerfer/master/workspace/PythonPrograms/Colocalization/ColocBlockRed.txt')
         self.addFile('/home/herrmannsdoerfer/master/workspace/PythonPrograms/Colocalization/ColocBlockGreen.txt')
         #self.showHeatmatrix()
         imgR, imgG = colocalizationDetection.Colocdetection(self.Images[0].npimage,self.Images[1].npimage)
         self.Images[0].npimage =imgR
         self.Images[1].npimage =imgG
         self.recalculateResult()