def shiftStep(self):
        """call xmipp program to shift the particles"""
        centermd = self._getExtraPath("center_particles.xmd")
        args = '-i "%s" -o "%s" ' % (self._getExtraPath("input_particles.xmd"), centermd)
        if self.option:
            self.x = self.xin.get()
            self.y = self.yin.get()
            self.z = self.zin.get()
        else:
            fnvol = self.inputMask.get().getFileName()
            if fnvol.endswith('.mrc'):
                fnvol += ':mrc'
            vol = Volume()
            vol.setFileName(fnvol)
            vol = ih().read(vol.getFileName())
            masscenter = vol.centerOfMass()
            self.x = masscenter[0]
            self.y = masscenter[1]
            self.z = masscenter[2]

        args += '--shift_to %f %f %f ' % (self.x, self.y, self.z)
        program = "xmipp_transform_geometry"
        if not self.interp.get():
            interp = 'linear'
        else:
            interp = 'spline'
        args += ' --apply_transform --dont_wrap --interp %s' % interp
        if self.inv.get():
            args += ' --inverse'
        self.runJob(program, args)

        if not self.boxSizeBool.get():
            box = self.boxSize.get()
            self.runJob('xmipp_transform_window', '-i "%s" -o "%s" --size %d %d %d --save_metadata_stack' %
                        (centermd, self._getExtraPath("crop_particles.stk"), box, box, 1))
 def createOutputStep(self):
     vol1 = self.vol1.get()
     volume = Volume()
     volume.setSamplingRate(vol1.getSamplingRate())
     if vol1.getFileName().endswith('mrc'):
         origin = Transform()
         ccp4header = headers.Ccp4Header(vol1.getFileName(), readHeader=True)
         shifts = ccp4header.getOrigin()
         origin.setShiftsTuple(shifts)
         volume.setOrigin(origin)
     volume.setFileName(self._getExtraPath("output_volume.mrc"))
     filename = volume.getFileName()
     if filename.endswith('.mrc') or filename.endswith('.map'):
         volume.setFileName(filename + ':mrc')
     self._defineOutputs(outputVolume=volume)