def test(): from PyMca5.PyMca import SpecfitFunctions a = SpecfitFunctions.SpecfitFunctions() x = numpy.arange(1000).astype(numpy.float64) p1 = numpy.array([1500, 100., 50.0]) p2 = numpy.array([1500, 700., 50.0]) y = a.gauss(p1, x) + 1 y = y + a.gauss(p2, x) fit = SimpleFit() fit.importFunctions(SpecfitFunctions) fit.setFitFunction('Gaussians') #fit.setBackgroundFunction('Gaussians') #fit.setBackgroundFunction('Constant') fit.setData(x, y) fit.fit() print("Expected parameters 1500,100.,50.0, 1500,700.,50.0") print("Found: ", fit.paramlist) from PyMca5.PyMca import PyMcaQt as qt from PyMca5.PyMca import Parameters a = qt.QApplication(sys.argv) a.lastWindowClosed.connect(a.quit) w = Parameters.Parameters() w.fillfromfit(fit.paramlist) w.show() a.exec_()
def unitTest_FileSystemBrowser(): app = qt.QApplication([]) browser = FileSystemBrowser() browser.addSignal.connect(DummyNotifier.signalReceived) browser.show() app.exec_()
def unitTest_BandPassFilter(): dummy = DummyNotifier() app = qt.QApplication([]) filterWindow = ImageAlignmenWindow() # filterWindow.exportSelectedSignal.connect(dummy.signalReceived) # filterWindow.exportCurrentSignal.connect(dummy.signalReceived) filterWindow.show() app.exec_()
def test(): from PyMca5 import StackBase testFileName = "TiffTest.tif" nrows = 2000 ncols = 2000 #create a dummy stack with 100 images nImages = 100 imagestack = True a = numpy.ones((nrows, ncols), numpy.float32) if not os.path.exists(testFileName): print("Creating test filename %s" % testFileName) tif = TiffIO.TiffIO(testFileName, mode='wb+') for i in range(nImages): data = (a * i).astype(numpy.float32) if i == 1: tif = TiffIO.TiffIO(testFileName, mode='rb+') tif.writeImage(data, info={'Title': 'Image %d of %d' % (i + 1, nImages)}) tif = None stackData = TiffStack(imagestack=imagestack) stackData.loadFileList([testFileName], dynamic=True) if 0: stack = StackBase.StackBase() stack.setStack(stackData) print("This should be 0 = %f" % stack.calculateROIImages(0, 0)['ROI'].sum()) print("This should be %f = %f" %\ (a.sum(),stack.calculateROIImages(1, 2)['ROI'].sum())) if imagestack: print("%f should be = %f" %\ (stackData.data[0:10,:,:].sum(), stack.calculateROIImages(0, 10)['ROI'].sum())) print("Test small ROI 10 should be = %f" %\ stackData.data[10:11,[10],11].sum()) print("Test small ROI 40 should be = %f" %\ stackData.data[10:11,[10,12,14,16],11].sum()) else: print("%f should be = %f" %\ (stackData.data[:,:, 0:10].sum(), stack.calculateROIImages(0, 10)['ROI'].sum())) print("Test small ROI %f" %\ stackData.data[10:11,[29],:].sum()) else: from PyMca5.PyMca import PyMcaQt as qt from PyMca5.PyMca import QStackWidget app = qt.QApplication([]) w = QStackWidget.QStackWidget() print("Setting stack") w.setStack(stackData) w.show() app.exec_()
macro3_Action.setStatusTip('CHU Heart Segmentation') qt.QObject.connect(macro3_Action, qt.SIGNAL("triggered()"), self.mainWidget.macro3_GUI) macroMenu.addAction(macro3_Action) macro5_Action = qt.QAction('&CHU Lung Blood Volume', self) macro5_Action.setStatusTip('CHU Lung Blood Volume') qt.QObject.connect(macro5_Action, qt.SIGNAL("triggered()"), self.mainWidget.macro5_GUI) macroMenu.addAction(macro5_Action) # macro4_Action = qt.QAction('&Bronchi Study', self) # macro4_Action.setStatusTip('Bronchi Study') # qt.QObject.connect(macro4_Action, qt.SIGNAL("triggered()"), self.mainWidget.macro4_GUI) # macroMenu.addAction(macro4_Action) macro1_Action = qt.QAction('&Image Analysis Diffusion', self) macro1_Action.setStatusTip('Concentration Analysis Diffusion Study') qt.QObject.connect(macro1_Action, qt.SIGNAL("triggered()"), self.mainWidget.macro1_GUI) macroMenu.addAction(macro1_Action) if __name__ == "__main__": app = qt.QApplication(["-display"]) foo = MyMainWindow() foo.resize(400, 400) foo.show() sys.exit(app.exec_())