Ejemplo n.º 1
0
    def convertInputStep(self, particlesId, volId):
        """ Write the input images as a Xmipp metadata file. 
        particlesId: is only need to detect changes in
        input particles and cause restart from here.
        """
        inputParticles = self.inputParticles.get()
        inputVolume = self.inputVolume.get()

        writeSetOfParticles(inputParticles, self._getExpParticlesFn())

        img = ImageHandler()
        img.convert(inputVolume, self._getInputVolFn())

        if self._useSeveralClasses():
            # Scale particles
            Xdim = inputParticles.getXDim()
            Ts = inputParticles.getSamplingRate()
            newTs = self.targetResolution.get() * 0.4
            newTs = max(Ts, newTs)
            newXdim = Xdim * Ts / newTs
            self.runJob(
                "xmipp_image_resize",
                "-i %s -o %s --save_metadata_stack %s --fourier %d" %
                (self._getExpParticlesFn(),
                 self._getTmpPath('scaled_particles.stk'),
                 self._getTmpPath('scaled_particles.xmd'), newXdim))
            # Scale volume
            Xdim = inputVolume.getXDim()
            if Xdim != newXdim:
                self.runJob("xmipp_image_resize",
                            "-i %s --dim %d" %
                            (self._getInputVolFn(), newXdim),
                            numberOfMpi=1)
Ejemplo n.º 2
0
    def convertInputStep(self, particlesId, volId):
        """ Write the input images as a Xmipp metadata file. 
        particlesId: is only need to detect changes in
        input particles and cause restart from here.
        """
        inputParticles = self.inputParticles.get()
        inputVolume = self.inputVolume.get()

        writeSetOfParticles(inputParticles, self._getExpParticlesFn())

        img = ImageHandler()
        img.convert(inputVolume, self._getInputVolFn())

        if self._useSeveralClasses():
            # Scale particles
            Xdim = inputParticles.getXDim()
            Ts = inputParticles.getSamplingRate()
            newTs = self.targetResolution.get() * 0.4
            newTs = max(Ts, newTs)
            newXdim = Xdim * Ts / newTs
            self.runJob("xmipp_image_resize",
                        "-i %s -o %s --save_metadata_stack %s --fourier %d" %
                        (self._getExpParticlesFn(),
                         self._getTmpPath('scaled_particles.stk'),
                         self._getTmpPath('scaled_particles.xmd'),
                         newXdim))
            # Scale volume
            Xdim = inputVolume.getXDim()
            if Xdim != newXdim:
                self.runJob("xmipp_image_resize", "-i %s --dim %d"
                            % (self._getInputVolFn(), newXdim), numberOfMpi=1)
 def convertInputStep(self, particlesId):
     """ Write the input images as a Xmipp metadata file. 
     particlesId: is only need to detect changes in
     input particles and cause restart from here.<
     """
     writeSetOfParticles(self.inputTiltPair.get().getUntilted(), self._getPath('input_untilted_particles.xmd'))
     writeSetOfParticles(self.inputTiltPair.get().getTilted(), self._getPath('input_tilted_particles.xmd'))
 def convertInputStep(self, particlesId):
     """ Write the input images as a Xmipp metadata file. 
     particlesId: is only need to detect changes in
     input particles and cause restart from here.
     """
     writeSetOfParticles(self.inputParticles.get(), 
                         self._getPath('input_particles.xmd'))
Ejemplo n.º 5
0
 def convertInputStep(self):
     """ Read the input metadatata.
     """
     # Get the converted input micrographs in Xmipp format
     inputSet = self.input.get()
     inputPath = self._getExtraPath('inputSet')
     fnSet = inputPath+'.xmd'
     writeSetOfParticles(inputSet, fnSet)
Ejemplo n.º 6
0
 def convertInputStep(self, atomsFn):
     # Write the modes metadata taking into account the selection
     self.writeModesMetaData()
     # Write a metadata with the normal modes information
     # to launch the nma alignment programs
     writeSetOfParticles(self.inputParticles.get(), self.imgsFn)
     # Copy the atoms file to current working dir
     copyFile(atomsFn, self.atomsFn)
