def testAutoThreshold(self): """Test that the auto thresholding gives the same results""" for key, data in ThresholdingResults.items(): ch1 = getChannel(key, 0) ch2 = getChannel(key, 1) th1, th2 = data autothreshold = vtk.vtkImageAutoThresholdColocalization() autothreshold.AddInput(ch1) autothreshold.AddInput(ch2) autothreshold.Update() resultth1 = autothreshold.GetCh1ThresholdMax() resultth2 = autothreshold.GetCh2ThresholdMax() self.assertEqual((th1, th2), (resultth1, resultth2), "Our autothresholding produces different results than ImageJ's (%d, %d != %d, %d)" % (resultth1, resultth2, th1, th2))
def testAutoThreshold(self): """Test that the auto thresholding gives the same results""" for key, data in ThresholdingResults.items(): ch1 = getChannel(key, 0) ch2 = getChannel(key, 1) th1, th2 = data autothreshold = vtk.vtkImageAutoThresholdColocalization() autothreshold.AddInput(ch1) autothreshold.AddInput(ch2) autothreshold.Update() resultth1 = autothreshold.GetCh1ThresholdMax() resultth2 = autothreshold.GetCh2ThresholdMax() self.assertEqual((th1, th2), ( resultth1, resultth2 ), "Our autothresholding produces different results than ImageJ's (%d, %d != %d, %d)" % (resultth1, resultth2, th1, th2))
reader2.SetUpdateTimePoint(5) reader2.Update() ch2=reader2.GetOutput() #w1=vtk.vtkXMLImageDataWriter() #w1.SetFileName("Ch1.vti") #w1.SetInput(ch1) #w1.Write() #w2=vtk.vtkXMLImageDataWriter() #w2.SetFileName("Ch2.vti") #w2.SetInput(ch2) #w2.Write() coloc=vtk.vtkImageAutoThresholdColocalization() coloc.AddInput(ch1) coloc.AddInput(ch2) coloc.Update() print coloc data=coloc.GetOutput(0) plotdata=coloc.GetOutput(1) print "Plot data=",plotdata i=0 writer=vtk.vtkXMLImageDataWriter() pdata=data.GetPointData() name=None if pdata: name=pdata.GetScalars().GetName()
reader2.SetFileName("/home/kalpaha/BioImageXD/Data/sample2.lsm") reader2.SetUpdateChannel(1) reader2.SetUpdateTimePoint(5) reader2.Update() ch2 = reader2.GetOutput() #w1=vtk.vtkXMLImageDataWriter() #w1.SetFileName("Ch1.vti") #w1.SetInput(ch1) #w1.Write() #w2=vtk.vtkXMLImageDataWriter() #w2.SetFileName("Ch2.vti") #w2.SetInput(ch2) #w2.Write() coloc = vtk.vtkImageAutoThresholdColocalization() coloc.AddInput(ch1) coloc.AddInput(ch2) coloc.Update() print coloc data = coloc.GetOutput(0) plotdata = coloc.GetOutput(1) print "Plot data=", plotdata i = 0 writer = vtk.vtkXMLImageDataWriter() pdata = data.GetPointData() name = None if pdata: name = pdata.GetScalars().GetName()