def createOutputStep(self):
        volume = Volume()
        volume.setFileName(self._getExtraPath('postprocess.mrc'))
        volume.setSamplingRate(self.samplingRate)
        vol = self.protRelionRefine.get().outputVolume
        mask = VolumeMask()
        mask.setFileName(self._getExtraPath('postprocess_automask.mrc'))
        mask.setSamplingRate(self.samplingRate)

        self._defineOutputs(outputVolume=volume)
        self._defineOutputs(outputMask=mask)
        self._defineSourceRelation(vol, volume)
        self._defineSourceRelation(vol, mask)
Exemple #2
0
    def createOutputStep(self):
        volume = Volume()
        volume.setFileName(self._getExtraPath('postprocess.mrc'))
        volume.setSamplingRate(self.samplingRate)
        vol = self.protRelionRefine.get().outputVolume
        mask = VolumeMask()
        mask.setFileName(self._getExtraPath('postprocess_automask.mrc'))
        mask.setSamplingRate(self.samplingRate)

        self._defineOutputs(outputVolume=volume)
        self._defineOutputs(outputMask=mask)
        self._defineSourceRelation(vol, volume)
        self._defineSourceRelation(vol, mask)
Exemple #3
0
    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)
Exemple #4
0
    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)
    def test_pattern(self):
        #1) create fake protocol so I have a place to save data
        #prot = self.launchFakeProtocol()
        #output stack
        self.setPartName = self.proj.getTmpPath(setPartName)
        self.setPartSqliteName = self.proj.getTmpPath(setPartSqliteName)
        self.setPartSqliteCtfName = self.proj.getTmpPath(setPartSqliteCtfName)
        self.setPartSqliteCTfPosName = self.proj.getTmpPath(setPartSqliteCTfPosName)
        self.kksqlite = self.proj.getTmpPath("kk.sqlite")
        self.setPartMd = self.proj.getTmpPath(setPartNameMd)
        self.volBaseFn = self.proj.getTmpPath(volName)
        self.maskName = self.proj.getTmpPath(maskName)

        #2) create projections and sets of particles
        self.createProjection(proj1, 1, self.setPartName)
        self.createProjection(proj2, 2, self.setPartName)
        self.createProjection(proj3, 3, self.setPartName)
        self.createSetOfParticles(self.setPartSqliteCTfPosName, self.proj.getTmpPath(setPartCtfPosName), True)
        self.createSetOfParticles(self.setPartSqliteCtfName, self.proj.getTmpPath(setPartCtfName), True)
        self.createSetOfParticles(self.setPartSqliteName, self.setPartName, False)
        #create auxiliary setofparticles
        self.createSetOfParticles(self.kksqlite, self.setPartName, True)
        #4) apply CTF
        self.applyCTF(self.setPartMd)
        #5) create volume
        self.createVol(vol1)
        #6) create mask
        self.createMask(self.maskName)

        #import three projection datasets, volume and mask
        protPlainProj   = self.importData(self.setPartSqliteName, "plain projection",
                                          ProtImportParticles,
                                          ProtImportParticles.IMPORT_FROM_SCIPION)
        protCTFProj     = self.importData(self.setPartSqliteCtfName,"ctf projection",
                                          ProtImportParticles,
                                          ProtImportParticles.IMPORT_FROM_SCIPION)
        protCTFposProj  = self.importData(self.setPartSqliteCTfPosName, "pos ctf projection",
                                          ProtImportParticles,
                                          ProtImportParticles.IMPORT_FROM_SCIPION)
        _protImportVol   = self.importData(os.path.abspath(self.proj.getTmpPath(volName)), "3D reference",
                                           ProtImportVolumes,
                                           ProtImportParticles.IMPORT_FROM_FILES)
        _protImportMask  = self.importData(self.proj.getTmpPath(maskName), "3D mask",
                                           ProtImportMask,
                                           ProtImportParticles.IMPORT_FROM_FILES)
        mask = VolumeMask()
        mask.setFileName(self.proj.getTmpPath(maskName))
        mask.setSamplingRate(samplingRate)

        #launch substract protocol <<<<<<<<<<<<<<<<<<<<<<<<<<
        protSubtract = self.newProtocol(XmippProtSubtractProjection)
        protSubtract.inputParticles.set(protPlainProj.outputParticles)
        protSubtract.inputVolume.set(_protImportVol.outputVolume)
        protSubtract.refMask.set(_protImportMask.outputMask)
        protSubtract.projType.set(XmippProtSubtractProjection.CORRECT_NONE)
        self.launchProtocol(protSubtract)

        protSubtractCTF = self.newProtocol(XmippProtSubtractProjection)
        protSubtractCTF.inputParticles.set(protCTFProj.outputParticles)
        protSubtractCTF.inputVolume.set(_protImportVol.outputVolume)
        protSubtractCTF.refMask.set(_protImportMask.outputMask)
        protSubtractCTF.projType.set(XmippProtSubtractProjection.CORRECT_FULL_CTF)
        self.launchProtocol(protSubtractCTF)

        protSubtractCTFpos = self.newProtocol(XmippProtSubtractProjection)
        protSubtractCTFpos.inputParticles.set(protCTFposProj.outputParticles)
        protSubtractCTFpos.inputVolume.set(_protImportVol.outputVolume)
        protSubtractCTFpos.refMask.set(_protImportMask.outputMask)
        protSubtractCTFpos.projType.set(XmippProtSubtractProjection.CORRECT_PHASE_FLIP)
        self.launchProtocol(protSubtractCTFpos)

        protSubtractCTFRelion = self.newProtocol(ProtRelionSubtract)
        protSubtractCTFRelion.inputParticles.set(protCTFProj.outputParticles)
        protSubtractCTFRelion.inputVolume.set(_protImportVol.outputVolume)
        self.launchProtocol(protSubtractCTFRelion)

        self.assertIsNotNone(protSubtract.outputParticles, "There was a problem with subtract projection")




        self.assertTrue(True)