Example #1
0
 def _showOriginalVolumeSlices(self, param=None):
     if self.protocol.halfVolumes.get() is True:
         cm = DataView(self.protocol.inputVolume.get().getFileName())
         cm2 = DataView(self.protocol.inputVolume2.get().getFileName())
         return [cm, cm2]
     else:
         cm = DataView(self.protocol.inputVolumes.get().getFileName())
         return [cm]
Example #2
0
    def _viewParam(self, param=None):
        if param == 'doShowLog':
            view = self.textView([self.protocol.getOutputLog()],
                                 "Output log file")
        elif param == 'doShowAmp':
            view = DataView(self.protocol.getOutputAmplitudes())
        elif param == 'doShowAmpRot':
            view = DataView(self.protocol.getOutputAmplitudesRot())
        elif param == 'doShowAmpCorr':
            view = DataView(self.protocol.getOutputAmplitudesCorr())

        return [view]
Example #3
0
    def _viewParam(self, param=None):
        if param == 'doShowEigenImages':
            view = DataView(self.protocol.getOutputEigenImages())
        elif param == 'doShowEigPixImages':
            view = DataView(self.protocol._getFileName('msa_eigen_pixel'))
        elif param == 'doShowPixelVecCoordImages':
            view = DataView(self.protocol._getFileName('msa_pixvec_coord'))
        elif param == 'doShowMsaLisFile':
            view = self.textView([self.protocol.getOutputLis()],
                                 "MSA lis file")
        elif param == 'doShowMsaPltFile':
            view = self.textView([self.protocol.getOutputPlt()],
                                 "MSA plt file")

        return [view]
Example #4
0
    def openPath(self, path):
        "Try to open the selected path"
        path = expandPattern(path)

        # If the path is a dir, open it with scipion browser dir <path>
        if os.path.isdir(path):
            dpath = (path if os.path.isabs(path)
                     else os.path.join(os.getcwd(), path))
            subprocess.Popen([pw.getScipionScript(), 'view', dpath])
            return

        # If it is a file, interpret it correctly and open it with DataView
        dirname = os.path.dirname(path)
        fname = os.path.basename(path)
        if '@' in fname:
            path = os.path.join(dirname, fname.split('@', 1)[-1])
        else:
            path = os.path.join(dirname, fname)

        if os.path.exists(path):
            import xmippLib
            fn = xmippLib.FileName(path)
            if fn.isImage() or fn.isMetaData():
                from pyworkflow.em.viewers import DataView
                DataView(path).show()
            else:
                _open_cmd(path)
        else:
            # This is probably one special reference, like sci-open:... that
            # can be interpreted with our handlers.
            tag = path.split(':', 1)[0] if ':' in path else None
            if tag in self.handlers:
                self.handlers[tag](path.split(':', 1)[-1])
            else:
                print "Can't find %s" % path
Example #5
0
    def _visualize(self, obj, **args):
        if hasattr(obj, 'outputVolumes'):
            XmippViewer._visualize(self, self.protocol.outputVolumes)
        fnBasis = self.protocol._getExtraPath('split_pc1.vol')
        if exists(fnBasis):
            self._views.append(DataView(fnBasis))

        return self._views
Example #6
0
 def _showInternalParticles(self, paramName=None):
     views = []
     for it in self._iterations:
         fnDir = self.protocol._getExtraPath("Iter%03d" % it)
         fnAngles = join(fnDir, "angles.xmd")
         if exists(fnAngles):
             views.append(
                 DataView(fnAngles, viewParams={showj.MODE: showj.MODE_MD}))
     return views
Example #7
0
 def _viewVolume(self, e=None):
     import pyworkflow.em.metadata as md
     viewLabels = 'id enabled _index _filename _xmipp_weight'
     cm = DataView(self.protocol.outputVolumes.getFileName(),
                   viewParams={
                       MODE: MODE_MD,
                       ORDER: viewLabels,
                       RENDER: '_filename',
                       VISIBLE: viewLabels
                   })
     return [cm]
