当前位置: 首页>>代码示例>>Python>>正文


Python ImageHandler.getDimensions方法代码示例

本文整理汇总了Python中pyworkflow.em.convert.ImageHandler.getDimensions方法的典型用法代码示例。如果您正苦于以下问题:Python ImageHandler.getDimensions方法的具体用法?Python ImageHandler.getDimensions怎么用?Python ImageHandler.getDimensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyworkflow.em.convert.ImageHandler的用法示例。


在下文中一共展示了ImageHandler.getDimensions方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_convertMovie

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def test_convertMovie(self):
        """Check movie conversion"""
        movFn = self.dsFormat.getFile('qbeta/qbeta.mrc') + ":mrcs"
        
        ih = ImageHandler()
        # Check that we can read the dimensions of the dm4 file:
        EXPECTED_SIZE = (4096, 4096, 1, 7)
        EXPECTED_DT = ImageHandler.DT_USHORT

        self.assertEqual(ih.getDimensions(movFn), EXPECTED_SIZE)
        self.assertEqual(ih.getDataType(movFn), EXPECTED_DT)
        
        outFn = join('/tmp/qbeta_converted.mrcs')

        ih.convertStack(movFn, outFn, 2, 6)
        
        self.assertTrue(os.path.exists(outFn))
        self.assertTrue(pwutils.getFileSize(outFn) > 0)
        self.assertEqual(ih.getDimensions(outFn), (4096, 4096, 1, 5))
        self.assertEqual(ih.getDataType(outFn), EXPECTED_DT)

        if pwutils.envVarOn('SCIPION_DEBUG_NOCLEAN'):
            print "Not cleaning output movie: ", outFn
        else:
            pwutils.cleanPath(outFn)
开发者ID:I2PC,项目名称:scipion,代码行数:27,代码来源:test_data.py

示例2: test_readDM4

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def test_readDM4(self):
        """ Check we can read dm4 files (using EMAN)
        """
        micFn = self.dsFormat.getFile('SuperRef_c3-adp-se-xyz-0228_001.dm4')

        ih = ImageHandler()
        # Check that we can read the dimensions of the dm4 file:
        EXPECTED_SIZE = (7676, 7420, 1, 1)
        self.assertEqual(ih.getDimensions(micFn), EXPECTED_SIZE)

        # We could even convert to an mrc file:
        outSuffix = pwutils.replaceBaseExt(micFn, 'mrc')

        outFn = join('/tmp', outSuffix)
        print "Converting: \n%s -> %s" % (micFn, outFn)

        ih.convert(micFn, outFn)

        self.assertTrue(os.path.exists(outFn))
        self.assertTrue(pwutils.getFileSize(outFn) > 0)
        # Check dimensions are still the same:
        self.assertEqual(ih.getDimensions(outFn), EXPECTED_SIZE)

        # Clean up tmp files
        pwutils.cleanPath(outFn)
开发者ID:I2PC,项目名称:scipion,代码行数:27,代码来源:test_data.py

示例3: importVolumesStep

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def importVolumesStep(self, pattern, samplingRate):
        """ Copy images matching the filename pattern
        Register other parameters.
        """
        self.info("Using pattern: '%s'" % pattern)

        # Create a Volume template object
        vol = Volume()
        vol.setSamplingRate(self.samplingRate.get())
        copyOrLink = self.getCopyOrLink()
        imgh = ImageHandler()

        volSet = self._createSetOfVolumes()
        volSet.setSamplingRate(self.samplingRate.get())

        for fileName, fileId in self.iterFiles():
            dst = self._getExtraPath(basename(fileName))
            copyOrLink(fileName, dst)
            x, y, z, n = imgh.getDimensions(dst)
            # First case considers when reading mrc without volume flag
            # Second one considers single volumes (not in stack)
            if (z == 1 and n != 1) or (z !=1 and n == 1):
                vol.setObjId(fileId)
                vol.setLocation(dst)
                volSet.append(vol)
            else:
                for index in range(1, n+1):
                    vol.cleanObjId()
                    vol.setLocation(index, dst)
                    volSet.append(vol)

        if volSet.getSize() > 1:
            self._defineOutputs(outputVolumes=volSet)
        else:
            self._defineOutputs(outputVolume=vol)
