예제 #1
0
 def _insertAllSteps(self):
     """Insert all steps to calculate the resolution of a 3D reconstruction. """
     
     self.inputVol = locationToXmipp(*self.inputVolume.get().getLocation())
     self.refVol = locationToXmipp(*self.referenceVolume.get().getLocation())
     
     if self.doFSC:
         self._insertFunctionStep('calculateFscStep')
     if self.doStructureFactor:
         self._insertFunctionStep('structureFactorcStep')
     self._insertFunctionStep('createSummaryStep')
    def updateItem(self, item, row):
        from convert import locationToXmipp
        # ToDo: uncomment this lines when the output metadata has ITEM_ID
#         if item.getObjId() != row.getValue(xmipp.MDL_ITEM_ID):
#             raise Exception("The objId is not equal to ITEM_ID. Please, sort the metadata.")
        if isinstance(item, Class2D):
            img = item.getRepresentative()
            index, fn = img.getLocation()
        else:
            index, fn = item.getLocation()
            
        objLoc = locationToXmipp(index, fn)
        mdLoc = row.getValue(xmipp.MDL_IMAGE)
        if objLoc != mdLoc:
            print objLoc+" "+mdLoc
            raise Exception("The image isn't the same. Please, sort the metadata.")

        item._xmipp_maxCC = Float(row.getValue(xmipp.MDL_MAXCC))
        item._xmipp_zScoreResCov = Float(row.getValue(xmipp.MDL_ZSCORE_RESCOV))
        item._xmipp_zScoreResMean = Float(row.getValue(xmipp.MDL_ZSCORE_RESMEAN))
        item._xmipp_zScoreResVar = Float(row.getValue(xmipp.MDL_ZSCORE_RESVAR))
        if isinstance(item, Class2D):
            particle = item.getRepresentative()
        else:
            particle = item
        particle.setTransform(rowToAlignment(row, alignType=ALIGN_PROJ))
예제 #3
0
    def compareVolumeStep(self, volLoc, i):
        fnRef = self._getExtraPath("reference.vol")
        sampling = self.referenceVolume.get().getSamplingRate()
        fnRoot = self._getExtraPath("volume_%02d" % i)
        fnVol = fnRoot + ".vol"
        self.runJob("xmipp_image_convert","-i %s -o %s -t vol"%(locationToXmipp(volLoc[0],volLoc[1]),fnVol))
        
        # Resize if the volume has different size than the reference
        self._resizeVolume(fnVol)

        if self.doAlign: # Align against the reference if selected
            self.runJob('xmipp_volume_align',
                        "--i1 %s --i2 %s --apply --local" % (fnRef, fnVol))

        if self.mask.hasValue(): # Mask volume if input mask
            self._maskVolume(fnVol)

        # Finally compute the FSC
        args = "--ref %s -i %s -o %s_fsc.xmd --sampling_rate %f" % (fnRef, fnVol,
                                                                fnRoot, sampling)
        self.runJob("xmipp_resolution_fsc", args)
    def compareVolumeStep(self, volLoc, i):
        fnRef = self._getExtraPath("reference.vol")
        sampling = self.referenceVolume.get().getSamplingRate()
        fnRoot = self._getExtraPath("volume_%02d" % i)
        fnVol = fnRoot + ".vol"
        self.runJob(
            "xmipp_image_convert", "-i %s -o %s -t vol" %
            (locationToXmipp(volLoc[0], volLoc[1]), fnVol))

        # Resize if the volume has different size than the reference
        self._resizeVolume(fnVol)

        if self.doAlign:  # Align against the reference if selected
            self.runJob('xmipp_volume_align',
                        "--i1 %s --i2 %s --apply --local" % (fnRef, fnVol))

        if self.mask.hasValue():  # Mask volume if input mask
            self._maskVolume(fnVol)

        # Finally compute the FSC
        args = "--ref %s -i %s -o %s_fsc.xmd --sampling_rate %f" % (
            fnRef, fnVol, fnRoot, sampling)
        self.runJob("xmipp_resolution_fsc", args)