当前位置: 首页>>代码示例>>Python>>正文


Python libdvid.DVIDNodeService类代码示例

本文整理汇总了Python中libdvid.DVIDNodeService的典型用法代码示例。如果您正苦于以下问题:Python DVIDNodeService类的具体用法?Python DVIDNodeService怎么用?Python DVIDNodeService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DVIDNodeService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpClass

    def setUpClass(cls):
        """
        Override.  Called by nosetests.
        """
        # Choose names
        cls.dvid_repo = "datasetA"
        cls.data_name = "random_data"
        cls.volume_location = "/repos/{dvid_repo}/volumes/{data_name}".format( **cls.__dict__ )

        cls.data_uuid = get_testrepo_root_uuid()
        cls.node_location = "/repos/{dvid_repo}/nodes/{data_uuid}".format( **cls.__dict__ )

        # Generate some test data
        #data = numpy.random.randint(0, 255, (128, 256, 512, 1)).astype( numpy.uint8 )
        
        data = numpy.zeros((128, 256, 512, 1), dtype=numpy.uint8)
        data.flat[:] = numpy.arange( numpy.prod((128, 256, 512, 1)) )
        cls.original_data = data
        cls.voxels_metadata = VoxelsMetadata.create_default_metadata(data.shape, data.dtype, "zyxc", 1.0, "")

        # Write it to a new data instance
        node_service = DVIDNodeService(TEST_DVID_SERVER, cls.data_uuid)

        node_service.create_grayscale8(cls.data_name)
        node_service.put_gray3D( cls.data_name, data[...,0], (0,0,0) )
开发者ID:constantinpape,项目名称:lazyflow,代码行数:25,代码来源:testOpDvidVolume.py

示例2: get_blocksize

def get_blocksize(dvid_server, uuid, dataname):
    """Gets block size for supplied data name.

    Note:
        Does not check for existence of body and whether
        it is an array type.  The block size is always
        assumes to be isotropic.
   
    Args:
        dvid_server (str): location of dvid server
        uuid (str): version id
        dataname (str): data instance
   
    Returns:
        (z,y,x) blocksize.

    Raises:
        DVIDExceptions are not caught in this function and will be
        transferred to the caller.
    """

    ns = DVIDNodeService(str(dvid_server), str(uuid))
    info = ns.get_typeinfo(dataname)
    x,y,z = info["Extended"]["BlockSize"] # DVID ordered x,y,z
    return (z,y,x)
开发者ID:janelia-flyem,项目名称:DVIDSparkServices,代码行数:25,代码来源:metadata.py

示例3: writer

        def writer(element_pairs):
            from libdvid import DVIDNodeService, Vertex, Edge

            # write graph information
            node_service = DVIDNodeService(str(server), str(uuid))

            if element_pairs is None:
                return

            vertices = []
            edges = []
            for element_pair in element_pairs:
                edge, weight = element_pair
                v1, v2 = edge

                if v2 == -1:
                    vertices.append(Vertex(v1, weight))
                else:
                    edges.append(Edge(v1, v2, weight))

            if len(vertices) > 0:
                node_service.update_vertices(str(graph_name), vertices)

            if len(edges) > 0:
                node_service.update_edges(str(graph_name), edges)

            return []
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:27,代码来源:sparkdvid.py

示例4: get_labels2

 def get_labels2():
     # fetch second label volume
     node_service2 = DVIDNodeService(str(server2), str(uuid2))
     # retrieve data from roi start position
     return node_service2.get_labels3D(
         str(label_name2), (size1, size2, size3), (subvolume.roi[0], subvolume.roi[1], subvolume.roi[2])
     )
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:7,代码来源:sparkdvid.py

示例5: get_segmask

 def get_segmask():
     node_service = DVIDNodeService(str(pdconf["dvid-server"]), str(pdconf["uuid"]))
     # retrieve data from roi start position
     return node_service.get_labels3D(
         str(pdconf["segmentation-name"]),
         (size1, size2, size3),
         (subvolume.roi[0] - border, subvolume.roi[1] - border, subvolume.roi[2] - border),
     )
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:8,代码来源:Segmentor.py

示例6: loadFeaturesForFrame

 def loadFeaturesForFrame(self, features, timeframe):
     """
     loads feature data
     """
     assert(self.server_address is not None)
     assert(self.uuid is not None)
     node_service = DVIDNodeService(self.server_address, self.uuid)
     node_service.create_keyvalue(self.keyvalue_store)
     return json.loads(node_service.get(self.keyvalue_store, "frame-{}".format(timeframe)))
开发者ID:JaimeIvanCervantes,项目名称:hytra,代码行数:9,代码来源:dvid_feature_serializer.py

示例7: storeFeaturesForFrame

 def storeFeaturesForFrame(self, features, timeframe):
     """
     Stores feature data
     """
     assert(self.server_address is not None)
     assert(self.uuid is not None)
     node_service = DVIDNodeService(self.server_address, self.uuid)
     node_service.create_keyvalue(self.keyvalue_store)
     node_service.put(self.keyvalue_store, "frame-{}".format(timeframe), json.dumps(features))
开发者ID:JaimeIvanCervantes,项目名称:hytra,代码行数:9,代码来源:dvid_feature_serializer.py

示例8: get_labels

 def get_labels():
     # extract labels 64
     node_service = DVIDNodeService(str(server), str(uuid))
     # retrieve data from roi start position
     return node_service.get_labels3D(
         str(label_name),
         (size1, size2, size3),
         (subvolume.roi[0], subvolume.roi[1], subvolume.roi[2]),
         roi=str(roiname),
     )
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:10,代码来源:sparkdvid.py