开发者ID:josegutab,项目名称:scipion,代码行数:37,代码来源:volumes.py

示例4: prepareMask

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
 def prepareMask(self,maskObject,fnMask,TsMaskOut,XdimOut):
     img=ImageHandler()
     img.convert(maskObject, fnMask)
     self.runJob('xmipp_image_resize',"-i %s --factor %f"%(fnMask,maskObject.getSamplingRate()/TsMaskOut),numberOfMpi=1)
     maskXdim, _, _, _ =img.getDimensions((1,fnMask))
     if XdimOut!=maskXdim:
         self.runJob('xmipp_transform_window',"-i %s --size %d"%(fnMask,XdimOut),numberOfMpi=1)
     self.runJob('xmipp_transform_threshold',"-i %s --select below 0.5 --substitute binarize"%fnMask,numberOfMpi=1)
开发者ID:azazellochg,项目名称:scipion,代码行数:10,代码来源:protocol_split_volume.py

示例5: importImagesStep

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
 def importImagesStep(self, pattern, voltage, sphericalAberration, amplitudeContrast, magnification):
     """ Copy images matching the filename pattern
     Register other parameters.
     """
     self.info("Using pattern: '%s'" % pattern)
     
     createSetFunc = getattr(self, '_create' + self._outputClassName)
     imgSet = createSetFunc()
     imgSet.setIsPhaseFlipped(self.haveDataBeenPhaseFlipped.get())
     acquisition = imgSet.getAcquisition()
     
     self.fillAcquisition(acquisition)
     
     # Call a function that should be implemented by each subclass
     self.setSamplingRate(imgSet)
     
     outFiles = [imgSet.getFileName()]
     imgh = ImageHandler()
     img = imgSet.ITEM_TYPE()
     img.setAcquisition(acquisition)
     n = 1
     copyOrLink = self.getCopyOrLink()
     for i, (fileName, fileId) in enumerate(self.iterFiles()):
         dst = self._getExtraPath(basename(fileName))
         copyOrLink(fileName, dst)
         # Handle special case of Imagic images, copying also .img or .hed
         self.handleImgHed(copyOrLink, fileName, dst)
         
         if self._checkStacks:
             _, _, _, n = imgh.getDimensions(dst)
             
         if n > 1:
             for index in range(1, n+1):
                 img.cleanObjId()
                 img.setMicId(fileId)
                 img.setFileName(dst)
                 img.setIndex(index)
                 imgSet.append(img)
         else:
             img.setObjId(fileId)
             img.setFileName(dst)
             self._fillMicName(img, fileName) # fill the micName if img is a Micrograph.
             imgSet.append(img)
         outFiles.append(dst)
         
         sys.stdout.write("\rImported %d/%d" % (i+1, self.numberOfFiles))
         sys.stdout.flush()
         
     print "\n"
     
     args = {}
     outputSet = self._getOutputName()
     args[outputSet] = imgSet
     self._defineOutputs(**args)
     
     return outFiles
开发者ID:azazellochg,项目名称:scipion,代码行数:58,代码来源:images.py

示例6: test_readCompressedTIF

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def test_readCompressedTIF(self):
        """ Check we can read tif files
        """
        micFn = self.dsFormat.getFile('c3-adp-se-xyz-0228_200.tif')

        ih = ImageHandler()
        # Check that we can read the dimensions of the dm4 file:
        EXPECTED_SIZE = (7676, 7420, 1, 38)
        self.assertEqual(ih.getDimensions(micFn), EXPECTED_SIZE)

        # We could even convert to an mrc file:
        outSuffix = pwutils.replaceBaseExt(micFn, 'mrc')

        outFn = join('/tmp', outSuffix)
        print "Converting: \n%s -> %s" % ((1, micFn), outFn)

        ih.convert((1, micFn), outFn)

        self.assertTrue(os.path.exists(outFn))
        self.assertTrue(pwutils.getFileSize(outFn) > 0)
        self.assertEqual(ih.getDimensions(outFn), (7676, 7420, 1, 1))

        # Clean up tmp files
        pwutils.cleanPath(outFn)