Ejemplo n.º 7
0
 def convertInputStep(self, atomsFn):
     # Write the modes metadata taking into account the selection
     self.writeModesMetaData()
     # Write a metadata with the normal modes information
     # to launch the nma alignment programs
     writeSetOfParticles(self.inputParticles.get(), self.imgsFn)
     # Copy the atoms file to current working dir
     copyFile(atomsFn, self.atomsFn)
Ejemplo n.º 8
0
 def convertInputStep(self):
     """ convert to Xmipp image model"""
     writeSetOfParticles(self.inputParticles.get(), self.inputFn,
                         alignType=ALIGN_NONE)
     
     if self.inputParticles2.get() is not None:
         writeSetOfParticles(self.inputParticles2.get(),
                             self._getSecondSetFn(),
                             alignType=ALIGN_NONE)
 def convertInputStep(self, particlesId):
     """ Write the input images as a Xmipp metadata file. 
     particlesId: is only need to detect changes in
     input particles and cause restart from here.
     """
     a = self.inputParticles.get()
     print a.printAll()
     writeSetOfParticles(self.inputParticles.get(),
                         self._getPath('input_particles.xmd'))
    def convertInputStep(self, particlesId):
        """ Write the input images as a Xmipp metadata file. 
        particlesId: is only need to detect changes in
        input particles and cause restart from here.
        """

        writeSetOfParticles(self.inputParticles.get(),
                            self._getPath('input_particles.xmd'))

        if self.doWiener.get():
            params = '  -i %s' % self._getPath('input_particles.xmd')
            params += '  -o %s' % self._getExtraPath(
                'corrected_ctf_particles.stk')
            params += '  --save_metadata_stack %s' % self._getExtraPath(
                'corrected_ctf_particles.xmd')
            params += '  --pad %s' % self.padding_factor.get()
            params += '  --wc %s' % self.wiener_constant.get()
            params += '  --sampling_rate %s' % self.inputParticles.get(
            ).getSamplingRate()

            if self.inputParticles.get().isPhaseFlipped():
                params += '  --phase_flipped '

            if self.correctEnvelope:
                params += '  --correct_envelope '

            nproc = self.numberOfMpi.get()
            nT = self.numberOfThreads.get()

            self.runJob('xmipp_ctf_correct_wiener2d', params)

        newTs, newXdim = self._getModifiedSizeAndSampling()

        if self.doWiener.get():
            params = '  -i %s' % self._getExtraPath(
                'corrected_ctf_particles.xmd')
        else:
            params = '  -i %s' % self._getPath('input_particles.xmd')

        params += '  -o %s' % self._getExtraPath('scaled_particles.stk')
        params += '  --save_metadata_stack %s' % self._getExtraPath(
            'scaled_particles.xmd')
        params += '  --dim %d' % newXdim

        self.runJob('xmipp_image_resize', params)

        from pyworkflow.em.convert import ImageHandler
        img = ImageHandler()
        img.convert(self.inputVolumes.get(), self._getExtraPath("volume.vol"))
        Xdim = self.inputVolumes.get().getDim()[0]
        if Xdim != newXdim:
            self.runJob("xmipp_image_resize","-i %s --dim %d"%\
                        (self._getExtraPath("volume.vol"),
                        newXdim), numberOfMpi=1)
    def convertInputStep(self, particlesId):
        """ Write the input images as a Xmipp metadata file. 
        particlesId: is only need to detect changes in
        input particles and cause restart from here.
        """

        writeSetOfParticles(self.inputParticles.get(), 
                            self._getPath('input_particles.xmd'))
        
        if self.doWiener.get():
            params  =  '  -i %s' % self._getPath('input_particles.xmd')
            params +=  '  -o %s' % self._getExtraPath('corrected_ctf_particles.stk')
            params +=  '  --save_metadata_stack %s' % self._getExtraPath('corrected_ctf_particles.xmd')
            params +=  '  --pad %s' % self.padding_factor.get()
            params +=  '  --wc %s' % self.wiener_constant.get()
            params +=  '  --sampling_rate %s' % self.inputParticles.get().getSamplingRate()

            if self.inputParticles.get().isPhaseFlipped():
                params +=  '  --phase_flipped '
            
            if self.correctEnvelope:
                params +=  '  --correct_envelope '
                
            nproc = self.numberOfMpi.get()
            nT=self.numberOfThreads.get()
    
            self.runJob('xmipp_ctf_correct_wiener2d',
                        params)
        
        newTs, newXdim = self._getModifiedSizeAndSampling()
                
        if self.doWiener.get():
            params =  '  -i %s' % self._getExtraPath('corrected_ctf_particles.xmd')
        else :
            params =  '  -i %s' % self._getPath('input_particles.xmd')
            
        params +=  '  -o %s' % self._getExtraPath('scaled_particles.stk')
        params +=  '  --save_metadata_stack %s' % self._getExtraPath('scaled_particles.xmd')
        params +=  '  --fourier %d' % newXdim
        
        self.runJob('xmipp_image_resize',params)
        
        from pyworkflow.em.convert import ImageHandler
        img = ImageHandler()
        img.convert(self.inputVolumes.get(), self._getExtraPath("volume.vol"))
        Xdim = self.inputVolumes.get().getDim()[0]
        if Xdim!=newXdim:
            self.runJob("xmipp_image_resize","-i %s --dim %d"%\
                        (self._getExtraPath("volume.vol"),
                        newXdim), numberOfMpi=1)