Example #8
0
    def _visualize(self, obj, **kwargs):
        views = []
        outputClasses = getattr(obj, 'outputClasses', None)

        if outputClasses is not None:
            renderLabels = '_representative._filename _reprojection._filename'
            labels = 'id enabled %s _representative._xmipp_angleRot _representative._xmipp_angleTilt _representative._xmipp_classCount' % renderLabels

            views.append(
                ObjectView(self._project,
                           outputClasses.strId(),
                           outputClasses.getFileName(),
                           viewParams={
                               showj.ORDER: labels,
                               showj.VISIBLE: labels,
                               showj.RENDER: renderLabels,
                               showj.MODE: showj.MODE_MD
                           }))

#             outputAverages = getattr(obj, 'outputAverages', None)
#             if outputAverages is not None:
#                 renderLabels = '_filename'
#                 labels = 'id enabled %s _xmipp_angleRot _xmipp_angleTilt _xmipp_classCount' % renderLabels
#                 views.append(ObjectView(self._project, outputAverages.strId(),
#                                         outputAverages.getFileName(),
#                                         viewParams={showj.ORDER: labels,
#                                                     showj.VISIBLE: labels,
#                                                     showj.RENDER: renderLabels,
#                                                     showj.MODE: showj.MODE_MD}))

        if hasattr(obj, 'outputVolumes'):
            outputVolumes = obj.outputVolumes
            labels = 'id enabled comment _filename '
            views.append(
                ObjectView(self._project,
                           outputVolumes.strId(),
                           outputVolumes.getFileName(),
                           viewParams={
                               showj.MODE: showj.MODE_MD,
                               showj.ORDER: labels,
                               showj.VISIBLE: labels,
                               showj.RENDER: '_filename'
                           }))

        fnBasis = self.protocol._getExtraPath('split_pc1.vol')
        if exists(fnBasis):
            views.append(DataView(fnBasis))

        return views
Example #9
0
    def _showPlot(self, paramName=None):
        views = []
        color = self.colozaxis
        rmax = self.radcut.get()

        if self.displayPlot == TILT_SCATTER:
            views.append(self._createScatterPlot(rmax, colorzaxis=color))
        elif self.displayPlot == TILT_CONTOUR:
            plotFn = self.protocol._getFileName('outputContourPlot')
            if pwutils.exists(plotFn):
                views.append(DataView(plotFn))
            else:
                raise Exception("Contour plot file not found: %s" % plotFn)

        return views
Example #10
0
    def _viewP(self, e=None):
        volId = int(self.volForCurve.get())
        vol = self.protocol.outputVolumes[volId]

        if vol is None:  # Wrong volume selection
            return [self.errorMessage("Invalid volume id *%d*" % volId)]

        pFn = vol.clusterMd.get()
        mdCls = md.MetaData(vol.clusterMd.get())
        return [
            self._viewPlot("Cluster tendency parameter for each image",
                           IMAGE_INDEX,
                           P_INDEX,
                           mdCls,
                           md.MDL_IMAGE_IDX,
                           md.MDL_WEIGHT,
                           color='b'),
            DataView(pFn)
        ]
Example #11
0
def showExtraFile(volumeSet, volId, suffix):
    vol = volumeSet[volId]
    volFn = vol.getFileName().replace('.hdf', suffix)
    DataView(volFn).show()
Example #12
0
 def _showOriginalVolumeSlices(self, param=None):
     cm = DataView(self.protocol.inputVolume.get().getFileName())
     return [cm]
Example #13
0
    def _showVolumeSlices(self, param=None):
        cm = DataView(self.protocol.resolution_Volume.getFileName())

        return [cm]
Example #14
0
 def getFileActions(self, objFile):
     from pyworkflow.em.viewers import DataView
     fn = objFile.getPath()
     return [('Open with Xmipp viewer', lambda: DataView(fn).show(),
              Icon.ACTION_VISUALIZE)]
Example #15
0
 def _showDoASlices(self, param=None):
     cm = DataView(self.protocol._getExtraPath(OUTPUT_DOA_FILE))
     return [cm]
 def _viewInfo(self, fn):
     """ Display the info block in the metadata for a level convergence. """
     return DataView('info@' + fn)
Example #17
0
 def createDataView(self, filename, viewParams={}):
     return DataView(filename, env=self._env, viewParams=viewParams)
Example #18
0
def showFile(path, viewParams):
    DataView(path, viewParams).show()
 def createDataView(self, filename, viewParams={}):
     return DataView(filename, viewParams)