當前位置: 首頁>>代碼示例>>Python>>正文


Python DB.getImage方法代碼示例

本文整理匯總了Python中db.DB.getImage方法的典型用法代碼示例。如果您正苦於以下問題:Python DB.getImage方法的具體用法?Python DB.getImage怎麽用?Python DB.getImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在db.DB的用法示例。


在下文中一共展示了DB.getImage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getuuid

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import getImage [as 別名]
    def getuuid(self, projectId, imageId, guid):
        data = {}
        project = DB.getProject( projectId )
        task = DB.getImage( projectId, imageId )

        expiration = project.syncTime*4

        if task.annotationLockId == guid:
            data['uuid'] = DB.lockImage( projectId, imageId )
            now = datetime.now()
            annotationTime = datetime.strptime(task.annotationTime, '%Y-%m-%d %H:%M:%S')
            diff = now - annotationTime
            print 'diff: ', diff.total_seconds()
        elif task.annotationStatus == 1:
            now = datetime.now()
            annotationTime = datetime.strptime(task.annotationTime, '%Y-%m-%d %H:%M:%S')
            diff = now - annotationTime
            diff = diff.total_seconds()
            print 'time diff:', diff
            if diff > expiration:
                data['uuid'] = DB.lockImage( projectId, imageId )
        else:
            data['uuid'] = DB.lockImage( projectId, imageId )

        return Utility.compress(json.dumps( data ))
開發者ID:thouis,項目名稱:icon,代碼行數:27,代碼來源:annotationhandler.py

示例2: getstatus

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import getImage [as 別名]
 def getstatus(self, imageId, projectId, guid, segTime):
     # make sure this image prioritize for segmentation
     DB.requestSegmentation( projectId, imageId )
     task = DB.getImage(projectId, imageId);
     data = {}
     data['image'] = task.toJson()
     data['project'] = DB.getProject(projectId).toJson()
     data['has_new_segmentation'] = self.has_new_segmentation(imageId, projectId, segTime)
     return Utility.compress(json.dumps( data ))
開發者ID:Rhoana,項目名稱:icon,代碼行數:11,代碼來源:annotationhandler.py

示例3: has_new_segmentation

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import getImage [as 別名]
    def has_new_segmentation(self, imageId, projectId, segTime):
        # if no new segmentation, just return nothing
        if segTime is None or segTime == 'undefined':
            return True

        task = DB.getImage(projectId, imageId)
        taskSegTime = time.strptime(task.segmentationTime, '%Y-%m-%d %H:%M:%S')
        segTime = segTime.replace("%20", " ")
        segTime = time.strptime(segTime, '%Y-%m-%d %H:%M:%S')

        if segTime == taskSegTime:
            return False

        return True
開發者ID:Rhoana,項目名稱:icon,代碼行數:16,代碼來源:annotationhandler.py


注:本文中的db.DB.getImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。