def _setPlotInfo(self, movie, mic):
     mic.plotGlobal = Image(location=self._getPlotGlobal(movie))
     if self.doComputePSD:
         mic.psdCorr = Image(location=self._getPsdCorr(movie))
         mic.psdJpeg = Image(location=self._getPsdJpeg(movie))
     if self.doComputeMicThumbnail:
         mic.thumbnail = Image(location=self._getOutputMicThumbnail(movie))
示例#2
0
 def _setPlotInfo(self, movie, mic):
     mic.plotGlobal = Image(location=self._getPlotGlobal(movie))
     if self.doComputePSD:
         mic.psdCorr = Image(location=self._getPsdCorr(movie))
     if self._doComputeMicThumbnail():
         mic.thumbnail = Image(location=self._getOutputMicThumbnail(movie))
     if self.doApplyDoseFilter:
         total, early, late = self.calcFrameMotion(movie)
         mic._rlnAccumMotionTotal = Float(total)
         mic._rlnAccumMotionEarly = Float(early)
         mic._rlnAccumMotionLate = Float(late)
示例#3
0
 def testWriteValidate(self):
     img = Image()
     for counter in range(self.nframes.get(), 0, -1):
         img.read("%d@%s" %
                  (counter, os.path.join(self._getExtraPath(), "kk.mrcs")))
         mean, dev, min, max = img.computeStats()
         if (min == max) and (min == counter) and (dev == 0):
             print("frame %d ok" % counter)
         else:
             print("frame %d no OK mean dev, min max" % counter, mean, dev,
                   min, max)
             break
 def _postprocessImageRow(self, img, imgRow):
     self.imgCount += 1
     img.spectraPlot = Image()
     img.spectraPlot.setFileName(self._createSpectraPlot('image', 
                                                         self.imgArray, 
                                                         self.imgCount, 
                                                         img.getObjId()))
 def _preprocessClass(self, classItem, classRow):
     KendersomBaseClassify._preprocessClass(self, classItem, classRow)
     ref = classRow.getValue(emlib.MDL_REF) # get class number
     classItem.spectraPlot = Image()
     classItem.spectraPlot.setFileName(self._createSpectraPlot('class', 
                                                               self.classArray, 
                                                               ref))
 def _preprocessOutputMicrograph(self, mic, movie):
     self._setPlotInfo(movie, mic)
     self._setMotionValues(movie, mic)
     if self._savePsSum():
         outPs = self._getExtraPath(self._getOutputMicPsName(movie))
         mic._powerSpectra = Image(location=outPs)
         mic._powerSpectra.setSamplingRate(self._calcPSSampling())
    def updateGainsOutput(self, movie, imgSet, imageFile):
        movieId = movie.getObjId()
        imgOut = Image()
        imgOut.setObjId(movieId)
        imgOut.setSamplingRate(movie.getSamplingRate())
        imgOut.setFileName(imageFile)

        imgSet.setSamplingRate(movie.getSamplingRate())
        imgSet.append(imgOut)
        return imgSet
    def _setAlignmentInfo(self, movie, obj):
        """ Set alignment info such as plot and psd filename, and
        the cumulative shifts values.
        Params:
            movie: Pass the reference movie
            obj: should pass either the created micrograph or movie
        """
        obj.plotCart = Image()
        obj.plotCart.setFileName(self._getPlotCart(movie))
        if self.doComputePSD:
            obj.psdCorr = Image()
            obj.psdCorr.setFileName(self._getPsdCorr(movie))

        meanX, meanY = self._loadMeanShifts(movie)
        obj._xmipp_OFMeanX = pwobj.CsvList()
        obj._xmipp_OFMeanX.set(meanX)
        obj._xmipp_OFMeanY = pwobj.CsvList()
        obj._xmipp_OFMeanY.set(meanY)
    def _updateClass(self, item):
        classId = item.getObjId()
        classRow = findRow(self.mdClasses, emlib.MDL_REF2, classId)

        representative = item.getRepresentative()
        representative.setTransform(rowToAlignment(classRow, ALIGN_PROJ))
        representative.setLocation(
            xmippToLocation(classRow.getValue(emlib.MDL_IMAGE)))
        setXmippAttributes(representative, classRow, emlib.MDL_ANGLE_ROT)
        setXmippAttributes(representative, classRow, emlib.MDL_ANGLE_TILT)
        setXmippAttributes(representative, classRow, emlib.MDL_CLASS_COUNT)

        self.averageSet.append(representative)

        reprojection = Image()
        reprojection.setLocation(
            xmippToLocation(classRow.getValue(emlib.MDL_IMAGE1)))
        item.reprojection = reprojection
示例#10
0
 def __setXmippImage(label):
     attr = '_xmipp_' + emlib.label2Str(label)
     if not hasattr(particle, attr):
         img = Image()
         setattr(particle, attr, img)
         img.setSamplingRate(particle.getSamplingRate())
     else:
         img = getattr(particle, attr)
     img.setLocation(xmippToLocation(row.getValue(label)))
 def _preprocessOutputMicrograph(self, mic, movie):
     mic.plotGlobal = Image(location=self._getPlotGlobal(movie))
     if self.doComputePSD:
         mic.psdCorr = Image(location=self._getPsdCorr(movie))
     if self._doComputeMicThumbnail():
         mic.thumbnail = Image(location=self._getOutputMicThumbnail(movie))
示例#12
0
 def createReferenceStep(self):
     img = Image()
     img.setDataType(DT_FLOAT)
     img.resize(self.xDim.get(), self.yDim.get())
     img.initConstant(1.)
     img.write(self._getExtraPath("reference.mrc"))
     img.write('%d@%s' % (self.nframes, self._getExtraPath('kk.mrcs')))