Esempio n. 1
0
class ImageOperationsTest(unittest.TestCase):
    def setUp(self):
        pass

    def testloadLut(self):

        # Test that a sequence of loadLut() and saveLUT() produces a file identical to the original

        testFileIn = bioimagepath + "/LUT/ICA.lut"
        testFileOut = bioimagepath + "/unittest/testdata/Temp/.tmp_bxdtestloadLut.lut"
        testctf = ImageOperations.loadLUT(testFileIn)
        ImageOperations.saveLUT(testctf, testFileOut)
        self.assertEqual(filecmp.cmp(testFileIn, testFileOut), 1)
        os.remove(testFileOut)

    def testpaintCTFValues(self):

        try:
            wxApp = wx.App()
        # gives nothing, because segmentation faults thrown by wx.App() cannot be caught
        except Exception, exc:
            print exc
        testCTFFileIn = bioimagepath + "/LUT/ICA.lut"
        testBMPOriginal = bioimagepath + "/unittest/testdata/ComparisonData/Images/paintCTFValues.bmp"
        testTemporaryBmp = bioimagepath + "/unittest/testdata/Temp/.tmp_bxdtestpaintCTFValues.bmp"

        testCTF = ImageOperations.loadLUT(testCTFFileIn)
        bitMap = ImageOperations.paintCTFValues(testCTF, paintScale=0)
        bitMap.SaveFile(testTemporaryBmp, wx.BITMAP_TYPE_BMP)

        self.assertTrue(filecmp.cmp(testBMPOriginal, testTemporaryBmp))
        os.remove(testTemporaryBmp)
	def testloadLut(self):
		
		# Test that a sequence of loadLut() and saveLUT() produces a file identical to the original
		
		testFileIn = bioimagepath + "/LUT/ICA.lut"
		testFileOut = bioimagepath + "/unittest/testdata/Temp/.tmp_bxdtestloadLut.lut"
		testctf = ImageOperations.loadLUT(testFileIn)
		ImageOperations.saveLUT(testctf, testFileOut)
		self.assertEqual(filecmp.cmp(testFileIn, testFileOut), 1)
		os.remove(testFileOut)
Esempio n. 3
0
    def testloadLut(self):

        # Test that a sequence of loadLut() and saveLUT() produces a file identical to the original

        testFileIn = bioimagepath + "/LUT/ICA.lut"
        testFileOut = bioimagepath + "/unittest/testdata/Temp/.tmp_bxdtestloadLut.lut"
        testctf = ImageOperations.loadLUT(testFileIn)
        ImageOperations.saveLUT(testctf, testFileOut)
        self.assertEqual(filecmp.cmp(testFileIn, testFileOut), 1)
        os.remove(testFileOut)
name=None
if pdata:
    name=pdata.GetScalars().GetName()
    if name:
	name+=".vti"
if not name:
    name="unnamed.vti"%i

print "Writing",name,"..."
writer.SetFileName(name)
writer.SetInput(data)
writer.Write()

writer=vtk.vtkXMLImageDataWriter()
writer.SetInput(plotdata)
writer.SetFileName("scatterplot.vti")
writer.Write()

lut=ImageOperations.loadLUT("../LUT/Amber.lut")

maptocol=vtk.vtkImageMapToColors()
maptocol.SetLookupTable(lut)
maptocol.SetInput(plotdata)
maptocol.Update()

pngwriter=vtk.vtkPNGWriter()
#pngwriter.SetInput(maptocol.GetOutput())
pngwriter.SetInput(plotdata)
pngwriter.SetFileName("scatterplot.png")
pngwriter.Write()
Esempio n. 5
0
name = None
if pdata:
    name = pdata.GetScalars().GetName()
    if name:
        name += ".vti"
if not name:
    name = "unnamed.vti" % i

print "Writing", name, "..."
writer.SetFileName(name)
writer.SetInput(data)
writer.Write()

writer = vtk.vtkXMLImageDataWriter()
writer.SetInput(plotdata)
writer.SetFileName("scatterplot.vti")
writer.Write()

lut = ImageOperations.loadLUT("../LUT/Amber.lut")

maptocol = vtk.vtkImageMapToColors()
maptocol.SetLookupTable(lut)
maptocol.SetInput(plotdata)
maptocol.Update()

pngwriter = vtk.vtkPNGWriter()
#pngwriter.SetInput(maptocol.GetOutput())
pngwriter.SetInput(plotdata)
pngwriter.SetFileName("scatterplot.png")
pngwriter.Write()