开发者ID:I2PC,项目名称:scipion,代码行数:26,代码来源:test_data.py

示例7: _insertMovieStep

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def _insertMovieStep(self, movie):
        # Redefine this function to add the shifts and factor
        # to the processMovieStep function and run properly in parallel with threads

        #retrive shifts here so there is no conflict
        #if the object is accessed inside at the same time by multiple threads
        if self.applyAlignment and movie.hasAlignment():
            shifts = movie.getAlignment().getShifts()
        else:
            #TODO: I do not think this option is ever used
            # Read movie dimensions to iterate through each frame
            movieName =  movie.getFileName()
            imgh = ImageHandler()
            _, _, _, n = imgh.getDimensions(movieName)
            shifts = [0] * (2*n)
                 
        movieStepId = self._insertFunctionStep('processMovieStep',
                                               movie.getObjId(), movie.getFileName(),
                                               shifts, prerequisites=[])  
        
        return movieStepId 
开发者ID:denisfortun,项目名称:scipion,代码行数:23,代码来源:protocol_extract_particles_movies.py

示例8: _validate

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
 def _validate(self):
     from pyworkflow.em.convert import ImageHandler
     ci = self.getImportClass()
     if ci is None:
         errors = ProtImportMicBase._validate(self)
         for micFn, _ in self.iterFiles():
             imgh = ImageHandler()
             if imgh.isImageFile(micFn):
                 _, _, z, n = imgh.getDimensions(micFn)
                 if n > 1 or z > 1:
                     errors.append("The protocol not support micrographs stored in stacks. "
                                   "If you want to obtain your micrographs individually, "
                                   "you can run the following command:\n"
                                   "scipion run scipion_directory/scripts/split_stacks.py --files *your files* --ext *extension*")
             # JMRT: only check the first image, for large dataset
             # even reading the header can take a while
             break 
         return errors
         
     else:
         return ci.validateMicrographs()
开发者ID:azazellochg,项目名称:scipion,代码行数:23,代码来源:micrographs.py

示例9: importMaskStep

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def importMaskStep(self, path, samplingRate):
        """ Copy mask from maskPath.
        """
        self.info("Using mask path: '%s'" % path)

        # Copy the image file into the project
        dst = self._getExtraPath(basename(path))
        pwutils.copyFile(path, dst)

        # Retrive image dimensions
        imgh = ImageHandler()
        _, _, z, n = imgh.getDimensions(dst)

        # Create a 2D or 3D Mask, consider the case of n>1
        # as the case of some volume maps in mrc format
        if z > 1 or n > 1:
            mask = VolumeMask()
        else:
            mask = Mask()

        mask.setFileName(dst)
        mask.setSamplingRate(samplingRate)

        self._defineOutputs(outputMask=mask)
开发者ID:coocoky,项目名称:scipion,代码行数:26,代码来源:masks.py

