예제 #1
0
파일: init.py 프로젝트: imclab/vistrails
from matrix import Matrix
from config_reader import ConfigReader, WriteVarsIntoDataFile, ReadData
from core.modules.module_registry import get_module_registry
from plots import Coordinator, Dendrogram, ParallelCoordinates, TaylorDiagram, SeriesPlot
from core import debug
from core.bundles import py_import
try:
    mpl_dict = {'linux-ubuntu': 'python-matplotlib',
                'linux-fedora': 'python-matplotlib'}
    matplotlib = py_import('matplotlib', mpl_dict)
    matplotlib.use('Qt4Agg', warn=False)
    pylab = py_import('pylab', mpl_dict)
except Exception, e:
    debug.critical("Exception: %s" % e)



################################################################################
_modules = [(Matrix,                {'namespace':Matrix.my_namespace,                'name':Matrix.name}),
            (ConfigReader,          {'namespace':ConfigReader.my_namespace,          'name':ConfigReader.name}),
            (WriteVarsIntoDataFile, {'namespace':WriteVarsIntoDataFile.my_namespace, 'name':WriteVarsIntoDataFile.name}),
            (ReadData,              {'namespace':ReadData.my_namespace,              'name':ReadData.name}),
            (SeriesPlot,            {'namespace':SeriesPlot.my_namespace,            'name':SeriesPlot.name}),
            (Dendrogram,            {'namespace':Dendrogram.my_namespace,            'name':Dendrogram.name}),
            (TaylorDiagram,         {'namespace':TaylorDiagram.my_namespace,         'name':TaylorDiagram.name}),
            (ParallelCoordinates,   {'namespace':ParallelCoordinates.my_namespace,   'name':ParallelCoordinates.name})
            ]

reg = get_module_registry()
reg.add_module(Coordinator)
reg.add_output_port(Coordinator, "self", Coordinator)
예제 #2
0
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
############################################################################
""" Do not edit this file!

File automatically generated by scripts/gen_init.py
Change History:
version : description
  0.2   : Integrated quickplot module that displays the CDAT plot
          widget inside the spreadsheet  
  0.1   : First automatically generated package based on xml descriptions

"""
from PyQt4 import QtCore, QtGui
import sip
import core.modules
import core.modules.module_registry
from core.modules.vistrails_module import (Module, NotCacheable,
                                           ModuleError, new_module)
from core.bundles import py_import
import os, sys

#cdat specific packages
vcs = py_import('vcs',{})
cdms2 = py_import('cdms2', {})
cdutil = py_import('cdutil', {})

#local python modules
from cdat_window import QCDATWindow
from cdat_cell import QCDATWidget
from quickplot import quickplot
예제 #3
0
version : description
  0.2   : Integrated quickplot module that displays the CDAT plot
          widget inside the spreadsheet  
  0.1   : First automatically generated package based on xml descriptions