Ejemplo n.º 12
0
    def convertInputStep(self, particlesId, classesId):
        writeSetOfParticles(self.inputParticles.get(),
                            self._getFileName('input_particles'),
                            alignType=em.ALIGN_NONE)

        if not self.randomInitialization:

            if isinstance(self.initialClasses.get(), SetOfClasses2D):
                writeSetOfClasses2D(self.initialClasses.get(),
                                    self._getFileName('input_references'),
                                    writeParticles=False)
            else:
                writeSetOfParticles(self.initialClasses.get(),
                                    self._getFileName('input_references'))
 def createOutputStep(self, fnOutputParts, inputSet, inputVol):        
     volTransformMatrix = np.matrix(inputVol.getTransform().getMatrix())
     
     outputSet = self._createSetOfParticles()
     for part in inputSet.iterItems():
         partTransformMat = part.getTransform().getMatrix()       
         partTransformMatrix = np.matrix(partTransformMat)            
         newTransformMatrix = volTransformMatrix * partTransformMatrix
         part.getTransform().setMatrix(newTransformMatrix)
         outputSet.append(part)       
     
     outputSet.copyInfo(inputSet)        
     self._defineOutputs(outputParticles=outputSet)        
     writeSetOfParticles(outputSet, fnOutputParts)
    def createOutputStep(self, fnOutputParts, inputSet, inputVol):
        volTransformMatrix = np.matrix(inputVol.getTransform().getMatrix())

        outputSet = self._createSetOfParticles()
        for part in inputSet.iterItems():
            partTransformMat = part.getTransform().getMatrix()
            partTransformMatrix = np.matrix(partTransformMat)
            newTransformMatrix = volTransformMatrix * partTransformMatrix
            part.getTransform().setMatrix(newTransformMatrix)
            outputSet.append(part)

        outputSet.copyInfo(inputSet)
        self._defineOutputs(outputParticles=outputSet)
        writeSetOfParticles(outputSet, fnOutputParts)
Ejemplo n.º 15
0
 def convertInputStep(self, particlesId, classesId):
     writeSetOfParticles(self.inputParticles.get(),
                         self._getFileName('input_particles'),
                         alignType=em.ALIGN_NONE)
     
     if not self.randomInitialization:
         
         if isinstance(self.initialClasses.get(), SetOfClasses2D):
             writeSetOfClasses2D(self.initialClasses.get(),
                                 self._getFileName('input_references'),
                                 writeParticles=False)
         else:
             writeSetOfParticles(self.initialClasses.get(),
                                 self._getFileName('input_references'))
