Beispiel #1
0
    def __init__(self,
                 gl_widget,
                 projection_file=None,
                 simmx_file=None,
                 particle_file=None):
        self.init_lock = True  # a lock indicated that we are still in the __init__ function
        self.au_data = None  # This will be a dictionary, keys will be refinement directories, values will be something like available iterations for visual study
        EM3DSymModel.__init__(self, gl_widget)
        self.window_title = "SimmxXplor"
        #InputEventsManager.__init__(self)

        self.projection_file = projection_file  # a projection file produced by e2project3d
        self.particle_file = particle_file  # A file containing particles to be examined

        self.current_particle = -1  # keep track of the current particle
        self.current_projection = None  # keep track of the current projection

        self.ptcl_display = None  # display all particles
        self.mx_display = None  # mx display module for displaying projection and aligned particle
        self.lay = None  # 2d plot for displaying comparison between particle and projection

        self.simcmp = "dot:normalize=1"
        self.align = "rotate_translate_flip"
        self.aligncmp = "dot"
        self.refine = "refine"
        self.refinecmp = "dot:normalize=1"
        self.shrink = 1
Beispiel #2
0
    def generate_current_display_list(self, force=False):
        '''
		Redefinition of EMImage3DSymModule.generate_current_display_list

		'''
        if self.init_lock: return 0
        if self.au_data == None or len(self.au_data) == 0:
            EM3DSymModel.generate_current_display_list(self, force)

        self.init_basic_shapes()
        if self.nomirror == True: val = 0
        else: val = 1
        self.trace_great_arcs(self.sym_object.get_asym_unit_points(val))
        self.trace_great_triangles(val)

        self.eulers = self.specified_eulers
        if self.eulers == None: return 0

        #		if not self.colors_specified: self.point_colors = []
        #		else: self.point_colors = self.specified_colors
        #		self.points = []
        #		for i in self.eulers:
        #			p = i.transpose()*Vec3f(0,0,self.radius)
        #			self.points.append(p)
        #			if not self.colors_specified: self.point_colors.append((0.34615, 0.3143, 0.0903,1))

        self.make_sym_dl_list(self.eulers)
        return 1
Beispiel #3
0
    def update_cmp(self):
        cmpopt = parsemodopt(self.simcmp)

        progress = QtGui.QProgressDialog("Computing similarities", "Abort", 0,
                                         len(self.proj_data), None)
        progress.show()
        ptcl = self.ptcl_data[self.current_particle]
        for i, p in enumerate(self.proj_data):
            ali = p.copy()
            ali.transform(p["ptcl.align2d"])
            try:
                p["cmp"] = -ptcl.cmp(cmpopt[0], ali, cmpopt[1])
            except:
                print(traceback.print_exc())
                QtGui.QMessageBox.warning(
                    None, "Error",
                    "Invalid similarity metric string, or other comparison error"
                )
                progress.close()
                return
            progress.setValue(i)
            QtGui.qApp.processEvents()

        progress.close()
        self.set_emdata_list_as_data(self.proj_data, "cmp")
        #		self.regen_dl(True)
        EM3DSymModel.render(self)
Beispiel #4
0
 def mousePressEvent(self, event):
     if self.events_mode == "inspect":
         self.current_hit = self.get_hit(event)
         if self.current_hit == None:
             EM3DSymModel.mousePressEvent(self, event)
     else:
         EM3DSymModel.mousePressEvent(self, event)
Beispiel #5
0
	def render(self):
		if self.inspector == None: self.get_inspector()
		if self.projections == None:
			try:self.init_vitals()
			except: return
			#except:
			#	self.get_inspector()
			#	print "failed to initialize vital information"
			#	return

		EM3DSymModel.render(self)
Beispiel #6
0
    def keyPressEvent(self, event):

        if event.key() == Qt.Key_F1:
            self.display_web_help(
                "http://blake.bcm.edu/emanwiki/EMAN2/Programs/e2eulerxplor")
        elif event.key() == Qt.Key_F:
            if self.flatten > 0: self.flatten = 0.0
            else: self.flatten = 1.0
            self.generate_current_display_list(True)
            self.updateGL()
        else:
            EM3DSymModel.keyPressEvent(self, event)
Beispiel #7
0
	def __init__(self, gl_widget, projection_file=None,simmx_file=None,particle_file=None):
		self.init_lock = True # a lock indicated that we are still in the __init__ function
		self.au_data = None # This will be a dictionary, keys will be refinement directories, values will be something like available iterations for visual study
		EM3DSymModel.__init__(self, gl_widget)
		self.window_title = "SimmxXplor"

		self.projection_file = projection_file # a projection file produced by e2project3d
		self.simmx_file = simmx_file # a similarity matrix produced by e2simmx or by e2classaverage - should have the same number of columns (nx) as the number of projections
		self.particle_file = particle_file # a similarity matrix produced by e2simmx or by e2classaverage - should have the same number of columns (nx) as the number of projections
		self.num_particles = None # keep track of the total number of particles ( the y dimension of the simmx file)
		self.current_particle = 0 # keep track of the current particle
		self.current_projection = None # keep track of the current projection
		self.projections = None # a list of the projections - the initial design keeps them all in memory - this could be overcome
		self.mx_display = None # mx display widget for displaying projection and aligned particle
		self.frc_display = None # 2d plot for displaying comparison between particle and projection
		self.mirror_eulers = True # If True the drawn Eulers are are also rendered on the opposite side of the sphere - see EM3DSymModel.make_sym_dl_lis
