本文整理汇总了Python中libdvid.DVIDNodeService.get_gray3D方法的典型用法代码示例。如果您正苦于以下问题:Python DVIDNodeService.get_gray3D方法的具体用法?Python DVIDNodeService.get_gray3D怎么用?Python DVIDNodeService.get_gray3D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libdvid.DVIDNodeService
的用法示例。
在下文中一共展示了DVIDNodeService.get_gray3D方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_grayscale_3d
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
def test_grayscale_3d(self):
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_grayscale8("test_grayscale_3d")
data = numpy.random.randint(0, 255, (128,128,128)).astype(numpy.uint8)
node_service.put_gray3D( "test_grayscale_3d", data, (0,0,0) )
retrieved_data = node_service.get_gray3D( "test_grayscale_3d", (30,30,30), (20,20,20) )
self.assertTrue( (retrieved_data == data[20:50, 20:50, 20:50]).all() )
示例2: test_grayscale_3d
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
def test_grayscale_3d(self):
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_grayscale8("test_grayscale_3d")
data = numpy.random.randint(0, 255, (128,128,128)).astype(numpy.uint8).transpose()
assert data.flags['F_CONTIGUOUS']
node_service.put_gray3D( "test_grayscale_3d", data, (0,0,0) )
retrieved_data = node_service.get_gray3D( "test_grayscale_3d", (30,31,32), (20,20,20) )
self.assertTrue( (retrieved_data == data[20:50, 20:51, 20:52]).all() )
示例3: get_gray
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
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,
),
)
示例4: getImageDataAtTimeFrame
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
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
示例5: test_for_memory_leak
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
def test_for_memory_leak(self):
"""
When DVIDNodeService uses array data from python or gives it to python,
it shouldn't hold on to references to that data once Python is finished with it.
Here, we use python's weakref module to see if any objects returned from
DVIDNodeService (or given to it) linger longer than they are supposed to.
"""
def get_bases(a):
"""
Return a list of all 'bases' (parents) of
the given array, including the array itself.
"""
if a is None:
return []
if not isinstance(a.base, numpy.ndarray):
return [a.base]
return [a] + get_bases(a.base)
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_grayscale8("test_memoryleak_grayscale_3d")
data = numpy.random.randint(0, 255, (128,128,128)).astype(numpy.uint8)
assert data.flags['C_CONTIGUOUS']
w = weakref.ref(data)
node_service.put_gray3D( "test_memoryleak_grayscale_3d", data, (0,0,0) )
del data
assert w() is None, "put_gray3D() kept a reference to the data we gave it!"
retrieved_data = node_service.get_gray3D( "test_memoryleak_grayscale_3d", (128,128,128), (0,0,0) )
weak_bases = map(weakref.ref, get_bases(retrieved_data))
del retrieved_data
assert all([w() is None for w in weak_bases]), \
"Data retuned by get_gray3D() wasn't released after we deleted our reference to it!"
示例6: DVIDNodeService
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
from libdvid import DVIDNodeService
import numpy as np
from tifffile import *
import code
server_address = 'http://104.196.106.27:8000/'
uuid = '0d3d16fa990f41a9b6d4b322e5631c65'
node_service = DVIDNodeService(server_address, uuid)
instance_name = 'VCN_c13_bin5_EM.nrrd'
#node_service.create_keyvalue(keyvalue_store)
data = node_service.get_gray3D(instance_name, (512,512,512), (0,0,0))
imsave(instance_name + '.tif', data)
image = imread(instance_name + '.tif')
np.testing.assert_array_equal(image,data)
with TiffFile(instance_name + '.tif') as tif:
images = tif.asarray()
for page in tif:
for tag in page.tags.values():
t = tag.name, tag.value
image = page.asarray()
code.interact(local=locals())
示例7: str
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import get_gray3D [as 别名]
except Exception as e:
return False, str(e)
try:
if isgray:
ns.get_gray3D(name, (10,10,10), (0,0,0))
else:
ns.get_label3D(name, (10,10,10), (0,0,0))
except Exception as e:
return True, None
return False, "data info still exists"
bench_deletedatatype()
# load data from emdata.janelia.org 7 column medulla
ns = DVIDNodeService("emdata.janelia.org", "8225")
grayscale = ns.get_gray3D("grayscale", (128,128,128), (4800, 3000, 3500))
labels = ns.get_labels3D("groundtruth", (128,128,128), (4800, 3000, 3500))
#grayscale = ns.get_gray3D("grayscale", (32,32,32), (4800, 3000, 3500))
#labels = ns.get_labels3D("groundtruth", (32,32,32), (4800, 3000, 3500))
# run benchmarks
@benchmark
def bench_createrepo():
"""Create new dvid repo.
"""
return createrepo()
res, uuid = bench_createrepo()
ns = DVIDNodeService(DVIDLOCATION, uuid)