Ejemplo n.º 16
0
 def convertInputStep(self, imagesMd):
     # It is unusual to create the output in the convertInputStep,
     # but just to avoid reading twice the sqlite with particles
     inputSet = self.inputNmaDimred.get().getInputParticles()
     partSet = self._createSetOfParticles()
     partSet.copyInfo(inputSet)
     
     tmpSet = SetOfParticles(filename=self.sqliteFile.get())        
     partSet.appendFromImages(tmpSet)
     # Register outputs
     partSet.setAlignmentProj()
     self._defineOutputs(outputParticles=partSet)
     self._defineTransformRelation(inputSet, partSet)
     
     writeSetOfParticles(partSet, imagesMd)
Ejemplo n.º 17
0
 def convertInputStep(self, imagesMd):
     # It is unusual to create the output in the convertInputStep,
     # but just to avoid reading twice the sqlite with particles
     inputSet = self.inputNmaDimred.get().getInputParticles()
     partSet = self._createSetOfParticles()
     partSet.copyInfo(inputSet)
     
     tmpSet = SetOfParticles(filename=self.sqliteFile.get())        
     partSet.appendFromImages(tmpSet)
     # Register outputs
     partSet.setAlignmentProj()
     self._defineOutputs(outputParticles=partSet)
     self._defineTransformRelation(inputSet, partSet)
     
     writeSetOfParticles(partSet, imagesMd)
Ejemplo n.º 18
0
 def _insertAllSteps(self):            
     inputParticlesMd = self._getExtraPath('input_particles.xmd')
     inputParticles = self.inputParticles.get()
     writeSetOfParticles(inputParticles, inputParticlesMd)        
     inputVol = self.inputVolume.get().getFileName()
     referenceVol = self.referenceVolume.get().getFileName()
     
     if not self.doAlignment.get():
         self._insertFunctionStep('opticalFlowAlignmentStep', 
                                  inputVol, referenceVol, inputParticlesMd)
     else:
         fnAlignedVolFf = self._getExtraPath('aligned_inputVol_to_refVol_FF.vol')
         fnAlnVolFfLcl = self._getExtraPath('aligned_FfAlnVol_to_refVol_lcl.vol')
         fnInPartsNewAng = self._getExtraPath("inputParts_anglesModified.xmd")
         self._insertFunctionStep('volumeAlignmentStep', 
                                  referenceVol, inputVol, fnAlignedVolFf, 
                                  fnAlnVolFfLcl, fnInPartsNewAng)
         self._insertFunctionStep('opticalFlowAlignmentStep', 
                                  fnAlnVolFfLcl, referenceVol, fnInPartsNewAng)
                     
     self._insertFunctionStep('createOutputStep')        
