def createOutputStep(self):
        
        extradir = self._getExtraPath()
        inputset = self.tiltpair.get()
        uSet = inputset.getUntilted()
        tSet = inputset.getTilted()
        
        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix='Untilted')
        if self.typeOfSet.get() == TYPE_PARTICLES:
#             boxsize_u = self.untiltPar.get().getCoordinates().getBoxSize()
#             if boxsize_u is None:
                aux = self.untiltPar.get()
                aux2 = aux[1]
                boxsize_u, y_, z_ = aux2.getDim()
        else:
            boxsize_u = self.untiltCoor.get().getBoxSize()
        
        uCoordSet.setBoxSize(boxsize_u)    
        tCoordSet = self._createSetOfCoordinates(tSet, suffix='Tilted')
        readSetOfCoordinates(extradir, uSet, uCoordSet)
        uCoordSet.write()
        
        if self.typeOfSet.get() == TYPE_PARTICLES:
#             boxsize_t = self.tiltPar.get().getCoordinates().getBoxSize()
#             if boxsize_t is None:
                aux = self.tiltPar.get()
                aux2 = aux[1]
                boxsize_t, y_, z_ = aux2.getDim()
        else:
            boxsize_t = self.tiltCoor.get().getBoxSize()
        
        tCoordSet.setBoxSize(boxsize_t)
        readSetOfCoordinates(extradir, tSet, tCoordSet)
        tCoordSet.write()
        

        setAngles = self._createSetOfAngles()
        pathangles = self.micsFn + '/input_micrographs.xmd'
        readAnglesFromMicrographs(pathangles, setAngles)
        
        setAngles.write()
        # Create CoordinatesTiltPair object
        outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs.sqlite'))
        outputset.setTilted(tCoordSet)
        outputset.setUntilted(uCoordSet)
        outputset.setAngles(setAngles)
        outputset.setMicsPair(inputset)
        outputset.setObjComment(self.getSummary(outputset))
#         print '-----------------------------'
#         print setAngles
#         print '-----------------------------'
        for coordU, coordT in izip(uCoordSet, tCoordSet):
            outputset.append(TiltPair(coordU, coordT))

        self._defineOutputs(outputCoordinatesTiltPair=outputset)
        self._defineSourceRelation(self.tiltpair, outputset)
    def registerCoords(self, args):
        from pyworkflow.em.packages.xmipp3 import readSetOfCoordinates, readAnglesFromMicrographs

        extradir = self._getExtraPath()
        count = self.getOutputsSize()
        suffix = str(count + 1) if count > 0 else ''
        inputset = self.inputMicrographsTiltedPair.get()
        uSet = inputset.getUntilted()
        tSet = inputset.getTilted()
        outputName = 'outputCoordinatesTiltPair' + suffix
        uSuffix = 'Untilted' + suffix
        tSuffix = 'Tilted' + suffix
        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix=uSuffix)
        readSetOfCoordinates(extradir, uSet, uCoordSet)
        uCoordSet.write()
        tCoordSet = self._createSetOfCoordinates(tSet, suffix=tSuffix)
        readSetOfCoordinates(extradir, tSet, tCoordSet)
        tCoordSet.write()

        # Read Angles from input micrographs
        micsFn = self._getPath('input_micrographs.xmd')
        setAngles = self._createSetOfAngles(suffix=suffix)
        readAnglesFromMicrographs(micsFn, setAngles)
        setAngles.write()
        # Create CoordinatesTiltPair object
        outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs%s.sqlite' % suffix))
        outputset.setTilted(tCoordSet)
        outputset.setUntilted(uCoordSet)
        outputset.setAngles(setAngles)
        outputset.setMicsPair(inputset)
        for coordU, coordT in izip(uCoordSet, tCoordSet):
            outputset.append(TiltPair(coordU, coordT))

        summary = self.getSummary(outputset)
        outputset.setObjComment(summary)
        outputs = {outputName: outputset}
        self._defineOutputs(**outputs)
        self._defineSourceRelation(inputset, outputset)
        self._store()
    def _importFromFolderStep(self):
        """ This function will copy Xmipp .pos files for
        simulating a particle picking run...this is only
        for testing purposes.
        """
        for f in getFiles(self.importFolder.get()):
            copyFile(f, self._getExtraPath())

        extradir = self._getExtraPath()  
        
        inputset = self.inputMicrographsTiltedPair.get()
        uSet = inputset.getUntilted()
        tSet = inputset.getTilted()

        # Create Untilted and Tilted SetOfCoordinates
        uCoordSet = self._createSetOfCoordinates(uSet, suffix='Untilted')
        readSetOfCoordinates(extradir, uSet, uCoordSet)
        uCoordSet.write()
        tCoordSet = self._createSetOfCoordinates(tSet, suffix='Tilted')
        readSetOfCoordinates(extradir, tSet, tCoordSet)
        tCoordSet.write()
        
        # Read Angles from faked input micrographs
        micsFn = self._getExtraPath('input_micrographs.xmd')
        setAngles = self._createSetOfAngles()
        readAnglesFromMicrographs(micsFn, setAngles)
        setAngles.write()
        # Create CoordinatesTiltPair object
        outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs.sqlite'))
        outputset.setTilted(tCoordSet)
        outputset.setUntilted(uCoordSet)
        outputset.setAngles(setAngles)
        outputset.setMicsPair(inputset)
        outputset.setObjComment(self.getSummary(outputset))
        for coordU, coordT in izip(uCoordSet, tCoordSet):
            outputset.append(TiltPair(coordU, coordT))
        
        self._defineOutputs(outputCoordinatesTiltPair=outputset)
        self._defineSourceRelation(inputset, outputset)