Exemplo n.º 1
0
    def execute_MLtomo(self):
        import os
        import launch_job, utils_xmipp

        if (self.RestartIter>0):
            print '*********************************************************************'
            print '*  Restarting ml_tomo program :' 
            restartname = utils_xmipp.composeFileName('ml3d_it',iter,'log')
            params= ' -restart ' + restartname
        else:
        
            print '*********************************************************************'
            print '*  Executing ml_tomo program :' 

            # General parameters
            params= ' -i '    + str(self.InSelFile) + \
                    ' -doc '  + str(self.InDocFile) + \
                    ' -o '    + str(self.WorkingDir) + "/" + str(self.OutputRootName) + \
                    ' -iter ' + str(self.NumberOfIterations) + \
                    ' -sym '  + str(self.Symmetry) +\
                    ' -maxres ' + str(self.MaximumResolution)
            if (len(self.MissingDocFile) > 0):
                params+= ' -missing ' + str(self.MissingDocFile)
            if (self.Dimension > 0):
                params+= ' -dim ' + str(self.Dimension)
            if (self.DoKeepAngles):
                params+= ' -keep_angles '

            # Alignment parameters
            if (self.DoAlign):
                params+= ' -ang ' + str(self.AngularSampling)
                if (self.AngularSearchRange<360):
                    params+= ' -ang_search ' + str(self.AngularSearchRange)
                if (self.DoPerturb):
                    params+= ' -perturb '
            else:
                params+= ' -dont_align '

            # Classification parameters
            if (len(self.SeedsSelfile)>0):
                params+= ' -ref ' + str(self.SeedsSelfile)
            else:
                params+= ' -nref ' + str(self.NumberOfReferences)
            if (self.InitialRegularization>0):
                params+= ' -reg0 ' + str(self.InitialRegularization)
                params+= ' -reg_steps ' + str(self.NumberRegularizationSteps)
            if (len(self.MaskName) > 0):
                if (self.DoAlign):
                    print '********************************************************************************'
                    print '*  ERROR: you can only provide a mask if you do NOT allow orientations to change'
                    self.close()
                else:
                    params+= ' -mask ' + str(self.MaskName)

            # Extra parameters
            if (len(self.ExtraParamsMLtomo) > 0):
                params+=' ' + str (self.ExtraParamsMLtomo)

            # Thread parallelization
            if (self.NumberOfThreads > 1):
                params+=' -thr ' + str(self.NumberOfThreads)

                
        launchJob("xmipp_ml_tomo",
                              params,
                              self.log,
                              self.DoParallel,
                              self.NumberOfMpi,
                              self.NumberOfThreads,
                              self.SystemFlavour)
Exemplo n.º 2
0
    def __init__(
        self,
        SelectClasses,
        VisualizeVolZ,
        VisualizeVolX,
        VisualizeVolY,
        VisualizeVolChimera,
        MatrixWidth,
        VisualizeUntiltedAverages,
        VisualizeUntiltedImages,
        VisualizeTiltedImages,
        VisualizeVols,
        VisualizeFilteredVols,
        ProtocolName,
    ):

        import os, sys, shutil

        scriptdir = os.path.split(os.path.dirname(os.popen("which xmipp_protocols", "r").read()))[0] + "/protocols"
        sys.path.append(scriptdir)  # add default search path
        import visualization, utils_xmipp

        # Import the corresponding protocol, get WorkingDir and go there
        pardir = os.path.abspath(os.getcwd())
        shutil.copy(ProtocolName, "protocol.py")
        import protocol

        self.WorkingDir = protocol.WorkingDir
        os.chdir(self.WorkingDir)

        ShowVolumes = []
        ShowSelfiles = []
        ShowImages = []

        refs = utils_xmipp.getCommaSeparatedIntegerList(SelectClasses)
        for ref in refs:

            basename = utils_xmipp.composeFileName("rct_ref", ref, "")
            if VisualizeUntiltedAverages:
                ShowImages.append(basename + "_untilted_avg.xmp")

            if VisualizeUntiltedImages:
                ShowSelfiles.append(basename + "_untilted.sel")

            if VisualizeTiltedImages:
                ShowSelfiles.append(basename + "_tilted.sel")

            if VisualizeVols:
                ShowVolumes.append(basename + "_tilted.vol")

            if VisualizeFilteredVols:
                ShowVolumes.append(basename + "_tilted_filtered.vol")

        visualization.visualize_volumes(ShowVolumes, VisualizeVolZ, VisualizeVolX, VisualizeVolY, VisualizeVolChimera)

        visualization.visualize_images(ShowSelfiles, True, MatrixWidth)

        visualization.visualize_images(ShowImages)

        # Return to parent dir and remove protocol.py(c)
        os.chdir(pardir)
        if os.path.exists("protocol.py"):
            os.remove("protocol.py")
        if os.path.exists("protocol.pyc"):
            os.remove("protocol.pyc")