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


Python DVIDNodeService.get方法代码示例

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


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

示例1: test_keyvalue

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
    def test_keyvalue(self):
        node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
        node_service.create_keyvalue("keyvalue_test")
        node_service.put("keyvalue_test", "key1", "val1")
        readback_value = node_service.get("keyvalue_test", "key1")
        self.assertEqual(readback_value, "val1")

        node_service.put("keyvalue_test", "key2", "val2")
        readback_value = node_service.get("keyvalue_test", "key2")
        self.assertEqual(readback_value, "val2")

        keys = node_service.get_keys("keyvalue_test")
        assert isinstance(keys, collections.Iterable)
        assert set(keys) == set(["key1", "key2"])
  
        with self.assertRaises(ErrMsg):
            node_service.put("keyvalue_test", "key1", 123) # 123 is not a buffer.
开发者ID:podgorskiy,项目名称:libdvid-cpp,代码行数:19,代码来源:test_node_service.py

示例2: loadFeaturesForFrame

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
 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,代码行数:11,代码来源:dvid_feature_serializer.py

示例3: test_keyvalue

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
    def test_keyvalue(self):
        node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
        node_service.create_keyvalue("test_keyvalue")
        node_service.put("test_keyvalue", "kkkk", "vvvv")
        readback_value = node_service.get("test_keyvalue", "kkkk")
        self.assertEqual(readback_value, "vvvv")
 
        with self.assertRaises(RuntimeError):
            node_service.put("test_keyvalue", "kkkk", 123) # 123 is not a buffer.
开发者ID:gnayuy,项目名称:libdvid-cpp,代码行数:11,代码来源:test_node_service.py

示例4: getTimeRange

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
 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,代码行数:12,代码来源:dvid_image_loader.py

示例5: getImageShape

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
    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,代码行数:14,代码来源:dvid_image_loader.py

示例6: open

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
	#If key doesn't exist create it
	key_info_url = '/{kv_name}/info'.format(kv_name=args.key_value_store)
	try:
		node_service.custom_request(key_info_url, '', ConnectionMethod.GET)
	except DVIDException:
		if args.insert:
			create_datatype_endpoint = "{}api/repo/{}/instance".format(args.dvid, args.uuid)
			print create_datatype_endpoint
			payload = json.dumps({
				"typename": 'keyvalue', 
				"dataname": args.key_value_store,
				"versioned": "0",
			})
			u = urllib2.urlopen(create_datatype_endpoint, payload)
			#node_service.custom_request(create_datatype, payload, ConnectionMethod.POST)

	# Read in data
	with open(args.input) as fi:
		data = json.load(fi)

	# Replace data in key value
	if args.insert:
		node_service.put(args.key_value_store, args.key_name, json.dumps(data))

	if args.insert:
		assert node_service.get(args.key_value_store, args.key_name)




开发者ID:janelia-flyem,项目名称:DVIDScripts,代码行数:28,代码来源:DVIDLoad.py

示例7: neuroproof_agglomerate

# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get [as 别名]
def neuroproof_agglomerate(predictions, supervoxels, classifier, threshold = 0.20, mitochannel = 2):
    """Main agglomeration function

   Args:
        predictions = 4D float32 numpy label array (z, y, x, ch) 
        supervoxels = 3D uint32 numpy label array (z,y,x) 
        classifier = file location or DVID (assume to be xml unless .h5 is explict in name)
        threshold = threshold (default = 0.20)
        mitochannel = prediction channel for mito (default 2) (empty means no mito mode)
    
    Returns:
        segmentation = 3D numpy label array (z,y,x)
    """

    print "neuroproof_agglomerate(): Starting with label data: dtype={}, shape={}".format(str(supervoxels.dtype), supervoxels.shape)


    import numpy
    # return immediately if no segmentation
    if len(numpy.unique(supervoxels)) <= 1:
        return supervoxels


    #from neuroproof import Classifier, Agglomeration
    from neuroproof import Agglomeration
    import os

    # verify channels
    assert predictions.ndim == 4
    z,y,x,nch = predictions.shape

    if nch > 2:
        # make sure mito is in the second channel
        predictions[[[[2, mitochannel]]]] = predictions[[[[mitochannel, mitochannel]]]] 

    pathname = str(classifier["path"])
    tempfilehold = None
    tclassfile = ""

    # write classifier to temporary file if stored on DVID
    if "dvid-server" in classifier:
        # allow user to specify any server and version for the data
        dvidserver = classifier["dvid-server"]
        uuid = classifier["uuid"]

        # extract file and store into temporary location
        from libdvid import DVIDNodeService
        node_service = DVIDNodeService(str(dvidserver), str(uuid))

        name_key = pathname.split('/')
        classfile = node_service.get(name_key[0], name_key[1])

        # create temp file
        import tempfile
        tempfilehold = tempfile.NamedTemporaryFile(delete=False)
       
        # open file and write data
        with open(tempfilehold.name, 'w') as fout:
            fout.write(classfile)

        # move temporary file to have the same extension as provided file
        if pathname.endswith('.h5'):
            tclassfile = tempfilehold.name + ".h5"
        else:
            tclassfile = tempfilehold.name + ".xml"
        os.rename(tempfilehold.name, tclassfile)

    else:
        # just read from directory
        tclassfile = pathname
        

    # load classifier from file
    #classifier = loadClassifier(tclassfile)

    # run agglomeration (supervoxels must be 32 uint and predicitons must be float32)
    segmentation = Agglomeration.agglomerate(supervoxels.astype(numpy.uint32), predictions.astype(numpy.float32), tclassfile, threshold)

    if tempfilehold is not None:
        os.remove(tclassfile)

    return segmentation
开发者ID:stuarteberg,项目名称:DVIDSparkServices,代码行数:84,代码来源:NeuroProofAgglom.py


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