本文整理汇总了Python中emapplication.EMApp.show_specific方法的典型用法代码示例。如果您正苦于以下问题:Python EMApp.show_specific方法的具体用法?Python EMApp.show_specific怎么用?Python EMApp.show_specific使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emapplication.EMApp
的用法示例。
在下文中一共展示了EMApp.show_specific方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from emapplication import EMApp [as 别名]
# 或者: from emapplication.EMApp import show_specific [as 别名]
def main():
progname = os.path.basename(sys.argv[0])
usage = """prog
Presents a graphical representation of the orientation distribution of the particles in a single particle
reconstruction. This is displayed as a single asymmetric unit on a sphere, with cylinders of varying height
representing the number of particles found in each orientation. Middle-click will produce a control-panel
as usual, and clicking on a single peak will permit viewing the class-average and related projection
(and particles).
Normally launched without arguments from a e2workflow project directory.
"""
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
parser.add_header(name="e2eulerxplorheader", help="Click Launch to Run e2eulerxplor.py", title="### Click Launch to Run e2eulerxplor.py ###", row=0, col=0, rowspan=1, colspan=3)
parser.add_argument("--eulerdata", "-e", type=str,help="File for Eulerdata, Ryan style, if none is given, data is read from the DB.",default=None)
parser.add_argument("--ppid", type=int, help="Set the PID of the parent process, used for cross platform PPID",default=-1)
parser.add_argument("--verbose", "-v", dest="verbose", action="store", metavar="n", type=int, default=0, help="verbose level [0-9], higner number means higher level of verboseness")
global options
(options, args) = parser.parse_args()
logid=E2init(sys.argv,options.ppid)
em_app = EMApp()
window = EMEulerWidget(file_name = options.eulerdata)
em_app.show_specific(window)
em_app.execute()
E2end(logid)
示例2: main
# 需要导入模块: from emapplication import EMApp [as 别名]
# 或者: from emapplication.EMApp import show_specific [as 别名]
def main():
usage="[prog] <2D image file> "
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
(options, args) = parser.parse_args()
logid=E2init(sys.argv)
filename=args[0]
app = EMApp()
img=EMData(filename)
#print img[0]["mean"]
w=EMBreakBrick(img,app)
#w.set_data(img,filename)
app.show_specific(w)
app.exec_()
E2end(logid)
示例3: main
# 需要导入模块: from emapplication import EMApp [as 别名]
# 或者: from emapplication.EMApp import show_specific [as 别名]
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + """ [options] <xml>
Convert xml to txt and optionally display them.
"""
args_def = {'display':1}
parser = argparse.ArgumentParser()
parser.add_argument("xml", nargs='*', help="specify xml files to be processed")
parser.add_argument("-d", "--display", type=int, help="disply (1) or not (0), by default {}".format(args_def['display']))
args = parser.parse_args()
if len(sys.argv) == 1:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options."
sys.exit(1)
# get default values
for i in args_def:
if args.__dict__[i] == None:
args.__dict__[i] = args_def[i]
#
for xml in args.xml:
with open(xml+'.txt', 'w') as w_txt:
for coord in XE.parse(xml).getroot():
for xy in coord:
if xy.tag == 'x':
w_txt.write(xy.text + '\t')
else:
w_txt.write(xy.text + '\n')
# display
if args.display == 1:
app = EMApp()
for xml in args.xml:
filename = xml+'.txt'
w = EMWidgetFromFile(filename,application=app,force_2d=False)
w.setWindowTitle(base_name(filename))
app.show_specific(w)
app.exec_()
示例4: main
# 需要导入模块: from emapplication import EMApp [as 别名]
# 或者: from emapplication.EMApp import show_specific [as 别名]
def main():
usage="Generate training set for tomogram segmentation. This program is still experimental. Please consult the developers before using. "
print usage
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
parser.add_header(name="tmpheader", help='temp label', title="### This program is NOT avaliable yet... ###", row=0, col=0, rowspan=1, colspan=2, mode="box,seg,set")
#### boxing ####
parser.add_argument("--boxing",action="store_true",help="Boxing particles.",default=False, guitype='boolbox', row=4, col=0, rowspan=1, colspan=1, mode='box[True]')
parser.add_pos_argument(name="micrographs",help="List the file to process with e2boxer here.", default="", guitype='filebox', browser="EMRawDataTable(withmodal=True,startpath=\"rawtomograms\")", row=1, col=0,rowspan=1, colspan=3, mode="box")
parser.add_argument("--boxsize","-B",type=int,help="Box size in pixels",default=-1, guitype='intbox', row=3, col=0, rowspan=1, colspan=3, mode="box")
#### segment ####
#parser.add_header(name="instruction", help='instruction', title="### Mark the target features white ###", row=0, col=0, rowspan=1, colspan=2, mode="seg")
parser.add_argument("--segment",action="store_true",help="Segment particles.",default=False, guitype='boolbox', row=4, col=0, rowspan=1, colspan=1, mode='seg[True]')
parser.add_pos_argument(name="particles",help="Particle file.", default="", guitype='filebox', browser="EMParticlesTable(withmodal=True)", row=1, col=0,rowspan=1, colspan=3, mode="seg")
parser.add_argument("--output", type=str,help="output file name. Default is the input particle file name plus _seg.hdf", default=None,guitype='strbox', row=3, col=0, rowspan=1, colspan=3, mode="seg")
#### build set ####
parser.add_argument("--buildset",action="store_true",help="Segment particles.",default=False, guitype='boolbox', row=7, col=0, rowspan=1, colspan=1, mode='set[True]')
parser.add_argument("--particles_raw", type=str,help="Input raw particle file", default=None,guitype='filebox',browser="EMParticlesTable(withmodal=True)", row=1, col=0, rowspan=1, colspan=3, mode="set")
parser.add_argument("--particles_label", type=str,help="Input labels for particle file", default=None,guitype='filebox',browser="EMParticlesTable(withmodal=True)", row=2, col=0, rowspan=1, colspan=3, mode="set")
parser.add_argument("--boxes_negative", type=str,help="Input boxes of negative samples", default=None,guitype='filebox',browser="EMParticlesTable(withmodal=True)", row=3, col=0, rowspan=1, colspan=3, mode="set")
parser.add_argument("--ncopy",type=int,help="Number of copies for NEGATIVE samples. (number of copies of particles is calculated accordingly) ",default=20, guitype='intbox', row=5, col=0, rowspan=1, colspan=1, mode="set")
parser.add_argument("--trainset_output", type=str,help="output file name of the training set.Default is the input particle file name plus _trainset.hdf", default=None,guitype='strbox', row=4, col=0, rowspan=1, colspan=3, mode="set")
##################
parser.add_argument("--ppid", type=int, help="Set the PID of the parent process, used for cross platform PPID",default=-1)
(options, args) = parser.parse_args()
logid=E2init(sys.argv)
#### boxing ###
if options.boxing:
db = js_open_dict(EMBOXERBASE_DB)
cache_box_size = True
if options.boxsize == -1:
cache_box_size = False
options.boxsize = db.setdefault("box_size",64)
application = EMApp()
module = EMBoxerModule(args,options.boxsize)
module.show_interfaces()
application.execute(logid)
#### segment ###
if options.segment:
filename=args[0]
if options.output==None:
options.output=filename[:-4]+"_seg.hdf"
app = EMApp()
img=EMData.read_images(filename)
#print img[0]["mean"]
w=EMImageWidget(data=img,old=None,app=app,force_2d=True)
#w = EMWidgetFromFile(filename,application=app,force_2d=True)
w.setWindowTitle(base_name(filename))
w.show_inspector(1)
ins=w.get_inspector()
ins.mmtab.setCurrentIndex(5)
ins.dtpenv.setText('100')
w.set_mouse_mode(5)
app.show_specific(w)
app.exec_()
try: os.remove(options.output)
except:pass
for e in img:
e.process_inplace("threshold.belowtozero", {"minval":99})
e.process_inplace("threshold.binary", {"value":1})
e.write_image(options.output,-1)
#### build set ###
if options.buildset:
tomo_in=options.particles_raw
seg_in=options.particles_label
neg_in=options.boxes_negative
if tomo_in and neg_in and seg_in:
n_ptcl=EMUtil.get_image_count(tomo_in)
n_neg=EMUtil.get_image_count(neg_in)
if options.trainset_output==None:
options.trainset_output=tomo_in[:-4]+"_trainset.hdf"
p_copy=options.ncopy*n_neg/n_ptcl
else:
p_copy=options.ncopy
try: os.remove(options.trainset_output)
except: pass
print "making {} copies for particles, and {} copies for negative samples".format(p_copy,options.ncopy)
if tomo_in and seg_in:
n_ptcl=EMUtil.get_image_count(tomo_in)
for i in range(n_ptcl):
t=EMData(tomo_in,i)
s=EMData(seg_in,i)
for c in range(p_copy):
tr=Transform()
rd=random.random()*360
tr.set_rotation({"type":"2d","alpha":rd})
e=t.process("xform",{"transform":tr})
#e.process_inplace("normalize")
e.write_image(options.trainset_output,-1)
#.........这里部分代码省略.........