Ejemplo n.º 19
0
 def volumeAlignmentStep (self, referenceVol, inputVol, fnAlignedVolFf, 
                                fnAlnVolFfLcl, fnInPartsNewAng):
     fnTransformMatFF = self._getExtraPath('transformation-matrix-FF.txt')
     alignArgsFf = "--i1 %s --i2 %s --apply %s" % (referenceVol, 
                                                   inputVol, 
                                                   fnAlignedVolFf)
     alignArgsFf += " --frm --copyGeo %s" % fnTransformMatFF
     self.runJob('xmipp_volume_align', alignArgsFf, numberOfMpi = 1)        
     
     fnTransformMatLocal = self._getExtraPath('transformation-matrix-local.txt')
     alignArgsLocal = "--i1 %s --i2 %s --apply %s" % (referenceVol, 
                                                      fnAlignedVolFf, 
                                                      fnAlnVolFfLcl)
     alignArgsLocal += " --local --rot 0 0 1 --tilt 0 0 1"
     alignArgsLocal += " --psi 0 0 1 -x 0 0 1 -y 0 0 1"
     alignArgsLocal += " -z 0 0 1 --scale 1 1 0.005 --copyGeo %s" % fnTransformMatLocal        
     self.runJob('xmipp_volume_align', alignArgsLocal, numberOfMpi = 1)
              
     #apply transformation matrix to input ratricles
     transMatFromFileFF = np.loadtxt(fnTransformMatFF)
     transformationArrayFF = np.reshape(transMatFromFileFF,(4,4))
     transformMatrixFF = np.matrix(transformationArrayFF)
     
     transMatFromFileLocal = np.loadtxt(fnTransformMatLocal)
     transformationArrayLocal = np.reshape(transMatFromFileLocal,(4,4))
     transformMatrixLocal = np.matrix(transformationArrayLocal)
     
     transformMatrix = transformMatrixFF * transformMatrixLocal
     print "Transformation matrix used to apply to the input particles =\n"
     print transformMatrix
     inputParts = self.inputParticles.get()
     outputSet = self._createSetOfParticles()
     for part in inputParts.iterItems():        
         partTransformMat = part.getTransform().getMatrix()            
         partTransformMatrix = np.matrix(partTransformMat)            
         newTransformMatrix = transformMatrix * partTransformMatrix                      
         part.getTransform().setMatrix(newTransformMatrix)
         outputSet.append(part)       
     outputSet.copyInfo(inputParts)                
     writeSetOfParticles(outputSet, fnInPartsNewAng)             
Ejemplo n.º 20
0
    def volumeAlignmentStep(self, referenceVol, inputVol, fnAlignedVolFf,
                            fnAlnVolFfLcl, fnInPartsNewAng):
        fnTransformMatFF = self._getExtraPath('transformation-matrix-FF.txt')
        alignArgsFf = "--i1 %s --i2 %s --apply %s" % (referenceVol, inputVol,
                                                      fnAlignedVolFf)
        alignArgsFf += " --frm --copyGeo %s" % fnTransformMatFF
        self.runJob('xmipp_volume_align', alignArgsFf, numberOfMpi=1)

        fnTransformMatLocal = self._getExtraPath(
            'transformation-matrix-local.txt')
        alignArgsLocal = "--i1 %s --i2 %s --apply %s" % (
            referenceVol, fnAlignedVolFf, fnAlnVolFfLcl)
        alignArgsLocal += " --local --rot 0 0 1 --tilt 0 0 1"
        alignArgsLocal += " --psi 0 0 1 -x 0 0 1 -y 0 0 1"
        alignArgsLocal += " -z 0 0 1 --scale 1 1 0.005 --copyGeo %s" % fnTransformMatLocal
        self.runJob('xmipp_volume_align', alignArgsLocal, numberOfMpi=1)

        #apply transformation matrix to input ratricles
        transMatFromFileFF = np.loadtxt(fnTransformMatFF)
        transformationArrayFF = np.reshape(transMatFromFileFF, (4, 4))
        transformMatrixFF = np.matrix(transformationArrayFF)

        transMatFromFileLocal = np.loadtxt(fnTransformMatLocal)
        transformationArrayLocal = np.reshape(transMatFromFileLocal, (4, 4))
        transformMatrixLocal = np.matrix(transformationArrayLocal)

        transformMatrix = transformMatrixFF * transformMatrixLocal
        print "Transformation matrix used to apply to the input particles =\n"
        print transformMatrix
        inputParts = self.inputParticles.get()
        outputSet = self._createSetOfParticles()
        for part in inputParts.iterItems():
            partTransformMat = part.getTransform().getMatrix()
            partTransformMatrix = np.matrix(partTransformMat)
            newTransformMatrix = transformMatrix * partTransformMatrix
            part.getTransform().setMatrix(newTransformMatrix)
            outputSet.append(part)
        outputSet.copyInfo(inputParts)
        writeSetOfParticles(outputSet, fnInPartsNewAng)
