Beispiel #1
0
    def getBoxSize(self, coordFile):
        """ Try to infer the box size from the given coordinate file.
        In the case of .box files, the size is the 3rd column
        In the case of .json files, we will look for file
        e2boxercache/base.json
        """
        if coordFile.endswith('.box'):
            md = MetaData()
            md.readPlain(coordFile, "xcoor ycoor particleSize")
            return md.getValue(MDL_PICKING_PARTICLE_SIZE, md.firstObject())

        elif coordFile.endswith('.json'):
            infoDir = pwutils.dirname(coordFile)
            # Still go one level up of info dir
            jsonBase = pwutils.join(pwutils.dirname(infoDir), 'e2boxercache',
                                    'base.json')
            jsonBase2 = pwutils.join(infoDir, 'project.json')
            if pwutils.exists(jsonBase):
                jsonDict = loadJson(jsonBase)
                if jsonDict.has_key('box_size'):
                    return int(jsonDict["box_size"])
            elif pwutils.exists(jsonBase2):
                jsonDict = loadJson(jsonBase2)
                if jsonDict.has_key('global.boxsize'):
                    return int(jsonDict["global.boxsize"])

        return None
Beispiel #2
0
    def _getImgPath(self, mdFn, imgFn):
        """ Get ups and ups until finding the relative location to images. """
        path = dirname(mdFn)
        index, fn = xmippLib.FileName(imgFn).decompose()

        while path and path != '/':
            newFn = os.path.join(path, fn)
            if os.path.exists(newFn):
                if index:
                    newFn = '%d@%s' % (index, newFn)
                return newFn
            path = dirname(path)

        return None
Beispiel #3
0
 def _getImgPath(self, mdFn, imgFn):
     """ Get ups and ups until finding the relative location to images. """
     path = dirname(mdFn)
     index, fn = xmipp.FileName(imgFn).decompose()
     
     while path and path != '/':
         newFn = os.path.join(path, fn)
         if os.path.exists(newFn):
             if index:
                 newFn = '%d@%s' % (index, newFn)
             return newFn
         path = dirname(path)
         
     return None
Beispiel #4
0
 def _actionUp(self, e=None):
     self._goDir(dirname(self.treeProvider.getDir()))
Beispiel #5
0
 def _actionUp(self, e=None):
     self._goDir(dirname(self.treeProvider.getDir()))