示例9: test_copy_roi

    def test_copy_roi(self):
        expected_blocks = [(1,2,3),(2,3,4),(4,5,6)]

        # We aren't really exercising transferring between servers here.  Too bad.
        src_info  = (TEST_DVID_SERVER, self.uuid, 'src_roi')
        dest_info = (TEST_DVID_SERVER, self.uuid, 'dest_roi')

        node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid, "[email protected]_roi_utils.py", "Test_roi_utils")
        written_blocks = node_service.get_roi("src_roi")
        assert set(expected_blocks) == set(written_blocks)
开发者ID:janelia-flyem,项目名称:libdvid-cpp,代码行数:10,代码来源:test_roi_utils.py

示例10: getTimeRange

 def getTimeRange(self, Resource, PathInResource):
     """
     Count Label images to derive the total number of frames
     Loads label image data from local resource file in hdf5 format.
     PathInResource provides the internal image path 
     Return tuple of (first frame, last frame)
     """
     node_service = DVIDNodeService(Resource, PathInResource)
     config = json.loads(node_service.get("config", "imageInfo"))
     return config["time_range"]
开发者ID:JaimeIvanCervantes,项目名称:hytra,代码行数:10,代码来源:dvid_image_loader.py

示例11: execute

    def execute(self):
        from DVIDSparkServices.reconutils import SimpleGraph
        from libdvid import DVIDNodeService
        from pyspark import SparkContext
        from pyspark import StorageLevel

        if "chunk-size" in self.config_data["options"]:
            self.chunksize = self.config_data["options"]["chunk-size"]

        #  grab ROI
        distrois = self.sparkdvid_context.parallelize_roi(self.config_data["dvid-info"]["roi"], self.chunksize)

        num_partitions = distrois.getNumPartitions()

        # map ROI to label volume (1 pixel overlap)
        label_chunks = self.sparkdvid_context.map_labels64(
            distrois, self.config_data["dvid-info"]["label-name"], 1, self.config_data["dvid-info"]["roi"]
        )

        # map labels to graph data -- external program (eventually convert neuroproof metrics and graph to a python library) ?!
        sg = SimpleGraph.SimpleGraph(self.config_data["options"])

        # extract graph
        graph_elements = label_chunks.flatMap(sg.build_graph)

        # group data for vertices and edges
        graph_elements_red = graph_elements.reduceByKey(lambda a, b: a + b)

        # repartition by first vertex to better group edges together
        graph_elements_red = graph_elements_red.partitionBy(num_partitions, lambda a: hash(a[0]))

        graph_elements_red.persist(StorageLevel.MEMORY_ONLY)  # ??
        graph_vertices = graph_elements_red.filter(sg.is_vertex)
        graph_edges = graph_elements_red.filter(sg.is_edge)

        # create graph
        node_service = DVIDNodeService(
            str(self.config_data["dvid-info"]["dvid-server"]), str(self.config_data["dvid-info"]["uuid"])
        )

        node_service.create_graph(str(self.config_data["dvid-info"]["graph-name"]))

        # dump graph -- should this be wrapped through utils or through sparkdvid ??
        # will this result in too many request (should they be accumulated) ??
        # currently looking at one partitioning at a time to try to group requests
        self.sparkdvid_context.foreachPartition_graph_elements(
            graph_vertices, self.config_data["dvid-info"]["graph-name"]
        )
        self.sparkdvid_context.foreachPartition_graph_elements(graph_edges, self.config_data["dvid-info"]["graph-name"])

        if "debug" in self.config_data["options"] and self.config_data["options"]["debug"]:
            num_elements = graph_elements.count()
            print "DEBUG: ", num_elements

        graph_elements_red.unpersist()
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:55,代码来源:ComputeGraph.py

示例12: get_gray

 def get_gray():
     node_service = DVIDNodeService(str(server), str(uuid))
     return node_service.get_gray3D(
         str(gray_name),
         (size1, size2, size3),
         (
             subvolume.roi.x1 - subvolume.border,
             subvolume.roi.y1 - subvolume.border,
             subvolume.roi.z1 - subvolume.border,
         ),
     )
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:11,代码来源:sparkdvid.py

示例13: put_labels

 def put_labels():
     node_service = DVIDNodeService(str(server), str(uuid))
     # send data from roi start position
     node_service.put_labels3D(
         str(label_name),
         seg,
         (subvolume.roi.x1, subvolume.roi.y1, subvolume.roi.z1),
         compress=True,
         roi=str(roi_name),
         mutate=mutate,
     )
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:11,代码来源:sparkdvid.py

示例14: getImageShape

    def getImageShape(self, Resource, PathInResource):
        """
        Derive Image Shape from label image.
        Loads label image data from local resource file in hdf5 format.
        PathInResource provides the internal image path 
        Return list with image dimensions
        """

        node_service = DVIDNodeService(Resource, PathInResource)
        config = json.loads(node_service.get("config", "imageInfo"))
        self.shape =  config["shape"]
        return self.shape
开发者ID:JaimeIvanCervantes,项目名称:hytra,代码行数:12,代码来源:dvid_image_loader.py

示例15: getImageDataAtTimeFrame

    def getImageDataAtTimeFrame(self, Resource, PathInResource, axes, timeframe):
        """
        Loads image data from local resource file in hdf5 format.
        PathInResource provides the internal image path 
        Return numpy array of image data at timeframe.
        """
        node_service = DVIDNodeService(Resource, PathInResource)

        if (self.shape == None):
            self.getImageShape(Resource, PathInResource)

        raw_frame = node_service.get_gray3D(self._getRawImageName(timeframe), tuple(self.shape), (0,0,0))
        return raw_frame
开发者ID:JaimeIvanCervantes,项目名称:hytra,代码行数:13,代码来源:dvid_image_loader.py


注:本文中的libdvid.DVIDNodeService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。