Ejemplo n.º 21
0
    def _insertAllSteps(self):
        inputParticlesMd = self._getExtraPath('input_particles.xmd')
        inputParticles = self.inputParticles.get()
        writeSetOfParticles(inputParticles, inputParticlesMd)
        inputVol = self.inputVolume.get().getFileName()
        referenceVol = self.referenceVolume.get().getFileName()

        if not self.doAlignment.get():
            self._insertFunctionStep('opticalFlowAlignmentStep', inputVol,
                                     referenceVol, inputParticlesMd)
        else:
            fnAlignedVolFf = self._getExtraPath(
                'aligned_inputVol_to_refVol_FF.vol')
            fnAlnVolFfLcl = self._getExtraPath(
                'aligned_FfAlnVol_to_refVol_lcl.vol')
            fnInPartsNewAng = self._getExtraPath(
                "inputParts_anglesModified.xmd")
            self._insertFunctionStep('volumeAlignmentStep', referenceVol,
                                     inputVol, fnAlignedVolFf, fnAlnVolFfLcl,
                                     fnInPartsNewAng)
            self._insertFunctionStep('opticalFlowAlignmentStep', fnAlnVolFfLcl,
                                     referenceVol, fnInPartsNewAng)

        self._insertFunctionStep('createOutputStep')
    def _insertAllSteps(self):
        self._createFilenameTemplates()

        #convertInputStep
        particlesMd = self._getFileName('input_xmd')
        imgSet = self.inputParticles.get()
        writeSetOfParticles(imgSet, particlesMd)

        #for debugging purpose
        debugging = False

        inputNameRefVol = self.input3DReference.get().getFileName()
        fnNewVol = self._getExtraPath('newVolume.vol')
        fnNewImgStk = self._getExtraPath('newImages.stk')
        fnNewImgMd = self._getExtraPath('newImages.xmd')
        #do resizing
        if self.doResize.get():
            args = "-i %s " "-o %s --fourier %f " % (inputNameRefVol, fnNewVol,
                                                     self.newSize)
            self.runJob("xmipp_image_resize", args)

            args = "-i %s -o %s --fourier %f" % (particlesMd, fnNewImgStk,
                                                 self.newSize)
            args += " --save_metadata_stack %s" % fnNewImgMd
            args += " --keep_input_columns"

            self.runJob("xmipp_image_resize", args)

            oldSize = self.inputParticles.get().getDim()[0]
            scaleFactor = oldSize / self.newSize.get()

            args = "-i %s" % fnNewImgMd
            args += " --operate modify_values 'shiftX=shiftX*%f'" % scaleFactor
            self.runJob('xmipp_metadata_utilities', args)

            args = "-i %s" % fnNewImgMd
            args += " --operate modify_values 'shiftY=shiftY*%f'" % scaleFactor
            self.runJob('xmipp_metadata_utilities', args)

        #projections from reference volume
        if self.doResize.get():
            args = "-i %s -o %s" % (fnNewVol,
                                    self._getExtraPath('Ref_Projections.stk'))
            args += " --experimental_images %s" % fnNewImgMd
        else:
            args = "-i %s -o %s" % (self.input3DReference.get().getFileName(),
                                    self._getExtraPath('Ref_Projections.stk'))
            args += " --experimental_images %s" % particlesMd
        args += " --sampling_rate %f --sym %s" % (self.angSampRate,
                                                  self.symmetryGroup.get())
        args += " --min_tilt_angle 0 --max_tilt_angle 90"
        args += " --compute_neighbors --angular_distance -1"
        self.runJob("xmipp_angular_project_library",
                    args,
                    numberOfMpi=self.numberOfMpi.get() *
                    self.numberOfThreads.get())

        numberOfParticles = getFloatListFromValues(
            self.numberOfParticles.get())
        fractionCounter = 0
        maxNumberOfParticles = 0.5 * self.inputParticles.get().getSize()
        for number in numberOfParticles:
            if number <= maxNumberOfParticles:
                for iteration in range(0, self.numberOfIterations.get()):
                    self._insertFunctionStep('reconstructionStep', number,
                                             fractionCounter, iteration,
                                             debugging, fnNewImgMd,
                                             particlesMd)
                fractionCounter += 1
        self._insertFunctionStep('gatherResultsStep', debugging)
