Exemplo n.º 1
0
    def testBasic(self):
        data = numpy.random.random((100, 100)).astype(numpy.float32)
        data = vigra.taggedView(data, vigra.defaultAxistags('xy'))

        graph = Graph()

        opPiper = OpArrayPiper(graph=graph)
        opPiper.Input.setValue(data)

        opWriter = OpNpyWriter(graph=graph)
        opWriter.Input.connect(opPiper.Output)
        opWriter.Filepath.setValue(self._tmpdir +
                                   '/npy_writer_test_output.npy')

        # Write it...
        opWriter.write()

        opRead = OpInputDataReader(graph=graph)
        try:
            opRead.FilePath.setValue(opWriter.Filepath.value)
            expected_data = data.view(numpy.ndarray)
            read_data = opRead.Output[:].wait()
            assert (read_data == expected_data
                    ).all(), "Read data didn't match exported data!"
        finally:
            opRead.cleanUp()
Exemplo n.º 2
0
    def _export_npy(self):
        self.progressSignal(0)
        export_path = self.ExportPath.value
        try:
            opWriter = OpNpyWriter(parent=self)
            opWriter.Filepath.setValue(export_path)
            opWriter.Input.connect(self.Input)

            # Run the export in this thread
            opWriter.write()
        finally:
            opWriter.cleanUp()
            self.progressSignal(100)
Exemplo n.º 3
0
 def _export_npy(self):
     self.progressSignal(0)
     export_path = self.ExportPath.value
     try:
         opWriter = OpNpyWriter( parent=self )
         opWriter.Filepath.setValue( export_path )
         opWriter.Input.connect( self.Input )
         
         # Run the export in this thread
         opWriter.write()
     finally:
         opWriter.cleanUp()
         self.progressSignal(100)
Exemplo n.º 4
0
    def testBasic(self):
        data = numpy.random.random((100, 100)).astype(numpy.float32)
        data = vigra.taggedView(data, vigra.defaultAxistags("xy"))

        graph = Graph()
        opWriter = OpNpyWriter(graph=graph)
        opWriter.Input.setValue(data)
        opWriter.Filepath.setValue(self._tmpdir + "/npy_writer_test_output.npy")

        # Write it...
        opWriter.write()

        opRead = OpInputDataReader(graph=graph)
        opRead.FilePath.setValue(opWriter.Filepath.value)
        expected_data = data.view(numpy.ndarray)
        read_data = opRead.Output[:].wait()
        assert (read_data == expected_data).all(), "Read data didn't match exported data!"