Example #1
0
	def menuFileOpen(self,x):
		if self.particles!=None:
			QtGui.QMessageBox.warning(None,"Error","%s already contains a stack of particles. A new folder is required to start with a new stack of particles. Rerun without --path option."%self.path)
			return

		self.dialog = embrowser.EMBrowserWidget(withmodal=True,multiselect=False)
		QtCore.QObject.connect(self.dialog,QtCore.SIGNAL("ok"),self.gotPath)
		QtCore.QObject.connect(self.dialog,QtCore.SIGNAL("cancel"),self.gotPath)
		self.dialog.show()
Example #2
0
def main():
    progname = os.path.basename(sys.argv[0])
    usage = """prog [options] <image file> ...

	This program can be used to visualize most files used in EMAN2. Running it without arguments
	will open a browser window with more flexible functionality than the command-line.
	"""
    global app, win, options

    parser = EMArgumentParser(usage=usage, version=EMANVERSION)

    parser.add_argument(
        "--classmx",
        type=str,
        help=
        "<classmx>,<#> Show particles in one class from a classification matrix. Pass raw particle file as first argument to command."
    )
    parser.add_argument(
        "--classes",
        type=str,
        help="<rawptcl>,<classmx> Show particles associated class-averages")
    parser.add_argument("--pdb",
                        type=str,
                        help="<pdb file> Show PDB structure.")
    parser.add_argument("--singleimage",
                        action="store_true",
                        default=False,
                        help="Display a stack in a single image view")
    parser.add_argument(
        "--plot",
        action="store_true",
        default=False,
        help="Data file(s) should be plotted rather than displayed in 2-D")
    parser.add_argument(
        "--hist",
        action="store_true",
        default=False,
        help=
        "Data file(s) should be plotted as a histogram rather than displayed in 2-D."
    )
    parser.add_argument(
        "--plot3d",
        action="store_true",
        default=False,
        help="Data file(s) should be plotted rather than displayed in 3-D")
    parser.add_argument(
        "--fullrange",
        action="store_true",
        default=False,
        help=
        "A specialized flag that disables auto contrast for the display of particles stacks and 2D images only."
    )
    parser.add_argument("--newwidget",
                        action="store_true",
                        default=False,
                        help="Use the new 3D widgetD. Highly recommended!!!!")
    parser.add_argument(
        "--ppid",
        type=int,
        help="Set the PID of the parent process, used for cross platform PPID",
        default=-2)
    parser.add_argument(
        "--verbose",
        "-v",
        dest="verbose",
        action="store",
        metavar="n",
        type=int,
        default=0,
        help=
        "verbose level [0-9], higher number means higher level of verboseness")

    (options, args) = parser.parse_args()

    #	logid=E2init(sys.argv)

    app = EMApp()
    #gapp = app
    #QtWidgets.QApplication(sys.argv)
    win = []
    if options.fullrange:
        print(
            """The --fullrange option has been removed, and replaced with an option in user preferences.
To set your preferences for full-range 2-D display, please run:
e2procjson.py --setoption display2d.autocontrast:true
""")
        sys.exit(0)

    if len(args) < 1:
        global dialog
        file_list = []
        dialog = embrowser.EMBrowserWidget(withmodal=False, multiselect=False)
        dialog.show()
        try:
            dialog.raise_()
            # 			QtCore.QObject.connect(dialog,QtCore.SIGNAL("ok"),on_browser_done)
            # 			QtCore.QObject.connect(dialog,QtCore.SIGNAL("cancel"),on_browser_cancel)
        except:
            pass

    elif options.pdb:
        load_pdb(args, app)

    elif options.plot:
        plot(args, app)

    elif options.hist:
        hist(args, app)

    elif options.plot3d:
        plot_3d(args, app)

    elif options.classes:
        options.classes = options.classes.split(",")
        imgs = EMData.read_images(args[0])
        display(imgs, app, args[0])

        win[0].child.mousedown.connect(lambda a, b: selectclass(
            options.classes[0], options.classes[1], a, b))
        try:
            out = open("selected.lst", "w")
            out.write("#LST\n")
            out.close()
        except:
            pass

    elif options.classmx:
        options.classmx = options.classmx.split(",")
        clsnum = int(options.classmx[1])
        imgs = getmxim(args[0], options.classmx[0], clsnum)
        display(imgs, app, args[0])

    else:
        for i in args:
            if not file_exists(i):
                print("%s doesn't exist" % i)
                sys.exit(1)
            display_file(i,
                         app,
                         options.singleimage,
                         usescenegraph=options.newwidget)

    app.exec_()