def _preprocessOutputMicrograph(self, mic, movie):
     if self.doComputePSD:
         mic.psdCorr = em.Image(location=self._getPsdCorr(movie))
         mic.psdJpeg = em.Image(location=self._getPsdJpeg(movie))
     mic.plotGlobal = em.Image(location=self._getPlotGlobal(movie))
     if self._doComputeMicThumbnail():
         mic.thumbnail = em.Image(location=self._getOutputMicThumbnail(movie))
示例#2
0
 def _setPlotInfo(self, movie, mic):
     mic.plotGlobal = em.Image(location=self._getPlotGlobal(movie))
     if self.doComputePSD:
         mic.psdCorr = em.Image(location=self._getPsdCorr(movie))
     if self._doComputeMicThumbnail():
         mic.thumbnail = em.Image(
             location=self._getOutputMicThumbnail(movie))
示例#3
0
 def _postprocessImageRow(self, img, imgRow):
     self.imgCount += 1
     img.spectraPlot = em.Image()
     img.spectraPlot.setFileName(self._createSpectraPlot('image', 
                                                         self.imgArray, 
                                                         self.imgCount, 
                                                         img.getObjId()))
示例#4
0
 def _preprocessClass(self, classItem, classRow):
     KendersomBaseClassify._preprocessClass(self, classItem, classRow)
     ref = classRow.getValue(xmipp.MDL_REF) # get class number
     classItem.spectraPlot = em.Image()
     classItem.spectraPlot.setFileName(self._createSpectraPlot('class', 
                                                               self.classArray, 
                                                               ref))
示例#5
0
    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 = em.Image()
        obj.plotCart.setFileName(self._getPlotCart(movie))
        if self.doComputePSD:
            obj.psdCorr = em.Image()
            obj.psdCorr.setFileName(self._getPsdCorr(movie))

        meanX, meanY = self._loadMeanShifts(movie)
        obj._xmipp_ShiftX = pwobj.CsvList()
        obj._xmipp_ShiftX.set(meanX)
        obj._xmipp_ShiftY = pwobj.CsvList()
        obj._xmipp_ShiftY.set(meanY)
    def createOutputStep(self):
        inputMovies = self.inputMovies.get()
        micSet = self._createSetOfMicrographs()
        micSet.copyInfo(inputMovies)
        # Also create a Set of Movies with the alignment parameters
        if self.doSaveMovie:
            movieSet = self._createSetOfMovies()
            movieSet.copyInfo(inputMovies)
            movieSet.cropOffsetX = Integer(self.cropOffsetX)
            movieSet.cropOffsetY = Integer(self.cropOffsetY)
            movieSet.cropDimX = Integer(self.cropDimX)
            movieSet.cropDimY = Integer(self.cropDimY)
            movieSet.sumFrame0 = Integer(self.sumFrame0)
            movieSet.sumFrameN = Integer(self.sumFrameN)

        alMethod = self.alignMethod.get()
        for movie in self.inputMovies.get():
            micName = self._getNameExt(movie.getFileName(), '_aligned', 'mrc')
            metadataName = self._getNameExt(movie.getFileName(), '_aligned',
                                            'xmd')
            plotCartName = self._getNameExt(movie.getFileName(), '_plot_cart',
                                            'png')
            psdCorrName = self._getNameExt(movie.getFileName(),
                                           '_aligned_corrected', 'psd')
            # Parse the alignment parameters and store the log files
            alignedMovie = movie.clone()

            if self.run:
                alignedMovie.setFileName(
                    self._getExtraPath(
                        self._getNameExt(movie.getFileName(), '_aligned',
                                         'mrcs')))
            ####>>>This is wrong. Save an xmipp metadata
            alignedMovie.alignMetaData = String(
                self._getExtraPath(metadataName))
            alignedMovie.plotCart = self._getExtraPath(plotCartName)
            alignedMovie.psdCorr = self._getExtraPath(psdCorrName)
            '''if (alMethod == AL_OPTICAL or
                alMethod == AL_DOSEFGPUOPTICAL or 
                alMethod == AL_CROSSCORRELATIONOPTICAL):
                movieCreatePlot(alignedMovie, True)'''

            if self.doSaveMovie:
                movieSet.append(alignedMovie)

            mic = em.Micrograph()
            # All micrograph are copied to the 'extra' folder after each step
            mic.setFileName(self._getExtraPath(micName))

            # The micName of a micrograph MUST be the same as the original movie
            #             mic.setMicName(micName)
            mic.setMicName(movie.getMicName())

            if (alMethod == AL_OPTICAL or alMethod == AL_DOSEFGPUOPTICAL
                    or alMethod == AL_CROSSCORRELATIONOPTICAL):

                mic.alignMetaData = String(self._getExtraPath(metadataName))
                mic.plotCart = self._getExtraPath(plotCartName)
                movieCreatePlot(mic, True)
                mic.plotCart = em.Image()
                mic.plotCart.setFileName(self._getExtraPath(plotCartName))
            #if alMethod != AL_DOSEFGPU and alMethod != AL_CROSSCORRELATION:
            mic.psdCorr = em.Image()
            mic.psdCorr.setFileName(self._getExtraPath(psdCorrName))
            micSet.append(mic)

            # TODO: Methods for dosefgpu should be transferred to here
            """
            if alMethod == AL_DOSEFGPU:
                # Parse the alignment parameters and store the log files
                alignedMovie = movie.clone()
                logFile = self._getExtraPath(self._getLogFile(movie.getObjId()))
                import pyworkflow.em.packages.dosefgpu as dosefgpu
                alignment = dosefgpu.parseMovieAlignment(logFile)
                alignedMovie.setAlignment(alignment)
                movieSet.append(alignedMovie)
            """
        self._defineOutputs(outputMicrographs=micSet)
        self._defineSourceRelation(self.inputMovies, micSet)
        if self.doSaveMovie:
            self._defineOutputs(outputMovies=movieSet)
        """