本文整理汇总了Python中bossspatialdb.views.Cutout.version方法的典型用法代码示例。如果您正苦于以下问题:Python Cutout.version方法的具体用法?Python Cutout.version怎么用?Python Cutout.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bossspatialdb.views.Cutout
的用法示例。
在下文中一共展示了Cutout.version方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_basic_resource_get_downsampled_extent_dims_isotropic
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_basic_resource_get_downsampled_extent_dims_isotropic(self):
"""Test downsample extent isotropic
Returns:
None
"""
url = '/' + version + '/cutout/col1/exp_iso/channel1/0/0:5/0:6/0:2/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp_iso",
"channel_name": "channel1",
"resolution": 0,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
req = BossRequest(drfrequest, request_args)
resource = BossResourceDjango(req)
extent_dims = resource.get_downsampled_extent_dims()
self.assertEqual(len(extent_dims), 8)
self.assertEqual(extent_dims[0], [2000, 5000, 200])
self.assertEqual(extent_dims[1], [1000, 2500, 100])
self.assertEqual(extent_dims[3], [250, 625, 25])
示例2: test_basic_resource_get_iso_level_isotropic
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_basic_resource_get_iso_level_isotropic(self):
"""Test get iso level isotropic
Returns:
None
"""
url = '/' + version + '/cutout/col1/exp_iso/channel1/0/0:5/0:6/0:2/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp_iso",
"channel_name": "channel1",
"resolution": 0,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
req = BossRequest(drfrequest, request_args)
resource = BossResourceDjango(req)
self.assertEqual(resource.get_isotropic_level(), 0)
示例3: test_request_cutout_invalid_resolution
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_invalid_resolution(self):
"""
Test initialization of cutout requests for an invalid datamodel - experiment does not exist for the collection
:return:
"""
url = '/' + version + '/cutout/col2/exp1/channel1/92/0:5/0:6/0:2/'
col = 'col1'
exp = 'exp1'
channel = 'channel1'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": col,
"experiment_name": exp,
"channel_name": channel,
"resolution": 92,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
with self.assertRaises(BossError):
BossRequest(drfrequest, request_args)
示例4: test_request_cutout_invalid_zargs
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_invalid_zargs(self):
"""
Test initialization of cutout arguments for a invalid cutout request. The x-args are outside the coordinate
frame
:return:
"""
url = '/' + version + '/cutout/col1/exp1/channel1/0/0:6/0:6/0:1040/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp1",
"channel_name": "channel1",
"resolution": 2,
"x_args": "0:6",
"y_args": "0:6",
"z_args": "0:1040",
"time_args": None
}
with self.assertRaises(BossError):
BossRequest(drfrequest, request_args)
示例5: test_request_cutout_filter_no_time
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_filter_no_time(self):
"""
Test initialization of boss_key for a time sample range
:return:
"""
url = '/' + version + '/cutout/col1/exp1/channel3/2/0:5/0:6/0:2/?filter=1,2,3,4'
expected_ids = np.array([1, 2, 3, 4])
expected_ids = expected_ids.astype(np.uint64)
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": 'col1',
"experiment_name": 'exp1',
"channel_name": 'channel3',
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None,
"ids": '1,2,3,4'
}
ret = BossRequest(drfrequest, request_args)
self.assertEqual(np.array_equal(ret.get_filter_ids(),expected_ids),True)
示例6: test_request_cutout_lookupkey
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_lookupkey(self):
"""
Test initialization of boss_key for a time sample range
:return:
"""
url = '/' + version + '/cutout/col1/exp1/channel1/2/0:5/0:6/0:2/1:5/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": 'col1',
"experiment_name": 'exp1',
"channel_name": 'channel1',
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": "1:5"
}
ret = BossRequest(drfrequest, request_args)
col_id = ret.collection.pk
exp_id = ret.experiment.pk
channel_id = ret.channel.pk
base_lookup = str(col_id) + '&' + str(exp_id) + '&' + str(channel_id)
self.assertEqual(base_lookup, ret.get_lookup_key())
示例7: test_request_cutout_init_cutoutargs_time_range
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_init_cutoutargs_time_range(self):
"""
Test initialization of boss_key for a time sample range
:return:
"""
url = '/' + version + '/cutout/col1/exp1/channel1/2/0:5/0:6/0:2/1:5/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": 'col1',
"experiment_name": 'exp1',
"channel_name": 'channel1',
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": "1:5"
}
ret = BossRequest(drfrequest, request_args)
time = ret.get_time()
self.assertEqual(time, range(1, 5))
self.assertEqual(ret.time_request, True)
示例8: test_request_cutout_init_cutoutargs_channel
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_init_cutoutargs_channel(self):
"""
Test initialization of cutout arguments for a cutout request
:return:
"""
url = '/' + version + '/cutout/col1/exp1/channel1/2/0:5/0:6/0:2/'
res = 2
(x_start, x_stop) = (0, 5)
(y_start, y_stop) = (0, 6)
(z_start, z_stop) = (0, 2)
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": 'col1',
"experiment_name": 'exp1',
"channel_name": 'channel1',
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
ret = BossRequest(drfrequest, request_args)
self.assertEqual(ret.get_resolution(), res)
self.assertEqual(ret.get_x_start(), x_start)
self.assertEqual(ret.get_x_stop(), x_stop)
self.assertEqual(ret.get_x_span(), x_stop - x_start)
self.assertEqual(ret.get_y_start(), y_start)
self.assertEqual(ret.get_y_stop(), y_stop)
self.assertEqual(ret.get_y_span(), y_stop - y_start)
self.assertEqual(ret.get_z_start(), z_start)
self.assertEqual(ret.get_z_stop(), z_stop)
self.assertEqual(ret.get_z_span(), z_stop - z_start)
示例9: test_request_cutout_invalid_deleted_channel
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_invalid_deleted_channel(self):
"""
Test initialization of cutout requests for channel that was just deleted
"""
# Post a new channel
url = '/' + version + '/collection/col1/experiment/exp1/channel/channel33/'
data = {'description': 'This is a new channel', 'type': 'annotation', 'datatype': 'uint64',
'sources': ['channel1'], 'related': ['channel2']}
response = self.client.post(url, data=data)
self.assertEqual(response.status_code, 201)
url = '/' + version + '/collection/col1/experiment/exp1/channel/channel33'
response = self.client.delete(url)
self.assertEqual(response.status_code, 204)
url = '/' + version + '/cutout/col2/exp1/channel33/0/0:5/0:6/0:2/'
col = 'col1'
exp = 'exp1'
channel = 'channel33'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": col,
"experiment_name": exp,
"channel_name": channel,
"resolution": 0,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
with self.assertRaises(BossError):
BossRequest(drfrequest, request_args)
示例10: test_basic_resource_get_downsampled_voxel_dims_anisotropic_iso
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_basic_resource_get_downsampled_voxel_dims_anisotropic_iso(self):
"""Test downsample voxel dims anisotropic with iso flag
Returns:
None
"""
url = '/' + version + '/cutout/col1/exp_aniso/channel1/0/0:5/0:6/0:2/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp_aniso",
"channel_name": "channel1",
"resolution": 0,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
req = BossRequest(drfrequest, request_args)
resource = BossResourceDjango(req)
voxel_dims = resource.get_downsampled_voxel_dims(iso=True)
self.assertEqual(len(voxel_dims), 8)
self.assertEqual(voxel_dims[0], [4, 4, 35])
self.assertEqual(voxel_dims[1], [8, 8, 35])
self.assertEqual(voxel_dims[2], [16, 16, 35])
self.assertEqual(voxel_dims[3], [32, 32, 35])
self.assertEqual(voxel_dims[4], [64, 64, 70])
self.assertEqual(voxel_dims[5], [128, 128, 140])
示例11: test_request_cutout_init_channel
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def test_request_cutout_init_channel(self):
"""
Test initialization of cutout requests for the datamodel
:return:
"""
url = '/' + version + '/cutout/col1/exp1/channel1/2/0:5/0:6/0:2/'
col = 'col1'
exp = 'exp1'
channel = 'channel1'
boss_key = 'col1&exp1&channel1'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"version": version,
"collection_name": col,
"experiment_name": exp,
"channel_name": channel,
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
ret = BossRequest(drfrequest, request_args)
self.assertEqual(ret.get_collection(), col)
self.assertEqual(ret.get_experiment(), exp)
self.assertEqual(ret.get_channel(), channel)
self.assertEqual(ret.get_boss_key(), boss_key)
self.assertEqual(ret.time_request, False)
示例12: setUp
# 需要导入模块: from bossspatialdb.views import Cutout [as 别名]
# 或者: from bossspatialdb.views.Cutout import version [as 别名]
def setUp(self):
"""Setup test by inserting data model items into the database"""
self.rf = APIRequestFactory()
dbsetup = SetupTestDB()
self.user = dbsetup.create_user()
dbsetup.add_role("resource-manager", self.user)
self.client.force_login(self.user)
dbsetup.insert_test_data()
dbsetup.insert_iso_data()
url = '/' + version + '/collection/col1/experiment/exp1/channel/channel33/'
data = {'description': 'This is a new channel', 'type': 'annotation', 'datatype': 'uint8',
'sources': ['channel1'],
'related': ['channel2', 'channel3']}
response = self.client.post(url, data=data)
url = '/' + version + '/cutout/col1/exp1/channel1/2/0:5/0:6/0:2/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp1",
"channel_name": "channel1",
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
self.request_channel = BossRequest(drfrequest, request_args)
# Setup Layer
url = '/' + version + '/cutout/col1/exp1/layer1/2/0:5/0:6/0:2/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp1",
"channel_name": "layer1",
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
self.request_annotation = BossRequest(drfrequest, request_args)
url = '/' + version + '/cutout/col1/exp1/channel33/2/0:5/0:6/0:2/'
# Create the request
request = self.rf.get(url)
force_authenticate(request, user=self.user)
drfrequest = Cutout().initialize_request(request)
drfrequest.version = version
# Create the request dict
request_args = {
"service": "cutout",
"collection_name": "col1",
"experiment_name": "exp1",
"channel_name": "channel33",
"resolution": 2,
"x_args": "0:5",
"y_args": "0:6",
"z_args": "0:2",
"time_args": None
}
self.request_channel_links = BossRequest(drfrequest, request_args)