예제 #1
0
 def _getLabelRenderType(self, label):
     """ Return the way to render each label. """
     if xmipp.labelIsImage(label):
         return COL_RENDER_IMAGE
     
     labelType = xmipp.labelType(label)
     if labelType == xmipp.LABEL_BOOL:
         return COL_RENDER_CHECKBOX
     
     return COL_RENDER_TEXT
예제 #2
0
    def _getLabelRenderType(self, label, md):
        """ Return the way to render each label. """
        if xmipp.labelIsImage(label):
            value = md.getValue(label, md.firstObject())
            if value.endswith('.vol'):
                return COL_RENDER_VOLUME
            return COL_RENDER_IMAGE

        labelType = xmipp.labelType(label)
        if labelType == xmipp.LABEL_BOOL:
            return COL_RENDER_CHECKBOX

        return COL_RENDER_TEXT
예제 #3
0
파일: xmipp3.py 프로젝트: I2PC/scipion
 def _getLabelRenderType(self, label, md):
     """ Return the way to render each label. """
     if xmipp.labelIsImage(label):
         value = md.getValue(label, md.firstObject())
         if value.endswith('.vol'):
             return COL_RENDER_VOLUME
         return COL_RENDER_IMAGE
     
     labelType = xmipp.labelType(label)
     if labelType == xmipp.LABEL_BOOL:
         return COL_RENDER_CHECKBOX
     
     return COL_RENDER_TEXT
예제 #4
0
 def writeToMd(self, md, objId):
     """ Set back row values to a metadata row. """
     for label, value in self._labelDict.iteritems():
         # TODO: Check how to handle correctly unicode type
         # in Xmipp and Scipion
         t = type(value)
         
         if t is unicode:
             value = str(value)
             
         if t is int and xmipp.labelType(label) == xmipp.LABEL_SIZET:
             value = long(value)
             
         try:
             md.setValue(label, value, objId)
         except Exception, ex:
             print >> sys.stderr, "XmippMdRow.writeToMd: Error writting value to metadata."
             print >> sys.stderr, "                     label: %s, value: %s, type(value): %s" % (label2Str(label), value, type(value))
             raise ex
예제 #5
0
    def writeToMd(self, md, objId):
        """ Set back row values to a metadata row. """
        for label, value in self._labelDict.iteritems():
            # TODO: Check how to handle correctly unicode type
            # in Xmipp and Scipion
            t = type(value)

            if t is unicode:
                value = str(value)

            if t is int and xmipp.labelType(label) == xmipp.LABEL_SIZET:
                value = long(value)

            try:
                md.setValue(label, value, objId)
            except Exception, ex:
                print >> sys.stderr, "XmippMdRow.writeToMd: Error writting value to metadata."
                print >> sys.stderr, "                     label: %s, value: %s, type(value): %s" % (
                    label2Str(label), value, type(value))
                raise ex
예제 #6
0
def getLabelPythonType(label):
    """ From xmipp label to python variable type """
    labelType = xmipp.labelType(label)
    return LABEL_TYPES.get(labelType, str)
예제 #7
0
def getLabelPythonType(label):
    """ From xmipp label to python variable type """
    labelType = xmipp.labelType(label)
    return LABEL_TYPES.get(labelType, str)