Esempio n. 1
0
    def simple360(self):
      self.analysis.register_analysis(
          "360",                                  # id
          "rotation",                             # title
          "Perform 15 contour",                   # description
          "{time}/{theta}_{phi}.jpg", # data structure
          cinema.ThreeSixtyImageStackExporter.get_data_type())
      fng = self.analysis.get_file_name_generator("360")
      arrayName = ('POINT_DATA', 'velocity')
      view = simple.CreateRenderView()

      rep = simple.Show(input, view)
      rep.LookupTable = self.lut
      rep.ColorArrayName = arrayName

      exporter = cinema.ThreeSixtyImageStackExporter(fng, view, self.center_of_rotation, self.distance, self.rotation_axis, [20,45])
      self.exporters.append(exporter)
Esempio n. 2
0
              Atmospheric Simulations
              """

analysis = wx.AnalysisManager(output_working_dir, title, description)

id = 'cam5-volume-linear'
title = 'Temperature Volume Rendering'
description = '''
              Use a linear transfer function to volume render temperature data.
              '''
analysis.register_analysis(id, title, description,
                           '{time}/{volumeIdx}/{theta}_{phi}.jpg',
                           "parametric-image-stack")
fng = analysis.get_file_name_generator(id)
exporter = wx.ThreeSixtyImageStackExporter(fng, view, center_of_rotation,
                                           distance, rotation_axis,
                                           angle_steps)
exporter.set_analysis(analysis)

# -----------------------------------------------------------------------------
# Pipeline configuration
# -----------------------------------------------------------------------------

# create a new 'Legacy VTK Reader'
cam5earth = LegacyVTKReader(FileNames=cam5_filenames)
volume_rep = Show(cam5earth)
volume_rep.Representation = 'Volume'

# create a new 'Legacy VTK Reader'
earthvtk = LegacyVTKReader(FileNames=[earth_file])
earth_rep = Show(earthvtk)
Esempio n. 3
0
 def create_rotate_explorer():
     view = GetActiveView()
     return wx.ThreeSixtyImageStackExporter(
         fng, view, options.get('focal_point', [0, 0, 0]),
         options.get('distance', 100), options.get('axis', [0, 0, 1]),
         options.get('step', [10, 15]))
Esempio n. 4
0
def doProcessing(inputDir, outputDir, sizeOption):

    resolution = 500

    view = GetRenderView()
    view.ViewSize = [resolution, resolution]
    view.Background = [1.0, 1.0, 1.0]
    view.OrientationAxesVisibility = 0
    view.CenterAxesVisibility = 0

    fins_states = ['on', 'off']
    tube_states = ['on', 'off']
    vol_states = ['on', 'off']

    #angle_steps = [15, 15]
    angle_steps = [90, 90]

    centerOfRotation = {
        'shortFat':
        [0.03210659957176176, 0.03210659957176176, 2.08050000667572],
        'longFat':
        [0.1284263964244019, 0.1284263964244019, 2.2200000286102295],
        'longSkinny':
        [0.0064213199143523525, 0.0064213199143523525, 2.097312331199646]
    }

    rotation_axis = [0.0, 0.0, 1.0]

    distance = {'shortFat': 0.25, 'longFat': 1.16, 'longSkinny': 0.27}

    transformDims = {
        'shortFat': [5, 5, 1],
        'longFat': [20, 20, 1],
        'longSkinny': [1, 1, 1]
    }

    # -----------------------------------------------------------------------------
    # Input data definition
    # -----------------------------------------------------------------------------

    rodPaths = {
        'shortFat': 'rodShortest.vtk',
        'longFat': 'rodLong.vtk',
        'longSkinny': 'rodShorter.vtk'
    }

    rodPath = os.path.join(inputDir, rodPaths[sizeOption])
    blockFinsPath = os.path.join(inputDir, 'firstBlockFin.vtk')

    filePattern = {
        'shortFat': 'singlepin_shortest_%d.vtk',
        'longFat': 'singlepin_%d.vtk',
        'longSkinny': 'singlepin_clipped_%d.vtk'
    }

    #fileTimes = range(13) # all timesteps
    fileTimes = [7]

    fileNames = [
        os.path.join(inputDir, (filePattern[sizeOption] % time))
        for time in fileTimes
    ]

    # -------------------------------------------------------------------------
    # Pipeline definition
    # -------------------------------------------------------------------------

    # Rod Core
    rodCore = LegacyVTKReader(FileNames=[rodPath])

    # create a new 'Transform'
    rodTransform = Transform(Input=rodCore)
    rodTransform.Transform = 'Transform'
    rodTransform.Transform.Scale = transformDims[sizeOption]

    rodRep = Show(rodTransform)

    # Block Fins
    blockFins = LegacyVTKReader(FileNames=[blockFinsPath])

    # create a new 'Transform'
    blockTransform = Transform(Input=blockFins)
    blockTransform.Transform = 'Transform'
    blockTransform.Transform.Scale = transformDims[sizeOption]

    finsRep = Show(blockTransform)

    # Data pipeline
    reader = LegacyVTKReader(FileNames=fileNames)

    # create a new 'Transform'
    readerTransform = Transform(Input=reader)
    readerTransform.Transform = 'Transform'
    readerTransform.Transform.Scale = transformDims[sizeOption]

    dataRep = Show(readerTransform)

    velLUT = GetColorTransferFunction('vel')
    velLUT.RGBPoints = [
        0.0, 0.368627, 0.309804, 0.635294, 0.6000048000384004, 0.196078,
        0.533333, 0.741176, 1.2000096000768008, 0.4, 0.760784, 0.647059,
        1.800014400115201, 0.670588, 0.866667, 0.643137, 2.4000192001536016,
        0.901961, 0.960784, 0.596078, 3.0000240001920018, 1.0, 1.0, 0.74902,
        3.600028800230402, 0.996078, 0.878431, 0.545098, 4.200033600268802,
        0.992157, 0.682353, 0.380392, 4.800038400307203, 0.956863, 0.427451,
        0.262745, 5.400043200345603, 0.835294, 0.243137, 0.309804, 6.0,
        0.619608, 0.00392157, 0.258824
    ]
    velLUT.LockScalarRange = 1
    velLUT.ColorSpace = 'RGB'
    velLUT.NanColor = [0.500008, 0.0, 0.0]
    velLUT.ScalarRangeInitialized = 1.0

    # get opacity transfer function/opacity map for 'vel'
    #velPWF = GetOpacityTransferFunction('vel')
    #velPWF.Points = [0.0, 0.0, 0.5, 0.0, 4.471337795257568, 0.0, 0.5, 0.0, 5.1019110679626465, 1.0, 0.5, 0.0, 5.866241931915283, 0.0, 0.5, 0.0, 6.0, 0.0, 0.5, 0.0]
    #velPWF.ScalarRangeInitialized = 1

    dataRep.Representation = 'Volume'
    dataRep.ColorArrayName = ['POINTS', 'vel']
    dataRep.LookupTable = velLUT
    #dataRep.ScalarOpacityFunction = velPWF
    dataRep.ScalarOpacityUnitDistance = 0.0016956502318768525

    rodRep.ColorArrayName = [None, '']
    rodRep.DiffuseColor = [0.3333333333333333, 0.0, 0.0]
    rodRep.ScalarOpacityUnitDistance = 0.0043231046585508965

    finsRep.ColorArrayName = [None, '']
    finsRep.DiffuseColor = [0.6666666666666666, 0.3333333333333333, 0.0]
    finsRep.ScalarOpacityUnitDistance = 0.004452134850700366

    print "Going to set the distance to ", distance[sizeOption]

    fng = wx.FileNameGenerator(
        outputDir, '{time}/{fins}/{tube}/{volumeIdx}/{theta}_{phi}.jpg')
    exporter = wx.ThreeSixtyImageStackExporter(fng, view,
                                               centerOfRotation[sizeOption],
                                               distance[sizeOption],
                                               rotation_axis, angle_steps)

    hatFunctions = createHatFunctions()

    Render()

    for t in fileTimes:
        time = int(t)
        GetAnimationScene().TimeKeeper.Time = float(time)
        UpdatePipeline(time)

        dataRange = [0.0, 6.0]
        print "Moving to timestep ", time, ", new data range: ", dataRange

        for finState in fins_states:
            if finState == 'on':
                finsRep.Visibility = 1
            else:
                finsRep.Visibility = 0

            fng.update_active_arguments(fins=finState)
            fng.update_label_arguments(fins="Fins")

            for tubeState in tube_states:
                if tubeState == 'on':
                    rodRep.Visibility = 1
                else:
                    rodRep.Visibility = 0
                fng.update_active_arguments(tube=tubeState)
                fng.update_label_arguments(tube="Tube")

                for volumeIdx in range(4):
                    curRange = dataRange[1] - dataRange[0]
                    xPoints = hatFunctions[volumeIdx][0]
                    yPoints = hatFunctions[volumeIdx][1]
                    pwfPoints = []

                    for i in range(len(xPoints)):
                        pwfPoints.append(dataRange[0] +
                                         (xPoints[i] * curRange))
                        pwfPoints.append(yPoints[i])
                        pwfPoints.append(0.5)
                        pwfPoints.append(0.0)

                    newPwf = CreatePiecewiseFunction(Points=pwfPoints)
                    dataRep.ScalarOpacityFunction = newPwf

                    fng.update_active_arguments(volumeIdx=volumeIdx)
                    fng.update_label_arguments(volumeIdx="Idx")
                    exporter.UpdatePipeline(time)
Esempio n. 5
0
def doProcessing(inputDir, outputDir, sizeOption):

    resolution = 500

    view = GetRenderView()
    view.ViewSize = [resolution, resolution]
    view.Background = [1.0, 1.0, 1.0]
    view.OrientationAxesVisibility = 0
    view.CenterAxesVisibility = 0

    fins_states = ['on', 'off']
    tube_states = ['on', 'off']
    vol_states = ['on', 'off']

    #angle_steps = [15, 15]
    angle_steps = [90, 90]

    centerOfRotation = {
        'shortFat':
        [0.03210659957176176, 0.03210659957176176, 2.08050000667572],
        'longFat':
        [0.1284263964244019, 0.1284263964244019, 2.2200000286102295],
        'longSkinny':
        [0.0064213199143523525, 0.0064213199143523525, 2.097312331199646]
    }

    rotation_axis = [0.0, 0.0, 1.0]

    distance = {'shortFat': 0.25, 'longFat': 1.16, 'longSkinny': 0.27}

    transformDims = {
        'shortFat': [5, 5, 1],
        'longFat': [20, 20, 1],
        'longSkinny': [1, 1, 1]
    }

    # -----------------------------------------------------------------------------
    # Input data definition
    # -----------------------------------------------------------------------------

    rodPaths = {
        'shortFat': 'rodShortest.vtk',
        'longFat': 'rodLong.vtk',
        'longSkinny': 'rodShorter.vtk'
    }

    rodPath = os.path.join(inputDir, rodPaths[sizeOption])
    blockFinsPath = os.path.join(inputDir, 'firstBlockFin.vtk')

    filePattern = {
        'shortFat': 'singlepin_shortest_%d.vtk',
        'longFat': 'singlepin_%d.vtk',
        'longSkinny': 'singlepin_clipped_%d.vtk'
    }

    fileTimes = range(13)  # all timesteps
    #fileTimes = [ 12 ]

    fileNames = [
        os.path.join(inputDir, (filePattern[sizeOption] % time))
        for time in fileTimes
    ]

    # -------------------------------------------------------------------------
    # Pipeline definition
    # -------------------------------------------------------------------------

    # Rod Core
    rodCore = LegacyVTKReader(FileNames=[rodPath])

    # create a new 'Transform'
    rodTransform = Transform(Input=rodCore)
    rodTransform.Transform = 'Transform'
    rodTransform.Transform.Scale = transformDims[sizeOption]

    rodRep = Show(rodTransform)

    # Block Fins
    blockFins = LegacyVTKReader(FileNames=[blockFinsPath])

    # create a new 'Transform'
    blockTransform = Transform(Input=blockFins)
    blockTransform.Transform = 'Transform'
    blockTransform.Transform.Scale = transformDims[sizeOption]

    finsRep = Show(blockTransform)

    # Data pipeline
    reader = LegacyVTKReader(FileNames=fileNames)

    # create a new 'Transform'
    readerTransform = Transform(Input=reader)
    readerTransform.Transform = 'Transform'
    readerTransform.Transform.Scale = transformDims[sizeOption]

    dataRep = Show(readerTransform)

    helicityLUT = GetColorTransferFunction('helicity')
    helicityLUT.RGBPoints = [
        -10000.0, 0.368627, 0.309804, 0.635294, -7999.983999871999, 0.196078,
        0.533333, 0.741176, -5999.967999743998, 0.4, 0.760784, 0.647059,
        -3999.951999615997, 0.670588, 0.866667, 0.643137, -1999.935999487995,
        0.901961, 0.960784, 0.596078, 0.08000064000589191, 1.0, 1.0, 0.74902,
        2000.096000768006, 0.996078, 0.878431, 0.545098, 4000.112000896008,
        0.992157, 0.682353, 0.380392, 6000.12800102401, 0.956863, 0.427451,
        0.262745, 8000.14400115201, 0.835294, 0.243137, 0.309804, 10000.0,
        0.619608, 0.00392157, 0.258824
    ]
    helicityLUT.LockScalarRange = 1
    helicityLUT.ColorSpace = 'RGB'
    helicityLUT.NanColor = [0.500008, 0.0, 0.0]
    helicityLUT.ScalarRangeInitialized = 1.0

    helicityPWF = GetOpacityTransferFunction('helicity')
    helicityPWF.Points = [
        -10000.0, 0.2, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 10000.0, 0.2, 0.5, 0.0
    ]
    helicityPWF.ScalarRangeInitialized = 1

    dataRep.Representation = 'Volume'
    dataRep.ColorArrayName = ['POINTS', 'helicity']
    dataRep.LookupTable = helicityLUT
    dataRep.ScalarOpacityFunction = helicityPWF
    dataRep.ScalarOpacityUnitDistance = 0.0010386458757740604

    rodRep.ColorArrayName = [None, '']
    rodRep.DiffuseColor = [0.3333333333333333, 0.0, 0.0]
    rodRep.ScalarOpacityUnitDistance = 0.0043231046585508965

    finsRep.ColorArrayName = [None, '']
    finsRep.DiffuseColor = [0.6666666666666666, 0.3333333333333333, 0.0]
    finsRep.ScalarOpacityUnitDistance = 0.004452134850700366

    print "Going to set the distance to ", distance[sizeOption]

    fng = wx.FileNameGenerator(outputDir,
                               '{time}/{fins}/{tube}/{theta}_{phi}.jpg')
    exporter = wx.ThreeSixtyImageStackExporter(fng, view,
                                               centerOfRotation[sizeOption],
                                               distance[sizeOption],
                                               rotation_axis, angle_steps)

    Render()

    for t in fileTimes:
        time = int(t)
        GetAnimationScene().TimeKeeper.Time = float(time)
        UpdatePipeline(time)

        dataRange = [0.0, 6.0]
        print "Moving to timestep ", time, ", new data range: ", dataRange

        for finState in fins_states:
            if finState == 'on':
                finsRep.Visibility = 1
            else:
                finsRep.Visibility = 0

            fng.update_active_arguments(fins=finState)
            fng.update_label_arguments(fins="Fins")

            for tubeState in tube_states:
                if tubeState == 'on':
                    rodRep.Visibility = 1
                else:
                    rodRep.Visibility = 0

                fng.update_active_arguments(tube=tubeState)
                fng.update_label_arguments(tube="Tube")

                exporter.UpdatePipeline(time)