Ejemplo n.º 23
0
 def convertInputStep(self):
     writeSetOfParticles(self.inputParticles.get(), self.inputFn)
Ejemplo n.º 24
0
 def convertInputStep(self):
     particlesMd = self._getFileName('input_xmd')
     imgSet = self.inputParticles.get()
     #TODO: This only writes metadata what about binary file
     #it should
     writeSetOfParticles(imgSet, particlesMd)
Ejemplo n.º 25
0
 def convertInputStep(self, particlesId):
     """ Write the input images as a Xmipp metadata file. 
     particlesId: is only need to detect changes in
     input particles and cause restart from here.
     """
     writeSetOfParticles(self.partSet, self._getMdParticles())
Ejemplo n.º 26
0
 def _insertAllSteps(self):
     self._createFilenameTemplates()
     
     #convertInputStep 
     particlesMd = self._getFileName('input_xmd')
     imgSet = self.inputParticles.get()
     writeSetOfParticles(imgSet, particlesMd)
             
     #for debugging purpose
     debugging = False        
     
     inputNameRefVol = self.input3DReference.get().getFileName()
     fnNewVol = self._getExtraPath('newVolume.vol')
     fnNewImgStk = self._getExtraPath('newImages.stk')
     fnNewImgMd = self._getExtraPath('newImages.xmd')
     #do resizing
     if self.doResize.get():            
         args = "-i %s ""-o %s --fourier %f " % (inputNameRefVol, 
                                                 fnNewVol,
                                                 self.newSize)
         self.runJob("xmipp_image_resize", args)                                   
         
         args = "-i %s -o %s --fourier %f" % (particlesMd,
                                            fnNewImgStk,
                                            self.newSize)
         args += " --save_metadata_stack %s" % fnNewImgMd
         args += " --keep_input_columns"
         
         self.runJob("xmipp_image_resize", args)
                                 
         oldSize = self.inputParticles.get().getDim()[0]
         scaleFactor = float(self.newSize.get())/float(oldSize)
         
         args = "-i %s" % fnNewImgMd
         args += " --operate modify_values 'shiftX=shiftX*%f'" % scaleFactor 
         self.runJob('xmipp_metadata_utilities', args, numberOfMpi=1)
         
         args =  "-i %s" % fnNewImgMd
         args += " --operate modify_values 'shiftY=shiftY*%f'" % scaleFactor           
         self.runJob('xmipp_metadata_utilities', args, numberOfMpi=1)
                     
     #projections from reference volume        
     if self.doResize.get():
         args = "-i %s -o %s" % (fnNewVol,
                                 self._getExtraPath('Ref_Projections.stk'))
         args += " --experimental_images %s" % fnNewImgMd
     else:
         args = "-i %s -o %s" % (self.input3DReference.get().getFileName(),
                                 self._getExtraPath('Ref_Projections.stk'))
         args += " --experimental_images %s" % particlesMd    
     args += " --sampling_rate %f --sym %s" % (self.angSampRate,
                                               self.symmetryGroup.get())
     args += " --min_tilt_angle 0 --max_tilt_angle 90"                
     args += " --compute_neighbors --angular_distance -1"            
     self.runJob("xmipp_angular_project_library",
                 args,
                 numberOfMpi = self.numberOfMpi.get() * self.numberOfThreads.get())
     
     numberOfParticles = getFloatListFromValues(self.numberOfParticles.get())
     fractionCounter = 0
     maxNumberOfParticles = 0.5 * self.inputParticles.get().getSize()        
     for number in numberOfParticles:
         if number <= maxNumberOfParticles:                
             for iteration in range(0,self.numberOfIterations.get()):
                 self._insertFunctionStep('reconstructionStep', number, 
                                          fractionCounter, iteration, 
                                          debugging, fnNewImgMd,
                                          particlesMd)
             fractionCounter+=1     
     self._insertFunctionStep('gatherResultsStep', debugging)