示例10: importImagesStreamStep

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def importImagesStreamStep(self, pattern, voltage, sphericalAberration,
                         amplitudeContrast, magnification):
        """ Copy images matching the filename pattern
        Register other parameters.
        """
        self.info("Using pattern: '%s'" % pattern)

        imgSet = self._getOutputSet() if self.isContinued() else None
        
        self.importedFiles = set()
        if imgSet is None:
            createSetFunc = getattr(self, '_create' + self._outputClassName)
            imgSet = createSetFunc()
        elif imgSet.getSize() > 0: # in case of continue
            imgSet.loadAllProperties()
            self._fillImportedFiles(imgSet)
            imgSet.enableAppend()
        
        pointerExcludedMovs = getattr(self, 'moviesToExclude', None)
        if pointerExcludedMovs is not None:
            excludedMovs = pointerExcludedMovs.get()
            self._fillImportedFiles(excludedMovs)

        imgSet.setIsPhaseFlipped(self.haveDataBeenPhaseFlipped.get())
        acquisition = imgSet.getAcquisition()
        self.fillAcquisition(acquisition)
        # Call a function that should be implemented by each subclass
        self.setSamplingRate(imgSet)
        outFiles = [imgSet.getFileName()]
        imgh = ImageHandler()
        img = imgSet.ITEM_TYPE()
        img.setAcquisition(acquisition)
        n = 1
        copyOrLink = self.getCopyOrLink()
        outputName = self._getOutputName()
        alreadyWarned = False  # Use this flag to warn only once

        finished = False
        # this is only used when creating stacks from frame files
        self.createdStacks = set()

        i = 0
        lastDetectedChange = datetime.now()

        # Ignore the timeout variables if we are not really in streaming mode
        if self.dataStreaming:
            timeout = timedelta(seconds=self.timeout.get())
            fileTimeout = timedelta(seconds=self.fileTimeout.get())
        else:
            timeout = timedelta(seconds=5)
            fileTimeout = timedelta(seconds=5)

        while not finished:
            time.sleep(3) # wait 3 seconds before check for new files
            someNew = False
            someAdded = False

            for fileName, uniqueFn, fileId in self.iterNewInputFiles():
                someNew = True
                if self.fileModified(fileName, fileTimeout):
                    continue
                
                dst = self._getExtraPath(uniqueFn)
                self.importedFiles.add(uniqueFn)
                if ' ' in dst:
                    if not alreadyWarned:
                        self.warning('Warning: your file names have white spaces!')
                        self.warning('Removing white spaces from copies/symlinks.')
                        alreadyWarned = True
                    dst = dst.replace(' ', '')
                copyOrLink(fileName, dst)

                self.debug('Importing file: %s' % fileName)
                self.debug("uniqueFn: %s" % uniqueFn)
                self.debug("dst Fn: %s" % dst)

                if self._checkStacks:
                    _, _, _, n = imgh.getDimensions(dst)

                someAdded = True
                self.debug('Appending file to DB...')
                if self.importedFiles: # enable append after first append
                    imgSet.enableAppend()

                if n > 1:
                    for index in range(1, n+1):
                        img.cleanObjId()
                        img.setMicId(fileId)
                        img.setFileName(dst)
                        img.setIndex(index)
                        self._addImageToSet(img, imgSet)
                else:
                    img.setObjId(fileId)
                    img.setFileName(dst)
                    # Fill the micName if img is either a Micrograph or a Movie
                    uniqueFn = uniqueFn.replace(' ', '')
                    self.debug("FILENAME TO fillMicName: %s" % uniqueFn)
                    self._fillMicName(img, uniqueFn)
                    self._addImageToSet(img, imgSet)

#.........这里部分代码省略.........
开发者ID:I2PC,项目名称:scipion,代码行数:103,代码来源:images.py

示例11: importImagesStep

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def importImagesStep(self, pattern, voltage, sphericalAberration, 
                         amplitudeContrast, magnification):
        """ Copy images matching the filename pattern
        Register other parameters.
        """
        self.info("Using pattern: '%s'" % pattern)
        
        createSetFunc = getattr(self, '_create' + self._outputClassName)
        imgSet = createSetFunc()
        imgSet.setIsPhaseFlipped(self.haveDataBeenPhaseFlipped.get())
        acquisition = imgSet.getAcquisition()
        
        self.fillAcquisition(acquisition)
        
        # Call a function that should be implemented by each subclass
        self.setSamplingRate(imgSet)
        
        outFiles = [imgSet.getFileName()]
        imgh = ImageHandler()
        img = imgSet.ITEM_TYPE()
        img.setAcquisition(acquisition)
        n = 1
        copyOrLink = self.getCopyOrLink()
        alreadyWarned = False # Use this flag to warn only once

        for i, (fileName, fileId) in enumerate(self.iterFiles()):
            uniqueFn = self._getUniqueFileName(fileName)
            dst = self._getExtraPath(uniqueFn)
            if ' ' in dst:
                if not alreadyWarned:
                    self.warning('Warning: your file names have white spaces!')
                    self.warning('Removing white spaces from copies/symlinks.')
                    alreadyWarned = True
                dst = dst.replace(' ', '')
            copyOrLink(fileName, dst)
            # Handle special case of Imagic images, copying also .img or .hed
            self.handleImgHed(copyOrLink, fileName, dst)
            
            if self._checkStacks:
                _, _, _, n = imgh.getDimensions(dst)
                
            if n > 1:
                for index in range(1, n+1):
                    img.cleanObjId()
                    img.setMicId(fileId)
                    img.setFileName(dst)
                    img.setIndex(index)
                    self._addImageToSet(img, imgSet)
            else:
                img.setObjId(fileId)
                img.setFileName(dst)
                # Fill the micName if img is either Micrograph or Movie
                uniqueFn = uniqueFn.replace(' ', '')
                self._fillMicName(img, uniqueFn)
                self._addImageToSet(img, imgSet)

            outFiles.append(dst)
            
            sys.stdout.write("\rImported %d/%d" % (i+1, self.numberOfFiles))
            sys.stdout.flush()
            
        print "\n"
        
        args = {}
        outputSet = self._getOutputName()
        args[outputSet] = imgSet
        self._defineOutputs(**args)
        
        return outFiles
