Exemplo n.º 1
0
    def OnSave(self, event=None):
        from Priithon.all import Mrc, U, Y
        fn = Y.FN(1, verbose=0)
        if not fn:
            return
        if fn[-4:] in [".mrc", ".dat"]:
            Mrc.save(self.m_imgArr, fn)
        elif fn[-5:] in [".fits"]:
            U.saveFits(self.m_imgArr, fn)
        else:
            U.saveImg8(self.m_imgArr, fn)

        Y.shellMessage("### section saved to '%s'\n" % fn)
Exemplo n.º 2
0
    def OnSaveScreenShort(self, event=None):
        """always flipY"""
        from Priithon.all import U, FN, Y
        fn = FN(1, verbose=0)
        if not fn:
            return

        flipY = 1
        if flipY:
            U.saveImg(self.readGLviewport(copy=1)[:, ::-1], fn)
        else:
            U.saveImg(self.readGLviewport(copy=1), fn)

        Y.shellMessage("### screenshot saved to '%s'\n" % fn)
Exemplo n.º 3
0
    def makeFrame(self, size, title, frameParent=None):
        """
        create frame
        if data has "Mrc" attribute, append "<filename>" to given title
        """
        self.downSizeToFitWindow = False
        ### size = (400,400)
        if size is None:
            height, width = self.data.shape[-2:]  #20051128 self.img.shape
            if height // 2 == (width - 1):  ## real_fft2d
                width = (width - 1) * 2
            if width > 600 or height > 600:
                width = height = 600
                self.downSizeToFitWindow = True
#22             if self.nz > 1 and width<250: #HACK: minimum width to see z-slider
#22                 width = 250
        elif type(size) == int:
            width, height = size, size
        else:
            width, height = size

        if title is None:
            title = ''
        if hasattr(self.data,
                   'Mrc'):  # was a HACK: and (len(title)<1 or title[-1]!='>'):
            if title != '':
                title += " "
            title += "<%s>" % self.data.Mrc.filename

        title2 = "%d) %s" % (self.id, title)
        frame = wx.Frame(frameParent,
                         -1,
                         title2,
                         size=(width + 20, height + 50 +
                               100))  # 20070627 MSW: was height+120
        from usefulX import shellMessage
        shellMessage("# window: %s\n" % title2)
        self.title = title
        self.title2 = title2
        return frame
Exemplo n.º 4
0
    def OnMenuSaveND(self, ev=None):
        if self.data.dtype.type in (N.complex64, N.complex128):
            dat = self.dataCplx
            datX = abs(self.data)  #CHECK
        else:
            dat = datX = self.data

        from Priithon.all import Mrc, U, FN, Y
        fn = FN(1, 0)
        if not fn:
            return
        if fn[-4:] in [".mrc", ".dat"]:
            Mrc.save(dat, fn)
        elif fn[-5:] in [".fits"]:
            U.saveFits(dat, fn)
        else:
            # save as sequence of image files
            # if fn does contain something like '%0d' auto-insert '_%0NNd'
            #      with NN to just fit the needed number of digits
            datX = datX.view()
            datX.shape = (-1, ) + datX.shape[-2:]
            U.saveImg8_seq(datX, fn)
        Y.shellMessage("### Y.vd(%d) saved to '%s'\n" % (self.id, fn))
Exemplo n.º 5
0
 def OnSaveClipboard(self, event=None):
     import usefulX as Y
     Y.vCopyToClipboard(self, clip=1)
     Y.shellMessage("### screenshot saved to clipboard'\n")