def checkPreviousTemplateRun(self): ### check if we have a previous selection run selectrunq = appiondata.ApSelectionRunData() selectrunq['name'] = self.params['runname'] selectrunq[ 'session'] = sessiondata = apDatabase.getSessionDataFromSessionName( self.params['sessionname']) rundatas = selectrunq.query(results=1) if not rundatas: return True rundata = rundatas[0] ### check if we have a previous template run templaterunq = appiondata.ApTemplateRunData(selectionrun=rundata) templatedatas = templaterunq.query() if not templatedatas: return True ### make sure of using same number of templates if len(self.params['templateIds']) != len(templatedatas): apDisplay.printError("different number of templates from last run") ### make sure we have same rotation parameters for i, templateid in enumerate(self.params['templateIds']): templaterunq = appiondata.ApTemplateRunData() templaterunq['selectionrun'] = rundata templaterunq[ 'template'] = appiondata.ApTemplateImageData.direct_query( templateid) ### this is wrong only check last template run not this run queryresult = templaterunq.query(results=1) if queryresult: templatedata = queryresult[0] return True
def checkPreviousTemplateRun(self): ### check if we have a previous selection run selectrunq = appiondata.ApSelectionRunData() selectrunq['name'] = self.params['runname'] selectrunq[ 'session'] = sessiondata = apDatabase.getSessionDataFromSessionName( self.params['sessionname']) rundatas = selectrunq.query(results=1) if not rundatas: return True rundata = rundatas[0] ### check if we have a previous template run templaterunq = appiondata.ApTemplateRunData(selectionrun=rundata) templatedatas = templaterunq.query() if not templatedatas: return True ### make sure of using same number of templates if len(self.params['templateIds']) != len(templatedatas): apDisplay.printError("different number of templates from last run") ### make sure we have same rotation parameters for i, templateid in enumerate(self.params['templateIds']): templaterunq = appiondata.ApTemplateRunData() templaterunq['selectionrun'] = rundata templaterunq[ 'template'] = appiondata.ApTemplateImageData.direct_query( templateid) ### this is wrong only check last template run not this run templatedata = templaterunq.query(results=1)[0] if (templatedata['range_start'] != self.params["startang" + str(i + 1)] or templatedata['range_end'] != self.params["endang" + str(i + 1)] or templatedata['range_incr'] != self.params["incrang" + str(i + 1)]): print i + 1, templateid print templatedata['range_start'], self.params["startang" + str(i + 1)] print templatedata['range_end'], self.params["endang" + str(i + 1)] print templatedata['range_incr'], self.params["incrang" + str(i + 1)] apDisplay.printWarning( "different template search ranges from last run") return True
def commitToDatabase(self, imgdata, rundata): #insert template data for i, templateid in enumerate(self.params['templateIds']): templaterunq = appiondata.ApTemplateRunData() templaterunq['selectionrun'] = rundata templaterunq[ 'template'] = appiondata.ApTemplateImageData.direct_query( abs(templateid)) templaterunq['mirror'] = self.params["templatemirrors"] if self.params['commit'] is True: templaterunq.insert() return
def commitToDatabase(self, imgdata, rundata): #insert template rotation data for i, templateid in enumerate(self.params['templateIds']): templaterunq = appiondata.ApTemplateRunData() templaterunq['selectionrun'] = rundata templaterunq[ 'template'] = appiondata.ApTemplateImageData.direct_query( abs(templateid)) templaterunq['range_start'] = self.params["startang" + str(i + 1)] templaterunq['range_end'] = self.params["endang" + str(i + 1)] templaterunq['range_incr'] = self.params["incrang" + str(i + 1)] templaterunq['mirror'] = self.params["mirror" + str(i + 1)] if self.params['commit'] is True: templaterunq.insert() return