def _test_volume(self, hostname, uuid, dataname, start, stop):
        """
        hostname: The dvid server host
        uuid: The node we can test with
        dataname: The data instance to test with
        start, stop: The bounds of the cutout volume to retrieve from the server. C ORDER FOR THIS TEST BECAUSE we use transpose_axes=True
        """
        # Retrieve from server
        graph = Graph()
        opDvidVolume = OpDvidVolume(hostname,
                                    uuid,
                                    dataname, {},
                                    transpose_axes=True,
                                    graph=graph)
        subvol = opDvidVolume.Output(start, stop).wait()

        # Retrieve from file (which uses fortran order)
        slicing = tuple(slice(x, y) for x, y in zip(start, stop))
        slicing = tuple(reversed(slicing))

        expected_data = self.original_data[slicing]

        # Compare.
        assert ( subvol.view(numpy.ndarray) == expected_data.transpose() ).all(),\
            "Data from server didn't match data from file!"
Beispiel #2
0
    def _test_volume(self, hostname, h5filename, uuid, dataname, start, stop):
        """
        hostname: The dvid server host
        h5filename: The h5 file to compare against
        h5group: The hdf5 group, also used as the uuid of the dvid dataset
        h5dataset: The dataset name, also used as the name of the dvid dataset
        start, stop: The bounds of the cutout volume to retrieve from the server. C ORDER FOR THIS TEST BECAUSE we use transpose_axes=True
        """
        # Retrieve from server
        graph = Graph()
        opDvidVolume = OpDvidVolume(hostname,
                                    uuid,
                                    dataname, {},
                                    transpose_axes=True,
                                    graph=graph)
        subvol = opDvidVolume.Output(start, stop).wait()

        # Retrieve from file (which uses fortran order)
        slicing = tuple(slice(x, y) for x, y in zip(start, stop))
        slicing = tuple(reversed(slicing))

        with h5py.File(h5filename, 'r') as f:
            expected_data = f['all_nodes'][uuid][dataname][slicing]

        # Compare.
        assert ( subvol.view(numpy.ndarray) == expected_data.transpose() ).all(),\
            "Data from server didn't match data from file!"