"""
from PyQt4 import QtCore, QtGui
import sip
import api
import core.modules
import core.modules.module_registry
from core.modules.vistrails_module import (Module, NotCacheable, ModuleError,
                                           new_module)
from core.bundles import py_import
from gui.shell import QShellDialog
#from gui.uvcdat.mainwindow import UVCDATMainWindow

import os, sys
#import qtbrowser
#qtbrowser.use_vistrails=True
#cdat specific packages
vcs = py_import('vcs', {})
cdms2 = py_import('cdms2', {})
cdutil = py_import('cdutil', {})

#local python modules
from cdat_cell import QCDATWidget, CDATCell, Variable, GraphicsMethod, Gfb
from quickplot import quickplot
from translator import QTranslator
from plot_registry import PlotRegistry
예제 #4
0
def initialize(*args, **keywords):
    import core.modules.module_registry
    from packages.vtDV3D.CDMS_VariableReaders import CDMSVariableSource, CDMSTransientVariable, CDMS_HoffmullerReader, CDMS_VolumeReader, CDMS_ChartDataReader, CDMS_SliceReader, CDMS_VectorReader, CDMS_HoffmullerReaderConfigurationWidget, CDMS_VolumeReaderConfigurationWidget, CDMS_ChartDataConfigurationWidget, CDMS_SliceReaderConfigurationWidget, CDMS_VectorReaderConfigurationWidget 
    from packages.vtDV3D.VolumeSlicerModule import VolumeSlicer
    from packages.vtDV3D.VolumeRenderModule import VolumeRenderer
    from packages.vtDV3D.ParallelCoordinatesModule import ParallelCoordinateViewer
    from packages.vtDV3D.WorldMapModule import WorldFrame
    from packages.vtDV3D.VoxelizerModule import Voxelizer
    from packages.uvcdat.init import Variable, VariableSource
#    from DemoDataModule import DemoData, DemoDataConfigurationWidget
#    from packages.vtDV3D.InteractiveConfiguration import LayerConfigurationWidget
    from packages.vtDV3D.LevelSurfaceModule import LevelSurface 
    from packages.vtDV3D.CurtainPlotModule import CurtainPlot 
    from packages.uvcdat_cdms.init import CDMSVariable
    from packages.vtDV3D.ResampleModule import Resample 
    from packages.vtDV3D.CDATUtilitiesModule import CDMS_CDATUtilities, CDATUtilitiesModuleConfigurationWidget
    from packages.vtDV3D.GradientModule import  Gradient
    from packages.vtDV3D.WorkflowModule import WorkflowModule
    from packages.vtDV3D.VectorCutPlaneModule import GlyphArrayCutPlane, StreamlineCutPlane 
    from packages.vtDV3D.VectorVolumeModule import VectorVolume 
    from packages.spreadsheet.basic_widgets import CellLocation
    from core.modules.basic_modules import Integer, Float, String, Boolean, Variant, Color
    import api
        
    reg = core.modules.module_registry.get_module_registry()   
    vtkAlgorithmOutputType = typeMap('vtkAlgorithmOutput')
    vtkImageDataType = typeMap('vtkImageData')
    reg.add_module( AlgorithmOutputModule, abstract=True) # hide_descriptor=True )       
    reg.add_module( AlgorithmOutputModule3D, abstract=True) # hide_descriptor=True )   
    reg.add_module( AlgorithmOutputModule2D, abstract=True) # hide_descriptor=True )   
    reg.add_module( WorkflowModule, abstract=True) # hide_descriptor=True )   
    reg.add_module( CDMSDataset, abstract=True) # hide_descriptor=True )   
     
    reg.add_module( MapCell3D, configureWidgetType=MapCell3DConfigurationWidget, namespace='spreadsheet' ) 
    reg.add_input_port( MapCell3D, "volume", AlgorithmOutputModule3D  )   
    reg.add_input_port( MapCell3D, "cell_location", [ ( String, 'cell_coordinates' ) ], True )
    reg.add_input_port( MapCell3D, "world_cut", Integer, optional=True  )
    reg.add_input_port( MapCell3D, "map_border_size",  [ ( Float, 'border_in_degrees' ) ], optional=True  )
    reg.add_input_port( MapCell3D, "enable_basemap",  [ ( Boolean, 'enable' ) ], optional=True  )    
    reg.add_input_port( MapCell3D, "world_map", [ ( File, 'map_file' ), ( Integer, 'map_cut' ) ], optional=True  ) 
    reg.add_input_port( MapCell3D, "map_opacity", [ ( Float, 'value' ) ], optional=True  ) 
    reg.add_input_port( MapCell3D, "title", [ ( String, 'value' ) ], optional=True  ) 
    MapCell3D.registerConfigurableFunctions( reg )

    reg.add_module( CloudCell3D, configureWidgetType=CloudCell3DConfigurationWidget, namespace='spreadsheet' ) 
    reg.add_input_port( CloudCell3D, "pointcloud", AlgorithmOutputModule3D  )   
    reg.add_input_port( CloudCell3D, "cell_location", [ ( String, 'cell_coordinates' ) ], True )
    reg.add_input_port( CloudCell3D, "title", [ ( String, 'value' ) ], optional=True  ) 
    CloudCell3D.registerConfigurableFunctions( reg )
    
    reg.add_module( ChartCell, configureWidgetType=ChartCellConfigurationWidget, namespace='spreadsheet' ) 
    reg.add_input_port( ChartCell, "chart", AlgorithmOutputModule2D  )   
    reg.add_input_port( ChartCell, "cell_location", [ ( String, 'cell_coordinates' ) ], True )
    reg.add_input_port( ChartCell, "opacity", [ ( Float, 'value' ) ], optional=True  ) 
    reg.add_input_port( ChartCell, "title", [ ( String, 'value' ) ], optional=True  ) 
    ChartCell.registerConfigurableFunctions( reg )

#    reg.add_module( WorldFrame )
#    reg.add_input_port( WorldFrame, "world_cut", Integer, optional=True  )
#    reg.add_input_port( WorldFrame, "map_border_size",  [ ( Float, 'border_in_degrees' ) ], optional=True  )
#    reg.add_input_port( WorldFrame, "world_map", [ ( File, 'map_file' ), ( Integer, 'map_cut' ) ], optional=True  ) 
#    reg.add_input_port( WorldFrame, "opacity", [ ( Float, 'value' ) ], optional=True  ) 
#    reg.add_input_port( WorldFrame, "zscale", [ ( Float, 'value' ) ], optional=True  ) 
#    reg.add_input_port( WorldFrame, "volume", AlgorithmOutputModule3D  )
#    reg.add_output_port( WorldFrame, "volume", AlgorithmOutputModule3D ) 
#    WorldFrame.registerConfigurableFunctions( reg )

#    reg.add_module( CDMS_VCDATInterfaceSpecs, configureWidgetType=VCDATInterfaceWidget, namespace='cdms', hide_descriptor=True )
#    reg.add_input_port( CDMS_VCDATInterfaceSpecs, "zscale", [ ( Float, 'value' ) ], optional=True  ) 

#    reg.add_module( CDMS_VCDATInterface, namespace='cdms' )
#    reg.add_input_port( CDMS_VCDATInterface, "vcdatInputSpecs",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "vcdatCellSpecs",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port(  CDMS_VCDATInterface, "FileName",    [ ( String, 'FileName' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "VariableName",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "VariableName1",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "VariableName2",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "VariableName3",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Axes",    [ ( String, 'Axes' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Row",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Column",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Row1",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Column1",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Row2",    [ ( String, 'Value' ) ], True ) 
#    reg.add_input_port( CDMS_VCDATInterface, "Column2",    [ ( String, 'Value' ) ], True ) 
#    reg.add_output_port( CDMS_VCDATInterface, "executionSpecs", [ CDMS_VCDATInterfaceSpecs ] ) 
#    reg.add_output_port( CDMS_VCDATInterface, "cellLocation", [ ( String, 'cellLocation' ) ] ) 
#    reg.add_output_port( CDMS_VCDATInterface, "cellLocation1", [ ( String, 'cellLocation' ) ] ) 
#    reg.add_output_port( CDMS_VCDATInterface, "cellLocation2", [ ( String, 'cellLocation' ) ] ) 

    reg.add_module( CDMSTransientVariable,  namespace='cdms' )
    reg.add_input_port(  CDMSTransientVariable, "inputId", String )      

    reg.add_module( CDMS_FileReader, configureWidgetType=CDMSDatasetConfigurationWidget, namespace='cdms' )
    reg.add_input_port(  CDMS_FileReader, "executionSpecs",    [ ( String, 'serializedConfiguration' ),  ], True ) 
    reg.add_input_port( CDMS_FileReader, "datasets",    [ ( String, 'serializedDatasetMap' ) ], True ) 
    reg.add_input_port( CDMS_FileReader, "datasetId",    [ ( String, 'currentDatasetId' ), ( Integer, 'version' ) ], True ) 
    reg.add_input_port( CDMS_FileReader, "timeRange",    [ ( Integer, 'startTimeIndex' ), ( Integer, 'endTimeIndex' ), ( Float, 'relativeStartTime' ), ( Float, 'relativeTimeStep' )], True )    
    reg.add_input_port( CDMS_FileReader, "roi",    [ ( Float, 'lon0' ), ( Float, 'lat0' ), ( Float, 'lon1' ), ( Float, 'lat1' ) ], True )    
    reg.add_input_port( CDMS_FileReader, "grid", [ ( String, 'selectedGrid' ) ], optional=True  ) 
    reg.add_input_port( CDMS_FileReader, "decimation", [ ( Integer, 'clientDecimation' ),  ( Integer, 'serverDecimation' ) ], optional=True  ) 
    reg.add_input_port( CDMS_FileReader, "zscale", [ ( Float, 'value' ) ], optional=True  ) 
    reg.add_output_port( CDMS_FileReader, "dataset", CDMSDataset ) 
    CDMS_FileReader.registerConfigurableFunctions( reg )

    reg.add_module( CDMSVariableSource, namespace='cdms' )
    reg.add_input_port(  CDMSVariableSource, "inputId", String )      
    reg.add_output_port( CDMSVariableSource, "self", VariableSource )
    reg.add_output_port( CDMSVariableSource, "axes", String )

    reg.add_module( CDMS_HoffmullerReader, configureWidgetType=CDMS_HoffmullerReaderConfigurationWidget, namespace='cdms' )
    reg.add_input_port( CDMS_HoffmullerReader, "dataset", CDMSDataset )      
    reg.add_input_port( CDMS_HoffmullerReader, "variable", Variable )      
    reg.add_input_port( CDMS_HoffmullerReader, "portData",   [ ( String, 'serializedPortData' ), ( Integer, 'version' ) ], True   ) 
    reg.add_output_port( CDMS_HoffmullerReader, "volume", AlgorithmOutputModule3D ) 
    CDMS_HoffmullerReader.registerConfigurableFunctions( reg )

    reg.add_module( CDMS_VolumeReader, configureWidgetType=CDMS_VolumeReaderConfigurationWidget, namespace='cdms' )
    reg.add_input_port( CDMS_VolumeReader, "dataset", CDMSDataset )      
    reg.add_input_port( CDMS_VolumeReader, "variable", Variable )      
    reg.add_input_port( CDMS_VolumeReader, "portData",   [ ( String, 'serializedPortData' ), ( Integer, 'version' ) ], True   ) 
    reg.add_output_port( CDMS_VolumeReader, "volume", AlgorithmOutputModule3D ) 
    CDMS_VolumeReader.registerConfigurableFunctions( reg )

    reg.add_module( CDMS_ChartDataReader, configureWidgetType=CDMS_ChartDataConfigurationWidget, namespace='cdms' )
    reg.add_input_port( CDMS_ChartDataReader, "dataset", CDMSDataset )      
    reg.add_input_port( CDMS_ChartDataReader, "portData",   [ ( String, 'serializedPortData' ), ( Integer, 'version' ) ], True   ) 
    reg.add_output_port( CDMS_ChartDataReader, "volume", AlgorithmOutputModule3D ) 
    CDMS_ChartDataReader.registerConfigurableFunctions( reg )

    reg.add_module( CDMS_SliceReader, configureWidgetType=CDMS_SliceReaderConfigurationWidget, namespace='cdms' )
    reg.add_input_port( CDMS_SliceReader, "dataset", CDMSDataset )        
    reg.add_input_port( CDMS_SliceReader, "portData",   [ ( String, 'serializedPortData' ), ( Integer, 'version' ) ], True   ) 
    reg.add_output_port( CDMS_SliceReader, "slice", AlgorithmOutputModule ) 
    CDMS_SliceReader.registerConfigurableFunctions( reg )

    reg.add_module( CDMS_VectorReader, configureWidgetType=CDMS_VectorReaderConfigurationWidget, namespace='cdms' )
    reg.add_input_port( CDMS_VectorReader, "dataset", CDMSDataset )        
    reg.add_input_port( CDMS_VectorReader, "variable", Variable )          
    reg.add_input_port( CDMS_VectorReader, "variable2", Variable )      
    reg.add_input_port( CDMS_VectorReader, "variable3", Variable )      
    reg.add_input_port( CDMS_VectorReader, "variable4", Variable )      
    reg.add_input_port( CDMS_VectorReader, "portData",   [ ( String, 'serializedPortData' ), ( Integer, 'version' ) ], True   ) 
    reg.add_output_port( CDMS_VectorReader, "volume", AlgorithmOutputModule3D ) 
    CDMS_SliceReader.registerConfigurableFunctions( reg )

    reg.add_module( CDMS_CDATUtilities, configureWidgetType=CDATUtilitiesModuleConfigurationWidget, namespace='cdms' )
    reg.add_input_port( CDMS_CDATUtilities, "dataset", CDMSDataset )   
    reg.add_input_port( CDMS_CDATUtilities, "task",  [ ( String, 'taskData' ) ], True   ) # [ ( String, 'taskName' ), ( String, 'inputVars' ), ( String, 'outputVars' ) ], True   ) 
    reg.add_output_port( CDMS_CDATUtilities, "dataset", CDMSDataset ) 

    reg.add_module( VolumeSlicer, namespace='vtk' )
    reg.add_output_port( VolumeSlicer, "slice",  AlgorithmOutputModule  )
    reg.add_input_port( VolumeSlicer, "contours", AlgorithmOutputModule3D  )
    reg.add_input_port( VolumeSlicer, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( VolumeSlicer, "volume", AlgorithmOutputModule3D ) 
    VolumeSlicer.registerConfigurableFunctions( reg )

    reg.add_module( Gradient, namespace='vtk|experimental'  ) 
    reg.add_input_port( Gradient, "computeVorticity", Integer  )   
    reg.add_input_port( Gradient, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( Gradient, "volume", AlgorithmOutputModule3D ) 
    
    reg.add_module( GlyphArrayCutPlane, namespace='vtk'  )
    reg.add_input_port( GlyphArrayCutPlane, "colors", AlgorithmOutputModule3D  )
    reg.add_output_port( GlyphArrayCutPlane, "slice", AlgorithmOutputModule ) 
    reg.add_input_port( GlyphArrayCutPlane, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( GlyphArrayCutPlane, "volume", AlgorithmOutputModule3D ) 
    GlyphArrayCutPlane.registerConfigurableFunctions(  reg )

    reg.add_module( StreamlineCutPlane, namespace='vtk'  )
    reg.add_input_port( StreamlineCutPlane, "colors", AlgorithmOutputModule3D  )
    reg.add_input_port( StreamlineCutPlane, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( StreamlineCutPlane, "volume", AlgorithmOutputModule3D ) 
    StreamlineCutPlane.registerConfigurableFunctions(  reg )

    reg.add_module( VectorVolume, namespace='vtk'  )
    reg.add_input_port( VectorVolume, "colors", AlgorithmOutputModule3D  )
    reg.add_input_port( VectorVolume, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( VectorVolume, "volume", AlgorithmOutputModule3D ) 
    VectorVolume.registerConfigurableFunctions(  reg )
    
    reg.add_module( Voxelizer, namespace='vtk'  )
    reg.add_input_port( Voxelizer, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( Voxelizer, "pointcloud", AlgorithmOutputModule3D ) 
    Voxelizer.registerConfigurableFunctions(  reg )

#    reg.add_module( Resample )
#    reg.add_input_port( Resample, "position", [ ( Float, 'x' ), ( Float, 'y' ), ( Float, 'z' ) ], True   )    
#    reg.add_output_port( Resample, "position",  [ ( Float, 'x' ), ( Float, 'y' ), ( Float, 'z' ) ], True  )
#    reg.add_input_port( Resample, "volume", AlgorithmOutputModule3D  )
#    reg.add_output_port( Resample, "volume", AlgorithmOutputModule3D ) 
#    Resample.registerConfigurableFunctions( reg )

    reg.add_module( CurtainPlot, namespace='vtk'  )
    reg.add_input_port( CurtainPlot, "volume", AlgorithmOutputModule3D  )
    reg.add_input_port( CurtainPlot, "path", ( File, 'path_file' )  ) 
    reg.add_output_port( CurtainPlot, "volume", AlgorithmOutputModule3D ) 
    CurtainPlot.registerConfigurableFunctions( reg )
       
#    reg.add_module( DemoData, configureWidgetType=DemoDataConfigurationWidget )
#    reg.add_input_port( DemoData, "dataset",    [ ( String, 'name' ), ] ) 
#    reg.add_input_port( DemoData, "maxNTimeSteps",   [ ( Integer, 'nts' ) ]   ) 
#    reg.add_output_port( DemoData, "volume", AlgorithmOutputModule3D ) 
#    DemoData.registerConfigurableFunctions( reg )
       
    reg.add_module( VolumeRenderer, namespace='vtk'  ) # , configureWidgetType=LayerConfigurationWidget  )
    reg.add_input_port( VolumeRenderer, "volume", AlgorithmOutputModule3D  )
#    reg.add_input_port( VolumeRenderer, "layer",   [ ( String, 'layer' ), ]   ) 
    reg.add_output_port( VolumeRenderer, "volume", AlgorithmOutputModule3D ) 
    VolumeRenderer.registerConfigurableFunctions( reg )

    reg.add_module( ParallelCoordinateViewer, namespace='vtk'  ) # , configureWidgetType=LayerConfigurationWidget  )
    reg.add_input_port( ParallelCoordinateViewer, "volume", AlgorithmOutputModule3D  )
    reg.add_input_port(  ParallelCoordinateViewer, "slice", AlgorithmOutputModule  )
#    reg.add_input_port( VolumeRenderer, "layer",   [ ( String, 'layer' ), ]   ) 
    reg.add_output_port( ParallelCoordinateViewer, "chart", AlgorithmOutputModule2D ) 
    ParallelCoordinateViewer.registerConfigurableFunctions( reg )

    reg.add_module( LevelSurface, namespace='vtk'   )
    reg.add_input_port( LevelSurface, "texture", AlgorithmOutputModule3D  )
    reg.add_input_port( LevelSurface, "volume", AlgorithmOutputModule3D  )
    reg.add_output_port( LevelSurface, "volume", AlgorithmOutputModule3D ) 
#    reg.add_input_port( LevelSurface, "layer",   [ ( String, 'activeLayerName' ) ]   ) 
    LevelSurface.registerConfigurableFunctions( reg )

    from core.packagemanager import get_package_manager
    if get_package_manager().has_package('edu.utah.sci.vistrails.matplotlib'):
        mpl_dict = {'linux-ubuntu': 'python-matplotlib', 'linux-fedora': 'python-matplotlib'}
        matplotlib = py_import('matplotlib', mpl_dict)
        pylab = py_import('pylab', mpl_dict)
        from SlicePlotModule import SlicePlotCell, SlicePlotConfigurationWidget

        reg.add_module( SlicePlotCell, namespace='spreadsheet', configureWidgetType=SlicePlotConfigurationWidget  )
        reg.add_input_port(  SlicePlotCell, "Location", CellLocation)
        reg.add_input_port(  SlicePlotCell, "slice", AlgorithmOutputModule  )
        reg.add_input_port(  SlicePlotCell, "plotType", [ ( String, 'fillType' ), ( String, 'contourType' ), ( Integer, 'numContours' ), ( Integer, 'version' ) ], True   )
        reg.add_output_port( SlicePlotCell, 'File', File)
        SlicePlotCell.registerConfigurableFunctions( reg )
    else:
        print "Matplotlib dependent features will be disabled."
예제 #5
0
파일: init.py 프로젝트: painter1/vistrails
from matrix import Matrix
from config_reader import ConfigReader, WriteVarsIntoDataFile, ReadData
from core.modules.module_registry import get_module_registry
from plots import Coordinator, Dendrogram, ParallelCoordinates, TaylorDiagram, SeriesPlot
from core import debug
from core.bundles import py_import
try:
    mpl_dict = {
        'linux-ubuntu': 'python-matplotlib',
        'linux-fedora': 'python-matplotlib'
    }
    matplotlib = py_import('matplotlib', mpl_dict)
    matplotlib.use('Qt4Agg', warn=False)
    pylab = py_import('pylab', mpl_dict)
except Exception, e:
    debug.critical("Exception: %s" % e)

################################################################################
_modules = [(Matrix, {
    'namespace': Matrix.my_namespace,
    'name': Matrix.name
}),
            (ConfigReader, {
                'namespace': ConfigReader.my_namespace,
                'name': ConfigReader.name
            }),
            (WriteVarsIntoDataFile, {
                'namespace': WriteVarsIntoDataFile.my_namespace,
                'name': WriteVarsIntoDataFile.name
            }),
            (ReadData, {
예제 #6
0
##
############################################################################
"""This module provides a means to visualise a Python list-of-lists, in a
Vistrails spreadsheet cell, as an HMTL table.
"""
# library
import os.path
import sys
from datetime import date, datetime, time
# third-party
from core.bundles import py_import
from core import debug
try:
    pkg_dict = {'linux-ubuntu': 'python-xlrd',
                'linux-fedora': 'python-xlrd'}
    xlrd = py_import('xlrd', pkg_dict)
except Exception, e:
    debug.critical("Exception: %s" % e)
#import xlrd
from PyQt4 import QtCore, QtGui
# vistrails
from core.modules.vistrails_module import Module, ModuleError
from packages.spreadsheet.basic_widgets import SpreadsheetCell
from packages.spreadsheet.spreadsheet_cell import QCellWidget
import shutil

ENCODING = "utf-8"  # will differ in some countries; add as hidden port ???

##############################################################################

import core.modules.module_registry
import core.modules.basic_modules
import traceback
from core.packagemanager import get_package_manager
from core.modules import vistrails_module
from core.modules.package import Package
from core.modules.vistrails_module import Module, ModuleError, new_module
from core.upgradeworkflow import UpgradeWorkflowHandler
from core import debug
from core import configuration

from core.bundles import py_import
try:
    mpl_dict = {'linux-ubuntu': 'python-suds',
                'linux-fedora': 'python-suds'}
    suds = py_import('suds', mpl_dict)
except Exception, e:
    debug.critical("Exception: %s" % e)


package_cache = None

webServicesDict = {}

def toSignature(s):
    """ transform wsdl address to valid package signature """
    # cannot have ':' in package name
    return 'SUDS#' + s.replace(':', '$')

def toAddress(s):
    """ transform package signature to valid wsdl address """
예제 #8
0
파일: init.py 프로젝트: painter1/vistrails
import hashlib
import core.system
import core.modules.module_registry
import core.modules.basic_modules
import traceback
from core.packagemanager import get_package_manager
from core.modules import vistrails_module
from core.modules.package import Package
from core.modules.vistrails_module import Module, ModuleError, new_module
from core.upgradeworkflow import UpgradeWorkflowHandler
from core import debug

from core.bundles import py_import
try:
    mpl_dict = {'linux-ubuntu': 'python-suds', 'linux-fedora': 'python-suds'}
    suds = py_import('suds', mpl_dict)
except Exception, e:
    debug.critical("Exception: %s" % e)

package_cache = None

webServicesDict = {}


def toSignature(s):
    """ transform wsdl address to valid package signature """
    # cannot have ':' in package name
    return 'SUDS#' + s.replace(':', '$')


def toAddress(s):
예제 #9
0
from core.bundles import py_import

vtk = py_import('vtk', {
    'linux-ubuntu': 'python-vtk',
    'linux-fedora': 'vtk-python'
})

from core.utils import all, any, VistrailsInternalError, InstanceObject
from core.debug import debug
from core.modules.basic_modules import Integer, Float, String, File, \
     Variant, Color, Boolean, identifier as basic_pkg
from core.modules.module_registry import get_module_registry
from core.modules.vistrails_module import new_module, ModuleError


def initialize():
    registry = get_module_registry()

    if registry.has_module('edu.utah.sci.vistrails.spreadsheet',
                           'SpreadsheetCell'):

        import pvrepresentationbase, pvcontourrepresentation, pvslicerepresentation
        pvrepresentationbase.register_self()
        pvcontourrepresentation.register_self()
        pvslicerepresentation.register_self()

        import pvgenericcell
        pvgenericcell.register_self()
    else:
        print 'Not it does has cell'
예제 #10
0
파일: init.py 프로젝트: ict4eo/eo4vistrails
## instance, you are interested in developing a commercial derivative
## of VisTrails), please contact us at [email protected].
##
## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
############################################################################
"""This package provides Excel capabilities.
"""

from core.bundles import py_import
from core import debug
try:
    pkg_dict = {'linux-ubuntu': 'python-xlrd',
                'linux-fedora': 'python-xlrd'}
    xlrd = py_import('xlrd', pkg_dict)  # also tried 'python-xlrd'
except Exception, e:
    debug.critical("Exception: %s" % e)


def missing(package_name, module_name):
    print "WARNING: %s package not installed; %s Module disabled" % \
        (package_name, module_name)


def warning(package_name, module_name):
    print "WARNING: %s package not installed; %s Module has reduced \
    functionality" % \
        (package_name, module_name)

예제 #11
0
version = '0.2'
identifier = 'edu.utah.sci.vistrails.itk'
name = 'ITK'

import core.bundles.utils
import core.requirements
from core.modules.vistrails_module import Module, ModuleError

# Ugly, but Carlos doesnt know any better
if core.bundles.utils.guess_system() == 'linux-ubuntu':
    import sys
    sys.path.append('/usr/local/lib/VisTrailsITK')

try:
    from core.bundles import py_import
    itk = py_import('itk', {'linux-ubuntu': 'vistrails-itk'})
except ImportError:
    raise core.requirements.MissingRequirement("ITK and WrapITK")

import core.modules
import core.modules.module_registry

# ITK Package imports
from PixelType import *
from FeatureExtractionFilters import *
from ITK import *
from Image import Image
from IntensityFilters import *
from SegmentationFilters import *
from SelectionFilters import *
from SmoothingFilters import *
예제 #12
0
파일: init.py 프로젝트: imclab/vistrails
from core.bundles import py_import

vtk = py_import('vtk', {'linux-ubuntu': 'python-vtk',
                        'linux-fedora': 'vtk-python'})

from core.utils import all, any, VistrailsInternalError, InstanceObject
from core.debug import debug
from core.modules.basic_modules import Integer, Float, String, File, \
     Variant, Color, Boolean, identifier as basic_pkg
from core.modules.module_registry import get_module_registry
from core.modules.vistrails_module import new_module, ModuleError

def initialize():
    registry = get_module_registry()

    if registry.has_module('edu.utah.sci.vistrails.spreadsheet',
                           'SpreadsheetCell'):

        import pvrepresentationbase, pvcontourrepresentation, pvslicerepresentation
        pvrepresentationbase.register_self()
        pvcontourrepresentation.register_self()
        pvslicerepresentation.register_self()

        import pvgenericcell
        pvgenericcell.register_self()
    else:
        print 'Not it does has cell'

예제 #13
0
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
##
###############################################################################

from core.bundles import py_import

MySQLdb = py_import('MySQLdb', {'linux-ubuntu':'python-mysqldb',
                                'linux-fedora':'MySQL-python'})

psycopg2 = py_import('psycopg2', {'linux-ubuntu':'python-psycopg2',
                                  'linux-fedora':'python-psycopg2'})
from PyQt4 import QtCore, QtGui
import urllib

from core import debug
from core.modules.vistrails_module import Module, ModuleError, NotCacheable
from gui.modules.source_configure import SourceConfigurationWidget
from core.upgradeworkflow import UpgradeWorkflowHandler
from core.utils import PortAlreadyExists
from gui.theme import CurrentTheme

class QPasswordEntry(QtGui.QDialog):
    def __init__(self, parent=None):
예제 #14
0
version = '0.2'
identifier = 'edu.utah.sci.vistrails.itk'
name = 'ITK'

import core.bundles.utils
import core.requirements
from core.modules.vistrails_module import Module, ModuleError

# Ugly, but Carlos doesnt know any better
if core.bundles.utils.guess_system() == 'linux-ubuntu':
    import sys
    sys.path.append('/usr/local/lib/VisTrailsITK')

try:
    from core.bundles import py_import
    itk = py_import('itk', {'linux-ubuntu': 'vistrails-itk'})
except ImportError:
    raise core.requirements.MissingRequirement("ITK and WrapITK")

import core.modules
import core.modules.module_registry

# ITK Package imports
from PixelType import *
from FeatureExtractionFilters import *
from ITK import *
from Image import Image
from IntensityFilters import *
from SegmentationFilters import *
from SelectionFilters import *
from SmoothingFilters import *
예제 #15
0
def initialize(*args, **keywords):
    import core.modules.module_registry
    from packages.vtDV3D.CDMS_VariableReaders import CDMSVariableSource, CDMS_PointReader, CDMSTransientVariable, CDMS_HoffmullerReader, CDMS_VolumeReader, CDMS_ChartDataReader, CDMS_SliceReader, CDMS_VectorReader, CDMS_HoffmullerReaderConfigurationWidget, CDMS_PointReaderConfigurationWidget, CDMS_VolumeReaderConfigurationWidget, CDMS_ChartDataConfigurationWidget, CDMS_SliceReaderConfigurationWidget, CDMS_VectorReaderConfigurationWidget
    from packages.vtDV3D.VolumeSlicerModule import VolumeSlicer
    from packages.vtDV3D.MultiVolumeSlicerModule import MultiVolumeSlicer
    from packages.vtDV3D.VolumeRenderModule import VolumeRenderer
    from packages.vtDV3D.ParallelCoordinatesModule import ParallelCoordinateViewer
    from packages.vtDV3D.WorldMapModule import WorldFrame
    from packages.vtDV3D.VoxelizerModule import Voxelizer
    from packages.uvcdat.init import Variable, VariableSource
    #    from DemoDataModule import DemoData, DemoDataConfigurationWidget
    #    from packages.vtDV3D.InteractiveConfiguration import LayerConfigurationWidget
    from packages.vtDV3D.LevelSurfaceModule import LevelSurface
    from packages.vtDV3D.CurtainPlotModule import CurtainPlot
    from packages.uvcdat_cdms.init import CDMSVariable
    from packages.vtDV3D.ResampleModule import Resample
    from packages.vtDV3D.CDATUtilitiesModule import CDMS_CDATUtilities, CDATUtilitiesModuleConfigurationWidget
    from packages.vtDV3D.GradientModule import Gradient
    from packages.vtDV3D.WorkflowModule import WorkflowModule
    from packages.vtDV3D.VectorCutPlaneModule import GlyphArrayCutPlane, StreamlineCutPlane
    from packages.vtDV3D.VectorVolumeModule import VectorVolume
    #    from packages.vtDV3D.CPCViewer import CPCViewer, CPCViewerConfigurationWidget
    from packages.spreadsheet.basic_widgets import CellLocation
    from core.modules.basic_modules import Integer, Float, String, Boolean, Variant, Color
    #    from packages.CPCViewer.PointCloudViewer import CPCPlot, kill_all_zombies
    from core import command_line
    import api
    get = command_line.CommandLineParser().get_option
    if get('kill_all_zombies') != None: kill_all_zombies()

    reg = core.modules.module_registry.get_module_registry()
    vtkAlgorithmOutputType = typeMap('vtkAlgorithmOutput')
    vtkImageDataType = typeMap('vtkImageData')
    reg.add_module(AlgorithmOutputModule,
                   abstract=True)  # hide_descriptor=True )
    reg.add_module(AlgorithmOutputModule3D,
                   abstract=True)  # hide_descriptor=True )
    reg.add_module(AlgorithmOutputModule2D,
                   abstract=True)  # hide_descriptor=True )
    reg.add_module(WorkflowModule, abstract=True)  # hide_descriptor=True )
    reg.add_module(CDMSDataset, abstract=True)  # hide_descriptor=True )

    reg.add_module(MapCell3D,
                   configureWidgetType=MapCell3DConfigurationWidget,
                   namespace='spreadsheet')
    reg.add_input_port(MapCell3D, "volume", AlgorithmOutputModule3D)
    reg.add_input_port(MapCell3D, "cell_location",
                       [(String, 'cell_coordinates')], True)
    reg.add_input_port(MapCell3D, "world_cut", Integer, optional=True)
    reg.add_input_port(MapCell3D,
                       "map_border_size", [(Float, 'border_in_degrees')],
                       optional=True)
    reg.add_input_port(MapCell3D,
                       "enable_basemap", [(Boolean, 'enable')],
                       optional=True)
    reg.add_input_port(MapCell3D,
                       "world_map", [(File, 'map_file'), (Integer, 'map_cut')],
                       optional=True)
    reg.add_input_port(MapCell3D,
                       "map_opacity", [(Float, 'value')],
                       optional=True)
    reg.add_input_port(MapCell3D, "title", [(String, 'value')], optional=True)
    MapCell3D.registerConfigurableFunctions(reg)

    reg.add_module(CloudCell3D,
                   configureWidgetType=CloudCell3DConfigurationWidget,
                   namespace='spreadsheet')
    reg.add_input_port(CloudCell3D, "pointcloud", AlgorithmOutputModule3D)
    reg.add_input_port(CloudCell3D, "cell_location",
                       [(String, 'cell_coordinates')], True)
    reg.add_input_port(CloudCell3D,
                       "title", [(String, 'value')],
                       optional=True)
    CloudCell3D.registerConfigurableFunctions(reg)

    reg.add_module(ChartCell,
                   configureWidgetType=ChartCellConfigurationWidget,
                   namespace='spreadsheet')
    reg.add_input_port(ChartCell, "chart", AlgorithmOutputModule2D)
    reg.add_input_port(ChartCell, "cell_location",
                       [(String, 'cell_coordinates')], True)
    reg.add_input_port(ChartCell, "opacity", [(Float, 'value')], optional=True)
    reg.add_input_port(ChartCell, "title", [(String, 'value')], optional=True)
    ChartCell.registerConfigurableFunctions(reg)

    #    reg.add_module( WorldFrame )
    #    reg.add_input_port( WorldFrame, "world_cut", Integer, optional=True  )
    #    reg.add_input_port( WorldFrame, "map_border_size",  [ ( Float, 'border_in_degrees' ) ], optional=True  )
    #    reg.add_input_port( WorldFrame, "world_map", [ ( File, 'map_file' ), ( Integer, 'map_cut' ) ], optional=True  )
    #    reg.add_input_port( WorldFrame, "opacity", [ ( Float, 'value' ) ], optional=True  )
    #    reg.add_input_port( WorldFrame, "zscale", [ ( Float, 'value' ) ], optional=True  )
    #    reg.add_input_port( WorldFrame, "volume", AlgorithmOutputModule3D  )
    #    reg.add_output_port( WorldFrame, "volume", AlgorithmOutputModule3D )
    #    WorldFrame.registerConfigurableFunctions( reg )

    #    reg.add_module( CDMS_VCDATInterfaceSpecs, configureWidgetType=VCDATInterfaceWidget, namespace='cdms', hide_descriptor=True )
    #    reg.add_input_port( CDMS_VCDATInterfaceSpecs, "zscale", [ ( Float, 'value' ) ], optional=True  )

    #    reg.add_module( CDMS_VCDATInterface, namespace='cdms' )
    #    reg.add_input_port( CDMS_VCDATInterface, "vcdatInputSpecs",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "vcdatCellSpecs",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port(  CDMS_VCDATInterface, "FileName",    [ ( String, 'FileName' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "VariableName",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "VariableName1",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "VariableName2",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "VariableName3",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Axes",    [ ( String, 'Axes' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Row",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Column",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Row1",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Column1",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Row2",    [ ( String, 'Value' ) ], True )
    #    reg.add_input_port( CDMS_VCDATInterface, "Column2",    [ ( String, 'Value' ) ], True )
    #    reg.add_output_port( CDMS_VCDATInterface, "executionSpecs", [ CDMS_VCDATInterfaceSpecs ] )
    #    reg.add_output_port( CDMS_VCDATInterface, "cellLocation", [ ( String, 'cellLocation' ) ] )
    #    reg.add_output_port( CDMS_VCDATInterface, "cellLocation1", [ ( String, 'cellLocation' ) ] )
    #    reg.add_output_port( CDMS_VCDATInterface, "cellLocation2", [ ( String, 'cellLocation' ) ] )

    reg.add_module(CDMSTransientVariable, namespace='cdms')
    reg.add_input_port(CDMSTransientVariable, "inputId", String)

    reg.add_module(CDMS_FileReader,
                   configureWidgetType=CDMSDatasetConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_FileReader, "executionSpecs", [
        (String, 'serializedConfiguration'),
    ], True)
    reg.add_input_port(CDMS_FileReader, "datasets",
                       [(String, 'serializedDatasetMap')], True)
    reg.add_input_port(CDMS_FileReader,
                       "datasetId", [(String, 'currentDatasetId'),
                                     (Integer, 'version')], True)
    reg.add_input_port(CDMS_FileReader, "timeRange",
                       [(Integer, 'startTimeIndex'), (Integer, 'endTimeIndex'),
                        (Float, 'relativeStartTime'),
                        (Float, 'relativeTimeStep')], True)
    reg.add_input_port(CDMS_FileReader, "roi",
                       [(Float, 'lon0'), (Float, 'lat0'), (Float, 'lon1'),
                        (Float, 'lat1')], True)
    reg.add_input_port(CDMS_FileReader,
                       "grid", [(String, 'selectedGrid')],
                       optional=True)
    reg.add_input_port(CDMS_FileReader,
                       "decimation", [(Integer, 'clientDecimation'),
                                      (Integer, 'serverDecimation')],
                       optional=True)
    reg.add_input_port(CDMS_FileReader,
                       "zscale", [(Float, 'value')],
                       optional=True)
    reg.add_output_port(CDMS_FileReader, "dataset", CDMSDataset)
    CDMS_FileReader.registerConfigurableFunctions(reg)

    reg.add_module(CDMSVariableSource, namespace='cdms')
    reg.add_input_port(CDMSVariableSource, "inputId", String)
    reg.add_output_port(CDMSVariableSource, "self", VariableSource)
    reg.add_output_port(CDMSVariableSource, "axes", String)

    reg.add_module(
        CDMS_HoffmullerReader,
        configureWidgetType=CDMS_HoffmullerReaderConfigurationWidget,
        namespace='cdms')
    reg.add_input_port(CDMS_HoffmullerReader, "dataset", CDMSDataset)
    reg.add_input_port(CDMS_HoffmullerReader, "variable", Variable)
    reg.add_input_port(CDMS_HoffmullerReader,
                       "portData", [(String, 'serializedPortData'),
                                    (Integer, 'version')], True)
    reg.add_output_port(CDMS_HoffmullerReader, "volume",
                        AlgorithmOutputModule3D)
    CDMS_HoffmullerReader.registerConfigurableFunctions(reg)

    # reg.add_module( CPCViewer, configureWidgetType=CPCViewerConfigurationWidget, namespace='vtk' )
    # reg.add_input_port( CPCViewer, "pointCloud", AlgorithmOutputModule3D )
    # reg.add_input_port( CPCViewer, "cpcConfigData",   [ ( String, 'serializedConfigData' ), ( Integer, 'version' ) ], True   )
    # reg.add_output_port( CPCViewer, "pointCloud", AlgorithmOutputModule3D )
    # CPCViewer.registerConfigurableFunctions( reg )

    reg.add_module(CDMS_VolumeReader,
                   configureWidgetType=CDMS_VolumeReaderConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_VolumeReader, "dataset", CDMSDataset)
    reg.add_input_port(CDMS_VolumeReader, "variable", Variable)
    reg.add_input_port(CDMS_VolumeReader,
                       "portData", [(String, 'serializedPortData'),
                                    (Integer, 'version')], True)
    reg.add_output_port(CDMS_VolumeReader, "volume", AlgorithmOutputModule3D)
    CDMS_VolumeReader.registerConfigurableFunctions(reg)

    reg.add_module(CDMS_PointReader,
                   configureWidgetType=CDMS_PointReaderConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_PointReader, "variable", Variable)
    reg.add_input_port(CDMS_PointReader,
                       "portData", [(String, 'serializedPortData'),
                                    (Integer, 'version')], True)
    reg.add_output_port(CDMS_PointReader, "pointCloud",
                        AlgorithmOutputModule3D)
    CDMS_PointReader.registerConfigurableFunctions(reg)

    reg.add_module(CDMS_ChartDataReader,
                   configureWidgetType=CDMS_ChartDataConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_ChartDataReader, "dataset", CDMSDataset)
    reg.add_input_port(CDMS_ChartDataReader,
                       "portData", [(String, 'serializedPortData'),
                                    (Integer, 'version')], True)
    reg.add_output_port(CDMS_ChartDataReader, "volume",
                        AlgorithmOutputModule3D)
    CDMS_ChartDataReader.registerConfigurableFunctions(reg)

    reg.add_module(CDMS_SliceReader,
                   configureWidgetType=CDMS_SliceReaderConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_SliceReader, "dataset", CDMSDataset)
    reg.add_input_port(CDMS_SliceReader,
                       "portData", [(String, 'serializedPortData'),
                                    (Integer, 'version')], True)
    reg.add_output_port(CDMS_SliceReader, "slice", AlgorithmOutputModule)
    CDMS_SliceReader.registerConfigurableFunctions(reg)

    reg.add_module(CDMS_VectorReader,
                   configureWidgetType=CDMS_VectorReaderConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_VectorReader, "dataset", CDMSDataset)
    reg.add_input_port(CDMS_VectorReader, "variable", Variable)
    reg.add_input_port(CDMS_VectorReader, "variable2", Variable)
    reg.add_input_port(CDMS_VectorReader, "variable3", Variable)
    reg.add_input_port(CDMS_VectorReader, "variable4", Variable)
    reg.add_input_port(CDMS_VectorReader,
                       "portData", [(String, 'serializedPortData'),
                                    (Integer, 'version')], True)
    reg.add_output_port(CDMS_VectorReader, "volume", AlgorithmOutputModule3D)
    CDMS_SliceReader.registerConfigurableFunctions(reg)

    reg.add_module(CDMS_CDATUtilities,
                   configureWidgetType=CDATUtilitiesModuleConfigurationWidget,
                   namespace='cdms')
    reg.add_input_port(CDMS_CDATUtilities, "dataset", CDMSDataset)
    reg.add_input_port(
        CDMS_CDATUtilities, "task", [(String, 'taskData')], True
    )  # [ ( String, 'taskName' ), ( String, 'inputVars' ), ( String, 'outputVars' ) ], True   )
    reg.add_output_port(CDMS_CDATUtilities, "dataset", CDMSDataset)

    reg.add_module(VolumeSlicer, namespace='vtk')
    reg.add_output_port(VolumeSlicer, "slice", AlgorithmOutputModule)
    reg.add_input_port(VolumeSlicer, "contours", AlgorithmOutputModule3D)
    reg.add_input_port(VolumeSlicer, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(VolumeSlicer, "volume", AlgorithmOutputModule3D)
    VolumeSlicer.registerConfigurableFunctions(reg)

    reg.add_module(MultiVolumeSlicer, namespace='vtk')
    reg.add_output_port(MultiVolumeSlicer, "slice", AlgorithmOutputModule)
    reg.add_input_port(MultiVolumeSlicer, "contours", AlgorithmOutputModule3D)
    reg.add_input_port(MultiVolumeSlicer, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(MultiVolumeSlicer, "volume", AlgorithmOutputModule3D)
    MultiVolumeSlicer.registerConfigurableFunctions(reg)

    reg.add_module(Gradient, namespace='vtk|experimental')
    reg.add_input_port(Gradient, "computeVorticity", Integer)
    reg.add_input_port(Gradient, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(Gradient, "volume", AlgorithmOutputModule3D)

    reg.add_module(GlyphArrayCutPlane, namespace='vtk')
    reg.add_input_port(GlyphArrayCutPlane, "colors", AlgorithmOutputModule3D)
    reg.add_output_port(GlyphArrayCutPlane, "slice", AlgorithmOutputModule)
    reg.add_input_port(GlyphArrayCutPlane, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(GlyphArrayCutPlane, "volume", AlgorithmOutputModule3D)
    GlyphArrayCutPlane.registerConfigurableFunctions(reg)

    reg.add_module(StreamlineCutPlane, namespace='vtk')
    reg.add_input_port(StreamlineCutPlane, "colors", AlgorithmOutputModule3D)
    reg.add_input_port(StreamlineCutPlane, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(StreamlineCutPlane, "volume", AlgorithmOutputModule3D)
    StreamlineCutPlane.registerConfigurableFunctions(reg)

    reg.add_module(VectorVolume, namespace='vtk')
    reg.add_input_port(VectorVolume, "colors", AlgorithmOutputModule3D)
    reg.add_input_port(VectorVolume, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(VectorVolume, "volume", AlgorithmOutputModule3D)
    VectorVolume.registerConfigurableFunctions(reg)

    reg.add_module(Voxelizer, namespace='vtk')
    reg.add_input_port(Voxelizer, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(Voxelizer, "pointcloud", AlgorithmOutputModule3D)
    Voxelizer.registerConfigurableFunctions(reg)

    #    reg.add_module( Resample )
    #    reg.add_input_port( Resample, "position", [ ( Float, 'x' ), ( Float, 'y' ), ( Float, 'z' ) ], True   )
    #    reg.add_output_port( Resample, "position",  [ ( Float, 'x' ), ( Float, 'y' ), ( Float, 'z' ) ], True  )
    #    reg.add_input_port( Resample, "volume", AlgorithmOutputModule3D  )
    #    reg.add_output_port( Resample, "volume", AlgorithmOutputModule3D )
    #    Resample.registerConfigurableFunctions( reg )

    reg.add_module(CurtainPlot, namespace='vtk')
    reg.add_input_port(CurtainPlot, "volume", AlgorithmOutputModule3D)
    reg.add_input_port(CurtainPlot, "path", (File, 'path_file'))
    reg.add_output_port(CurtainPlot, "volume", AlgorithmOutputModule3D)
    CurtainPlot.registerConfigurableFunctions(reg)

    #    reg.add_module( DemoData, configureWidgetType=DemoDataConfigurationWidget )
    #    reg.add_input_port( DemoData, "dataset",    [ ( String, 'name' ), ] )
    #    reg.add_input_port( DemoData, "maxNTimeSteps",   [ ( Integer, 'nts' ) ]   )
    #    reg.add_output_port( DemoData, "volume", AlgorithmOutputModule3D )
    #    DemoData.registerConfigurableFunctions( reg )

    reg.add_module(
        VolumeRenderer,
        namespace='vtk')  # , configureWidgetType=LayerConfigurationWidget  )
    reg.add_input_port(VolumeRenderer, "volume", AlgorithmOutputModule3D)
    #    reg.add_input_port( VolumeRenderer, "layer",   [ ( String, 'layer' ), ]   )
    reg.add_output_port(VolumeRenderer, "volume", AlgorithmOutputModule3D)
    VolumeRenderer.registerConfigurableFunctions(reg)

    reg.add_module(
        ParallelCoordinateViewer,
        namespace='vtk')  # , configureWidgetType=LayerConfigurationWidget  )
    reg.add_input_port(ParallelCoordinateViewer, "volume",
                       AlgorithmOutputModule3D)
    reg.add_input_port(ParallelCoordinateViewer, "slice",
                       AlgorithmOutputModule)
    #    reg.add_input_port( VolumeRenderer, "layer",   [ ( String, 'layer' ), ]   )
    reg.add_output_port(ParallelCoordinateViewer, "chart",
                        AlgorithmOutputModule2D)
    ParallelCoordinateViewer.registerConfigurableFunctions(reg)

    reg.add_module(LevelSurface, namespace='vtk')
    reg.add_input_port(LevelSurface, "texture", AlgorithmOutputModule3D)
    reg.add_input_port(LevelSurface, "volume", AlgorithmOutputModule3D)
    reg.add_output_port(LevelSurface, "volume", AlgorithmOutputModule3D)
    #    reg.add_input_port( LevelSurface, "layer",   [ ( String, 'activeLayerName' ) ]   )
    LevelSurface.registerConfigurableFunctions(reg)

    from core.packagemanager import get_package_manager
    if get_package_manager().has_package('edu.utah.sci.vistrails.matplotlib'):
        mpl_dict = {
            'linux-ubuntu': 'python-matplotlib',
            'linux-fedora': 'python-matplotlib'
        }
        matplotlib = py_import('matplotlib', mpl_dict)
        pylab = py_import('pylab', mpl_dict)
        from SlicePlotModule import SlicePlotCell, SlicePlotConfigurationWidget

        reg.add_module(SlicePlotCell,
                       namespace='spreadsheet',
                       configureWidgetType=SlicePlotConfigurationWidget)
        reg.add_input_port(SlicePlotCell, "Location", CellLocation)
        reg.add_input_port(SlicePlotCell, "slice", AlgorithmOutputModule)
        reg.add_input_port(SlicePlotCell,
                           "plotType", [(String, 'fillType'),
                                        (String, 'contourType'),
                                        (Integer, 'numContours'),
                                        (Integer, 'version')], True)
        reg.add_output_port(SlicePlotCell, 'File', File)
        SlicePlotCell.registerConfigurableFunctions(reg)
    else:
        print "Matplotlib dependent features will be disabled."
예제 #16
0
파일: views.py 프로젝트: painter1/vistrails
from core.modules.basic_modules import String
from packages.spreadsheet.basic_widgets import SpreadsheetCell
from packages.spreadsheet.spreadsheet_cell import QCellWidget, QCellToolBar
from packages.vis_analytics.plots import Coordinator, MplWidget
from packages.vis_analytics.matrix import Matrix
from matplotlib.widgets import RectangleSelector
from PyQt4 import QtGui
from matplotlib.transforms import Bbox
import numpy as np
import os

from core.bundles import py_import

try:
    mpl_dict = {"linux-ubuntu": "python-matplotlib", "linux-fedora": "python-matplotlib"}
    matplotlib = py_import("matplotlib", mpl_dict)
    matplotlib.use("Qt4Agg", warn=False)
    pylab = py_import("pylab", mpl_dict)
except Exception, e:
    from core import debug

    debug.critical("Exception: %s" % e)

packagePath = os.path.dirname(__file__)


################################################################################
class ProjectionWidget(MplWidget):
    """ ProjectionWidget is a widget to show 2D projections. It has some interactive
    features like, show labels, selections, and synchronization.
    """