开发者ID:I2PC,项目名称:scipion,代码行数:71,代码来源:images.py

示例12: _loadTable

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def _loadTable(self, tableName):
        """ Load information from tables PREFIX_Classes, PREFIX_Objects. """
        
        tableName = self.tablePrefixes[tableName]
        
        BASIC_COLUMNS = [Column('id', int, renderType=COL_RENDER_ID), 
                         Column('enabled', bool ,renderType=COL_RENDER_CHECKBOX),
                         Column('label', str), 
                         Column('comment', str),
                         Column('creation', str)]
        # Load columns from PREFIX_Classes table
        columns = list(BASIC_COLUMNS)
        db = SqliteDb()
        db._createConnection(self._dbName, 1000)
        db.executeCommand("SELECT * FROM %sClasses;" % tableName)
        # This will store the images columsn to join
        # the _index and the _filename
        imgCols = {}
        for row in db._iterResults():
            renderType = COL_RENDER_NONE
            colName = row['column_name']
            colLabel = row['label_property']
            
            if colLabel != 'self':
                # Keep track of _index and _filename pairs to mark as renderable images
                if colLabel.endswith('_index'):
                    imgCols[colLabel.replace('_index', '')] = colName
                
                elif colLabel.endswith('_filename'):
                    
                    # TODO: Maybe not all the labels endswith "_filename" 
                    # have to be rendered. 
                    # for example in the RotSpectra with '_representative._filename'

                    prefix = colLabel.replace('_filename', '')
                    if prefix in imgCols:
                        renderType = COL_RENDER_IMAGE
                        imgCols[colName] = imgCols[prefix]
                
                #CTF FIX
                elif (colLabel.endswith('_psdFile') or 
                      colLabel.endswith('_enhanced_psd') or 
                      colLabel.endswith('_ctfmodel_quadrant') or 
                      colLabel.endswith('_ctfmodel_halfplane')):
                    
                    renderType = COL_RENDER_IMAGE
                
                if row['class_name'] == 'Boolean':
                    renderType = COL_RENDER_CHECKBOX   
                columns.append(Column(colName, str, label=colLabel, renderType=renderType))
        table = Table(*columns)
        
        checkedImgCols = {} # Check if the image columns are volumes
        ih = ImageHandler() 
        
        # Populate the table in the DataSet
        db.executeCommand("SELECT * FROM %sObjects;" % tableName)
        for row in db._iterResults():
            rowDict = dict(row)
            for k, v in rowDict.iteritems():
                if v is None:
                    rowDict[k] = ''
                # Set the [email protected] for images columns values
                if k in imgCols:
                    colName = imgCols[k]
                    index = rowDict[colName]
                    
                    filename = os.path.join(self.projectPath, rowDict[k])
                    filepath = filename.replace(":mrc", "")
                    if not checkedImgCols.get(colName, False):
                        if os.path.exists(filepath):
                            #print "Fn to get dims: %[email protected]%s" % (index,filename)
                            x, y, z, n = ih.getDimensions((index, filename))
                            if z > 1:
                                table.getColumn(k).setRenderType(COL_RENDER_VOLUME)
                        checkedImgCols[colName] = True
                    if index:
                        rowDict[k] = '%[email protected]%s' % (index, filename)
            table.addRow(row['id'], **rowDict)
            
        return table
