Thank you, David.

I could not get your script to work.
Fortunately, I found another workaround.
Either change my source to provide PointData, or put a CellDataToPointData filter between the source and the resample filter.
Hope this is helpful for you.

Jiahui Luo

在 2017年01月21日 02:04, David E DeMarle 写道:
nvm, already reported here: https://gitlab.kitware.com/paraview/paraview/issues/17121

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Fri, Jan 20, 2017 at 12:09 PM, David E DeMarle <dave.dema...@kitware.com <mailto:dave.dema...@kitware.com>> wrote:

    Please file a bug report on gitlab.

    David E DeMarle
    Kitware, Inc.
    R&D Engineer
    21 Corporate Drive
    Clifton Park, NY 12065-8662
    Phone: 518-881-4909 <tel:%28518%29%20881-4909>

    On Fri, Jan 20, 2017 at 12:08 PM, David E DeMarle
    <dave.dema...@kitware.com> wrote:

        That's a bug in either the OSPRay mapper or the
        ResampleToImage filter, depending on your point of view. To
        workaround, put a python programmable filter into the pipeline
        to annotate the array as being the "Active Scalars".

        In it, choose:
        Output Data Set Type = "Same as Input" //the default
        check "Copy Arrays" //not the default
        for script use
        :self.GetOutput().GetPointData().SetActiveScalars("RTData")

        David E DeMarle
        Kitware, Inc.
        R&D Engineer
        21 Corporate Drive
        Clifton Park, NY 12065-8662
        Phone: 518-881-4909 <tel:%28518%29%20881-4909>

        On Fri, Jan 20, 2017 at 2:45 AM, Jiahui Luo <luo...@gmail.com
        <mailto:luo...@gmail.com>> wrote:

            Hi ,
            I got an error message when trying to do volume rendering
            on the output of the ResampleToImage filter:

                ERROR: In
                
/home/user/apps/paraview5.2.0-build/superbuild/paraview/src/VTK/Rendering/OSPRay/vtkOSPRayVolumeMapperNode.cxx,
                line 107
                vtkOSPRayVolumeMapperNode (0x68c2ad0): VolumeMapper's
                Input has no scalar array!

            Here is how it happened.
            First, I added a ProgrammableSource with Output DataSet
            Type set to vtkRectilinearGrid and apply something like this,

                import numpy as np

                # Read x,y,z,th from file

                xCoords = vtk.vtkDoubleArray()
                for i in x:
                    xCoords.InsertNextValue(i)

                yCoords = vtk.vtkDoubleArray()
                for i in y:
                    yCoords.InsertNextValue(i)

                zCoords = vtk.vtkDoubleArray()
                for i in z:
                    zCoords.InsertNextValue(i)

                output.SetDimensions(len(x), len(y), len(z))
                output.SetXCoordinates(xCoords)
                output.SetYCoordinates(yCoords)
                output.SetZCoordinates(zCoords)

                thArray = vtk.vtkFloatArray()
                thArray.SetName("Temperature")
                thArray.SetNumberOfComponents(1)
                thArray.SetNumberOfTuples(nx*ny*nz)
                for k in range(nz):
                    for j in range(ny):
                        for i in range(nx):
                            index = i+j*nx+k*ny*nx
                thArray.SetValue(index, th[k,j,i])
                output.GetCellData().SetScalars(thArray)
                return output

            Since volume rendering can not be done on rectilinear
            grid. I added a ResampleToImage filter on this source.

            Then I could do volume rendering using Ray cast or GPU
            based, but not OSPray and the above message popped up.

            How to make this work? Thanks.

            Jiahui Luo





            _______________________________________________
            Powered by www.kitware.com <http://www.kitware.com>

            Visit other Kitware open-source projects at
            http://www.kitware.com/opensource/opensource.html
            <http://www.kitware.com/opensource/opensource.html>

            Please keep messages on-topic and check the ParaView Wiki
            at: http://paraview.org/Wiki/ParaView
            <http://paraview.org/Wiki/ParaView>

            Search the list archives at:
            http://markmail.org/search/?q=ParaView

            Follow this link to subscribe/unsubscribe:
            http://public.kitware.com/mailman/listinfo/paraview
            <http://public.kitware.com/mailman/listinfo/paraview>





_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to