Beispiel #8
0
	def render(self):
		if self.inspector == None: self.get_inspector()
			
		EM3DSymModel.render(self)
Beispiel #9
0
 def __del__(self):
     EM3DSymModel.__del__(
         self
     )  # this is here for documentation purposes - beware that the del function is important
Beispiel #10
0
    def __init__(self,
                 gl_widget=None,
                 auto=True,
                 sparse_mode=False,
                 file_name="",
                 read_from=None):
        self.current_hit = None
        self.events_mode_list = ["navigate", "inspect"]
        self.events_mode = self.events_mode_list[1]

        self.init_lock = True  # a lock indicated that we are still in the __init__ function
        self.au_data = None  # This will be a dictionary, keys will be refinement directories, values will be something like available iterations for visual study
        if len(read_from) == 0:
            read_from = None
        self.readfrom = read_from
        if self.readfrom:

            file_name = ""
            auto = False
            datalst = []
            for rr in self.readfrom:
                datalst.append([rr, None, None, None, rr])
            self.au_data = {"data": datalst}

        if auto:  # this a flag that tells the eulerxplorer to search for refinement data and automatically add elements to the inspector, if so
            self.gen_refinement_data()

        EM3DSymModel.__init__(self, gl_widget, eulerfilename=file_name)
        Animator.__init__(self)
        self.height_scale = 8.0  # This is a value used in EM3DSymModel which scales the height of the displayed cylinders - I made it 8 because it seemed fine. The user can change it anyhow
        self.projection_file = None  # This is a string - the name of the projection images file
        self.average_file = None  # This is a string - the name of the class averages file
        self.proj_class_viewer = None  # This will be an EMImageMXWidget that shows the class and/or projection
        self.particle_viewer = None  # This will be an EMImageMXWidget that shows the particles in a class
        self.clsdb = None  # I think this will become redundant - it used to be the old database that stores which particles are in a class, but now that's stored in the header
        self.particle_file = None  # This will be a string - the name of the file that has the particle files in it. This might be made redundant with the new approach
        self.alignment_file = None  # This will be a string - the name of the file containing the alignment parameters - this is essential if you we want to show the aligned particles
        self.refine_dir = None  # This will be a string - the name of the current refinement directory that is being studied
        self.dx = None  # This is an EMData object storing the x shifts of the alignments for all particles. Generated by e2classaverage
        self.dy = None  # This is an EMData object storing the y shifts of the alignments for all particles. Generated by e2classaverage
        self.da = None  # This is an EMData object storing the angle of the alignments for all particles. Generated by e2classaverage
        self.dflip = None  # This is an EMData object storing whether or not tthe alignment involved a flip, for all particles. Generated by e2classaverage
        self.classes = None  # This is an EMData object storing which class(es) a particle belongs to. Generated by e2classaverage
        self.inclusions = None  # This is and EMDAta storing a boolean that indicates the particle was actually included in the final average. Generated by e2classaverage

        self.average = None  # This the class average itself, an EMData object
        self.projection = None  # This is the projection itelse, an EMData object
        self.class_idx = None  # This is the idx of the current class being studied in the interface

        self.previous_len = -1  # To keep track of the number of class averages that were previously viewable. This helps to make sure we can switch to the same class average in the context of a different refinement iteration
        module_closed = QtCore.pyqtSignal()
        self.mirror_eulers = False
        if sparse_mode:
            self.mirror_eulers = True  # If True the drawn Eulers are are also rendered on the opposite side of the sphere - see EM3DSymModel.make_sym_dl_lis

        # Grab the symmetry from the workflow database if possible
        sym = "c1"
        if js_check_dict("refine_01/0_refine_parms.json"):
            try:
                sym = str(js_open_dict("refine_01/0_refine_parms.json")["sym"])
            except:
                pass

        # Have to tell the EM3DSymModel that there is a new sym
        self.set_symmetry(sym)

        # this object will have
        if self.au_data != None:
            combo_entries = list(self.au_data.keys())
            combo_entries.sort()
            combo_entries.reverse()

            if len(combo_entries) > 0:
                au = combo_entries[0]
                cls = self.au_data[au][0][0]
                self.on_au_selected(au, cls)
                self.mirror_eulers = True

        self.init_lock = False
        self.force_update = True  # Force a display udpdate in EMImage3DSymModule

        self.point_selected.connect(self.au_point_selected)
Beispiel #11
0
 def mouseMoveEvent(self, event):
     if self.events_mode == "inspect" and self.current_hit:
         pass
     else:
         EM3DSymModel.mouseMoveEvent(self, event)