예제 #1
0
 def setUp(self, m):
     m.post('https://mockzegami.com/oauth/token/',
            json={'token': 'asdkjsajgfdjfsda'})
     m.get('https://mockzegami.com/oauth/userinfo/', json={'projects': []})
     super().setUp()
     self.username = '******'
     self.password = '******'
     self.local_token_path = os.path.join(Path.home(),
                                          'mockzegami_com.zegami.token')
     self.url = ZegamiClient(username=self.username,
                             password=self.password,
                             home="https://mockzegami.com")
# -*- coding: utf-8 -*-
# Copyright 2021 Zegami Ltd
"""Add annotation score example."""

from zegami_sdk import nodes
from zegami_sdk.client import ZegamiClient

WORKSPACE_ID = ''
COLLECTION_ID = ''

zc = ZegamiClient("", "")

workspace = zc.get_workspace_by_id(WORKSPACE_ID)
collection = workspace.get_collection_by_id(COLLECTION_ID)
print(collection)

imageset_id = collection._data.get('imageset_id')

resp = nodes.add_node(
    zc,
    workspace,
    'mask_annotation_score',
    # truth authors and evaluated authors should either
    # be not specified or a list of strings
    {
        # "evaluated_authors": ["authors name"],
    },
    'imageset',
    imageset_parents=[imageset_id],
    name="annotation score ims")
annotation_score_node = resp.get('imageset')
예제 #3
0
# -*- coding: utf-8 -*-
# Copyright 2021 Zegami Ltd
"""Create collection example."""

from zegami_sdk.client import ZegamiClient
from zegami_sdk.source import UploadableSource
from zegami_sdk.source import UrlSource

WORKSPACE_ID = ''
HOME = 'https://zegami.com'

zc = ZegamiClient(home=HOME)

workspace = zc.get_workspace_by_id(WORKSPACE_ID)

data_file = r"path/to/data"
images = r"path/to/images"
url_template = 'https://example.com/images/{}?accesscode=abc3e20423423497'
image_fetch_headers = {'Accept': 'image/jpg'}
column_name = 'id'

upload1 = UploadableSource('source_name', images, 'name')
upload2 = UrlSource('url_source', url_template, image_fetch_headers,
                    column_name)
uploads = [upload1, upload2]
workspace.create_collection('test_sdk_url', uploads, data_file)
# -*- coding: utf-8 -*-
"""Download images from a collection with a specific tag."""

from zegami_sdk.client import ZegamiClient

WORKSPACE_ID = ''
COLLECTION_ID = ''
TAG = ''
USERNAME = ''
PASSWORD = ''

zc = ZegamiClient(username=USERNAME, password=PASSWORD)

workspace = zc.get_workspace_by_id(WORKSPACE_ID)
collection = workspace.get_collection_by_id(COLLECTION_ID)
rows = collection.get_rows_by_tags([TAG])
image_urls = collection.get_image_urls(rows)
collection.save_image_batch(image_urls,
                            './images',
                            extension='dcm',
                            max_workers=20)
예제 #5
0
from zegami_sdk.client import ZegamiClient

client = ZegamiClient()

workspace = client.get_workspace_by_id('')

coll = workspace.get_collection_by_id('')
coll.clear_cache()
rows = coll.get_rows_by_tags([''])
urls = coll.get_image_urls(rows, generate_signed_urls=True, signed_expiry_days=120)

table = []

rows['url'] = urls

subset = rows[['imageName', 'url']]

subset.to_csv('annotations.csv')