def onViewSeq(self, ev): from Priithon.all import Y,U try: Y.view( U.loadImg_seq( self.fn_or_fns ) ) except: if NO_SPECIAL_GUI_EXCEPT: raise import sys e = sys.exc_info() wx.MessageBox("Error when loading image sequence: %s - %s" %\ (str(e[0]), str(e[1]) ), "Non consistent image shapes !?", style=wx.ICON_ERROR) else: s = "Y.view( U.loadImg_seq(<fileslist>) )" Y.shellMessage("### %s\n"% s)
def view(self, idx=0, color=None): """ idx: if viewer if already open, simply go to this idx """ global _ZSLIDER if self.vid is None or Y.viewers[self.vid] is None: if color: old_ignor_color_axis = self.ignor_color_axis self.ignor_color_axis = True # don't know how to disable this arr = self[idx] if color and self.nw >= 2 and self.hdr.ImgSequence in [1, 2]: #colorAxis = mrcIO.findAxis(self.hdr, self.shape, tzw='w') if self.hdr.ImgSequence in (0, 2): colorAxis = 0 elif self.hdr.ImgSequence == 1: colorAxis = -3 Y.view2(arr, colorAxis, self.file, originLeftBottom=1) else: Y.view(arr, self.file, originLeftBottom=1) viewer = Y.viewers[-1] self.vid = viewer.id if (self.nt * self.nz) > 1 or (self.nw > 1 and not color): nz = self.__getattribute__('n%s' % self.sld_axs) self._zslider = vzslider(self, self.vid, nz=nz, title='slide: axis %s of [%i]' % (self.sld_axs, self.vid)) viewer.setSlider2 = _setSlider self._zslider.zslider.SetValue(idx) _ZSLIDER = self._zslider viewer._zslider = self._zslider else: if (self.nt * self.nz) > 1: import wx try: self._setSlider(idx) self._zslider.zslider.SetValue(idx) except wx.PyDeadObjectError: self.vid = None self.view(idx)
def viewOneSec(self, t=0, z=0, w=0, dtype=None): i = mrcIO.sectIdx(t, self.nt, z, self.nz, w, self.nw, self.hdr.ImgSequence) a = self.Mrc.readSec(i) if dtype: a = a.astype(dtype) if self.vid_single is None: Y.view(a, originLeftBottom=1) viewer = Y.viewers[-1] self.vid_single = viewer.id else: try: v = Y.viewers[self.vid_single] v.viewer.my_spv.data[:] = a[:] v.viewer.m_imgChanged = True v.viewer.Refresh() except AttributeError: self.vid_single = None self.viewOneSec(t, z, w)
def onView(self, ev): from Priithon.all import Y Y.view(self.fn_or_fns) # 'list' for "view separately" self.pyshell.addHistory("Y.view( %s )"%(self.txt,))