开发者ID:coocoky,项目名称:scipion,代码行数:83,代码来源:dataset.py

示例13: _processMovie

# 需要导入模块: from pyworkflow.em.convert import ImageHandler [as 别名]
# 或者: from pyworkflow.em.convert.ImageHandler import getDimensions [as 别名]
    def _processMovie(self, movieId, movieName, movieFolder, shifts):###pasar shifts
        
        movieName = os.path.join(movieFolder, movieName)

        boxSize = self.boxSize.get()
        # Read movie dimensions to iterate through each frame
        imgh = ImageHandler()
        x, y, z, n = imgh.getDimensions(movieName)
        
        first = self.firstFrame.get()
        if first <= 1:
            first = 1
        last = self.lastFrame.get()
        if last <= 0 or last >= n:
            last = n
        numberOfFrames = last - first + 1
        
        stkIndex = 0
        movieStk = self._getMovieName(movieId, '.stk')
        movieMdFile = self._getMovieName(movieId, '.xmd')
        movieMd = md.MetaData()
        frameMd = md.MetaData()
        frameMdImages = md.MetaData()
        frameRow = md.Row()
         
        for frame in range(first, last+1):
            # Get the frame shifts
            index = frame - first
            shiftX = shifts[2*index]
            shiftY = shifts[2*index+1]
            
            frameRoot = os.path.join(movieFolder, 'frame_%02d' % frame)
            frameName = frameRoot + '.mrc'
            frameMdFile = frameRoot + '.xmd'
            framePosFile = frameRoot + '_coordinates.xmd'
            coordinatesName = frameRoot + '_coordinates.xmd'
            
            hasCoordinates = self._writeXmippPosFile(movieId, movieName, coordinatesName, 
                                                     shiftX, shiftY)
            if hasCoordinates:
                self.info("Writing frame: %s" % frameName)
                #TODO: there is no need to write the frame and then operate
                #the input of the first operation should be the movie
                imgh.convert(tuple([frame, movieName]), frameName)
                
                if self.doRemoveDust:
                    self.info("Removing Dust")
                    self._runNoDust(frameName)

                self.info("Extracting particles")
                frameImages = frameRoot + '_images'
                args = '-i %(frameName)s --pos %(coordinatesName)s ' \
                       '-o %(frameRoot)s --Xdim %(boxSize)d' % locals()
                
                if self.doInvert:
                    args += " --invert"

                args += " --downsampling %f " % self.factor
                self.runJob('xmipp_micrograph_scissor', args)
                cleanPath(frameName)
                
                frameStk = frameRoot + '.stk'
                
                self.info("Combining particles into one stack.")
                 
                frameMdImages.read(frameMdFile)
                frameMd.read('[email protected]%s' % framePosFile)
                frameMd.merge(frameMdImages)
                 
                for objId in frameMd:
                    stkIndex += 1
                    frameRow.readFromMd(frameMd, objId)
                    location = xmippToLocation(frameRow.getValue(md.MDL_IMAGE))
                    newLocation = (stkIndex, movieStk)
                    imgh.convert(location, newLocation)
                    
                    # Fix the name to be accesible from the Project directory
                    # so we know that the movie stack file will be moved
                    # to final particles folder
                    newImageName = '%[email protected]%s' % newLocation
                    frameRow.setValue(md.MDL_IMAGE, newImageName)
                    frameRow.setValue(md.MDL_MICROGRAPH_ID, long(movieId))
                    frameRow.setValue(md.MDL_MICROGRAPH, str(movieId))
                    frameRow.setValue(md.MDL_FRAME_ID, long(frame))
                    frameRow.setValue(md.MDL_PARTICLE_ID, frameRow.getValue(md.MDL_ITEM_ID))
                    frameRow.writeToMd(movieMd, movieMd.addObject())
                movieMd.addItemId()
                movieMd.write(movieMdFile)
                cleanPath(frameStk)
        
        if self.doNormalize:
            self._runNormalize(movieStk, numberOfFrames)
开发者ID:denisfortun,项目名称:scipion,代码行数:94,代码来源:protocol_extract_particles_movies.py


注:本文中的pyworkflow.em.convert.ImageHandler.getDimensions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。