本文整理汇总了Python中libdvid.DVIDNodeService.post_roi方法的典型用法代码示例。如果您正苦于以下问题:Python DVIDNodeService.post_roi方法的具体用法?Python DVIDNodeService.post_roi怎么用?Python DVIDNodeService.post_roi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libdvid.DVIDNodeService
的用法示例。
在下文中一共展示了DVIDNodeService.post_roi方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_roi_2
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def test_roi_2(self):
# Create X-shaped ROI
# This ensures that the x-run encoding within our ROI message works properly
# (There used to be a bug in post_roi() that would have broken this test.)
_ = 0
# 8x8 blocks = 256x256 px
roi_mask_yx = numpy.array( [[1,_,_,_,_,_,_,1],
[1,1,_,_,_,_,1,1],
[_,1,1,_,_,1,1,_],
[_,_,1,1,1,1,_,_],
[_,_,_,1,1,_,_,_],
[_,_,1,1,1,1,_,_],
[_,1,1,_,_,1,1,_],
[1,1,_,_,_,_,1,1] ])
roi_mask_zyx = numpy.zeros( (8,8,8) )
roi_mask_zyx[:] = roi_mask_yx[None, :, :]
roi_block_indexes = numpy.transpose( roi_mask_zyx.nonzero() )
ns = DVIDNodeService(TEST_DVID_SERVER, self.uuid, "[email protected]", "test_roi_2_app")
ns.create_roi('test-diagonal-256')
ns.post_roi('test-diagonal-256', roi_block_indexes)
fetched_blocks = ns.get_roi("test-diagonal-256")
fetched_blocks = numpy.array(fetched_blocks)
# Both arrays happen to be sorted already
assert ( fetched_blocks == roi_block_indexes ).all()
示例2: setUpClass
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def setUpClass(cls):
cls.uuid = get_testrepo_root_uuid()
node_service = DVIDNodeService(TEST_DVID_SERVER, cls.uuid, "[email protected]_roi_utils.py", "Test_roi_utils")
node_service.create_roi("src_roi")
node_service.post_roi("src_roi", [(1,2,3),(2,3,4),(4,5,6)])
roi_blocks = node_service.get_roi("src_roi")
示例3: copy_roi
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def copy_roi( src_info, dest_info ):
src_service = DVIDNodeService(src_info.server, src_info.uuid)
dest_service = DVIDNodeService(dest_info.server, dest_info.uuid)
# If necessary, create the ROI on the destination server
try:
info = dest_service.get_typeinfo(dest_info.name)
except DVIDException:
dest_service.create_roi(dest_info.name)
roi_blocks = src_service.get_roi(src_info.name)
dest_service.post_roi(dest_info.name, roi_blocks)
示例4: test_roi_partition
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def test_roi_partition(self):
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_roi("test_roi_partition")
blocks = [(0,0,0),(1,1,1),(2,2,2),(3,3,3)]
node_service.post_roi("test_roi_partition", blocks)
substacks, packing_factor = node_service.get_roi_partition("test_roi_partition", 4)
self.assertEqual(substacks, [SubstackXYZ(0,0,0,4*32)])
self.assertEqual( packing_factor, float(len(blocks))/(len(substacks) * 4**3) )
blocks += [(4,0,0)]
node_service.post_roi("test_roi_partition", blocks)
substacks, packing_factor = node_service.get_roi_partition("test_roi_partition", 4)
self.assertEqual(substacks, [SubstackXYZ(0,0,0,4*32), SubstackXYZ(128,0,0,4*32)])
示例5: test_roi_3d
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def test_roi_3d(self):
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_roi("test_roi_3d")
# Create an upside-down L-shaped roi in the first 4 blocks:
#
# 1 1
# 1 0
node_service.post_roi("test_roi_3d", [(0,0,0),(1,0,0),(0,1,0)])
expected_data = numpy.ones((64,64,32), dtype=numpy.uint8, order='C')
expected_data[32:, 32:] = 0
retrieved_data = node_service.get_roi3D( "test_roi_3d", (64,64,32), (0,0,0) )
self.assertEqual( retrieved_data.shape, expected_data.shape )
self.assertTrue( (retrieved_data == expected_data).all() )
示例6: setUpClass
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def setUpClass(cls):
"""
Override. Called by nosetests.
"""
cls.uuid = get_testrepo_root_uuid()
cls.roi_name = "OpDvidRoi_test_roi"
node_service = DVIDNodeService(TEST_DVID_SERVER, cls.uuid)
node_service.create_roi(cls.roi_name)
# Create an upside-down L-shaped roi, something like this:
#
# 1 1 1 1
# 1 1 1 1
# 1 1 0 0
# 1 1 0 0
cls.expected_data = numpy.ones((64, 128, 128), dtype=numpy.uint8, order="C")
cls.expected_data[:, 64:, 64:] = 0
block_values = cls.expected_data[::32, ::32, ::32]
coords = numpy.transpose(numpy.nonzero(block_values))
node_service.post_roi(cls.roi_name, coords)
示例7: create_roi_for_box
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def create_roi_for_box( server, uuid, roi_name, box ):
blocks = roi_blocks_for_box( *box )
node_service = DVIDNodeService(server, uuid)
node_service.create_roi(roi_name)
node_service.post_roi(roi_name, blocks)
示例8: test_roi_ptquery
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def test_roi_ptquery(self):
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_roi("test_roi")
node_service.post_roi("test_roi", [(1,2,3),(2,3,4),(4,5,6)])
query_results = node_service.roi_ptquery( "test_roi", [(0,0,0), (32, 64, 32*3)] )
self.assertEqual( query_results, [False, True] )
示例9: test_roi
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
def test_roi(self):
node_service = DVIDNodeService(TEST_DVID_SERVER, self.uuid)
node_service.create_roi("test_roi")
node_service.post_roi("test_roi", [(1,2,3),(2,3,4),(4,5,6)])
roi_blocks = node_service.get_roi("test_roi")
self.assertEqual(roi_blocks, [(1,2,3),(2,3,4),(4,5,6)])
示例10: init_dvid_database
# 需要导入模块: from libdvid import DVIDNodeService [as 别名]
# 或者: from libdvid.DVIDNodeService import post_roi [as 别名]
#.........这里部分代码省略.........
create_gray = 'curl -X POST 127.0.0.1:8000/api/repo/%s/instance -d'
typedata = "{\"typename\": \"uint8blk\", \"dataname\" : \"grayscale\"}"
create_gray1_command = (create_gray % uuid1).split()
create_gray1_command.append(typedata)
subprocess.check_call(create_gray1_command)
# load grayscale data
load_gray1_command = ('curl -X POST 127.0.0.1:8000/api/node/%s/grayscale/raw/0_1_2/256_256_256/0_0_0 --data-binary @%s/resources/grayscale-256-256-256-uint8.bin' % (uuid1, test_dir)).split()
subprocess.check_call(load_gray1_command)
# Grid grayscale data
# Note that the outer border is only present on
# the bottom Y-half.
#
# + + + + + <-- The '+' here are just a visual cue; they aren't in the data.
# | |
# | |
# +----+---------+----+
# | |
# | |
# | | | |
# +----+---------+----+
# | | | |
# | | | |
# +----+----+----+----+
# load grid grayscale data
grid = np.zeros( (256, 256, 256), dtype=np.uint8 )
grid[80, :, :] = 1
grid[:, 80, :] = 1
grid[:, :, 80] = 1
grid[176, :, :] = 1
grid[:, 176, :] = 1
grid[:, :, 176] = 1
shell = np.zeros( (256, 256, 256), dtype=np.uint8 )
shell[0, :, :] = 1
shell[:, 0, :] = 1
shell[:, :, 0] = 1
shell[-1, :, :] = 1
shell[:, -1, :] = 1
shell[:, :, -1] = 1
grid[:, 128:, :] |= shell[:, 128:, :]
grid *= 255
grid = 255 - grid
# Use a non-zero grayscale value
grid[grid == 0] = 1
a = vigra.filters.gaussianSmoothing(grid, 1.0)
ns = DVIDNodeService('127.0.0.1:8000', str(uuid1))
ns.create_grayscale8('grid-grayscale')
ns.put_gray3D('grid-grayscale', a, (0,0,0))
# create 256 ROI datatype
create_roi_command = ('curl -X POST 127.0.0.1:8000/api/repo/%s/instance -d' % uuid1).split()
create_roi_command.append("{\"typename\": \"roi\", \"dataname\" : \"temproi256\"}")
subprocess.check_call(create_roi_command)
# load 256 ROI
load_roi_command = ('curl -X POST 127.0.0.1:8000/api/node/%s/temproi256/roi --data-binary @%s/resources/256roi.json' % (uuid1, test_dir)).split()
subprocess.check_call(load_roi_command)
# Create ROI with missing corners
# (64px cube is missing from all 8 corners)
create_roi_command = ('curl -X POST 127.0.0.1:8000/api/repo/%s/instance -d' % uuid1).split()
create_roi_command.append("{\"typename\": \"roi\", \"dataname\" : \"roi-256-without-corners\"}")
subprocess.check_call(create_roi_command)
# load incomplete ROI
load_roi_command = ('curl -X POST 127.0.0.1:8000/api/node/%s/roi-256-without-corners/roi --data-binary @%s/resources/roi-256-without-corners.json' % (uuid1, test_dir)).split()
subprocess.check_call(load_roi_command)
# Create diagonal ROI, useful for testing stitching
_ = 0
# 8x8 blocks = 256x256 px
roi_mask_yx = np.array( [[1,_,_,_,_,_,_,1],
[1,1,_,_,_,_,1,1],
[_,1,1,_,_,1,1,_],
[_,_,1,1,1,1,_,_],
[_,_,_,1,1,_,_,_],
[_,_,1,1,1,1,_,_],
[_,1,1,_,_,1,1,_],
[1,1,_,_,_,_,1,1] ])
roi_mask_zyx = np.zeros( (8,8,8) )
roi_mask_zyx[:] = roi_mask_yx[None, :, :]
roi_block_indexes = np.transpose( roi_mask_zyx.nonzero() )
ns = DVIDNodeService('127.0.0.1:8000', str(uuid1))
ns.create_roi('diagonal-256')
ns.post_roi('diagonal-256', roi_block_indexes)
# Save the uuids to a file for debug and/or reuse
with open(uuid_file, 'w') as f:
f.write(uuid1 + '\n')
f.write(uuid2 + '\n')
return uuid1, uuid2