<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 07/20/2015 05:43 PM, Berk Geveci
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAE32kpW9LoazpP6Xu_3WUmVMqE8FoA0kiw5TRAXrwwms0OBOQg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr">You probably need to update vtkImageExport and
        shallow copy its output to the programmable source's output. You
        also need to add something to the RequestInformation setting the
        whole extent. You need something like:
        <div><br>
        </div>
        <div>
          <div>from paraview import util</div>
          <div>  </div>
          <div>util.SetOutputWholeExtent(self, [0,nx-1,0,ny-1,0,nz-1])<br>
          </div>
        </div>
        <div><br>
        </div>
        <div>By the way, there are better ways of getting numpy arrays
          into VTK than the image import stuff. See some of the earlier
          blogs here:</div>
      </div>
    </blockquote>
    <br>
    Right. I found the RequestInformation info above from searching the
    web. Then I was able to follow the instructions in the ParaView
    Guide section 13.2.4 Reading binary 2D image. I basically replaced
    the image import stuff with code analogous  to the output
    assignment,<br>
    <br>
    Thanks for your help.<br>
    <br>
    -jeff<br>
    <br>
    <blockquote
cite="mid:CAE32kpW9LoazpP6Xu_3WUmVMqE8FoA0kiw5TRAXrwwms0OBOQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div><a moz-do-not-send="true"
            href="http://www.kitware.com/blog/home/user/53/2">http://www.kitware.com/blog/home/user/53/2</a><br>
        </div>
        <div><br>
        </div>
        <div>Best,</div>
        <div>-berk</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Jul 20, 2015 at 2:08 PM, Jeff
          Becker <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:jeffrey.c.becker@nasa.gov" target="_blank">jeffrey.c.becker@nasa.gov</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Hi,<span class=""><br>
                  <br>
                  On 07/18/2015 05:17 PM, Berk Geveci wrote:<br>
                </span></div>
              <span class="">
                <blockquote type="cite">
                  <div dir="ltr">To elaborate on what Andy said, you can
                    stick your entire VTK script in side the
                    programmable source. Which you can use in batch mode
                    as well. If you want to keep your VTK script as a
                    reusable code, I recommend making it a module that
                    you import from the programmable source.</div>
                </blockquote>
                <br>
              </span> So if the last thing my VTK script does is set up
              a vtkImageImport object should that work as a programmable
              source (I tried but ParaView didn't get any bounds or
              scalar field name even though I set them up)? If not, what
              else do I need to do? Thanks.<span class="HOEnZb"><font
                  color="#888888"><br>
                  <br>
                  -jeff</font></span>
              <div>
                <div class="h5"><br>
                  <br>
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div><br>
                      </div>
                      <div>Best,</div>
                      <div>-berk</div>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Tue, Jul 14, 2015 at
                        3:43 PM, Jeff Becker <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:jeffrey.c.becker@nasa.gov"
                            target="_blank">jeffrey.c.becker@nasa.gov</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div bgcolor="#FFFFFF" text="#000000"><span>
                              <div>On 07/14/2015 12:20 PM, Andy Bauer
                                wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div dir="ltr">ParaView's Python
                                  Programmable Filter and Python
                                  Programmable Source use VTK Python
                                  wrapping to do the work while making
                                  it available in Paraview. Check out <a
                                    moz-do-not-send="true"
                                    href="http://www.paraview.org/Wiki/Python_Programmable_Filter"
                                    target="_blank">http://www.paraview.org/Wiki/Python_Programmable_Filter</a>.<br>
                                </div>
                              </blockquote>
                              <br>
                            </span> Thanks. That's pretty neat, but what
                            I'd really like is a standalone script I can
                            run in batch mode (no interaction) to
                            generate one png file per timestep for all
                            the timesteps in the data set. Essentially
                            I'd like a way to construct a pipeline
                            between the vtk.vtkImageImport()  object and
                            the ParaView renderView1.<span><font
                                color="#888888"><br>
                                <br>
                                -jeff</font></span>
                            <div>
                              <div><br>
                                <blockquote type="cite">
                                  <div class="gmail_extra"><br>
                                    <div class="gmail_quote">On Tue, Jul
                                      14, 2015 at 2:59 PM, Jeff Becker <span
                                        dir="ltr"><<a
                                          moz-do-not-send="true"
                                          href="mailto:jeffrey.c.becker@nasa.gov"
                                          target="_blank">jeffrey.c.becker@nasa.gov</a>></span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">Hi.<br>
                                        <br>
                                        As a proof of concept, I have a
                                        vtk script that reads some
                                        binary data, and produces a vti
                                        file. I then have a second
                                        script that I generated using
                                        ParaView's tracing facility
                                        while viewing the data. Now I'd
                                        like to combine them, so as to
                                        eliminate the intermediate file,
                                        i.e., go from binary data
                                        directly to rendering. To be
                                        specific, my vtk script ends
                                        like this:<br>
                                        <br>
                                        steinbmag =
                                        steinbmag.reshape(nx,ny,nz).T<br>
                                        <br>
                                        vtkImporter =
                                        vtk.vtkImageImport()<br>
                                        vtkImporter.CopyImportVoidPointer(steinbmag,

                                        steinbmag.nbytes)<br>
                                        <br>
vtkImporter.SetDataScalarTypeToFloat()<br>
vtkImporter.SetNumberOfScalarComponents(1)<br>
                                        vtkImporter.SetDataExtent(0,
                                        nx-1, 0, ny-1, 0, nz-1)<br>
                                        vtkImporter.SetWholeExtent(0,
                                        nx-1, 0, ny-1, 0, nz-1)<br>
                                        vtkImporter.SetScalarArrayName('B
                                        field magnitude')<br>
                                        <br>
writer=vtk.vtkXMLImageDataWriter()<br>
                                        writer.SetFileName(out_fname)<br>
writer.SetInputConnection(vtkImporter.GetOutputPort())<br>
                                        writer.Write()<br>
                                        <br>
                                        and the ParaView script starts
                                        like this:<br>
                                        <br>
                                        from paraview.simple import *<br>
                                        <br>
paraview.simple._DisableFirstRenderCameraReset()<br>
                                        <br>
                                        filepfx =
                                        '/nobackup/jcbecker/steinBmag_0'<br>
                                        infile = filepfx+'.vti'<br>
                                        # create a new 'XML Image Data
                                        Reader'<br>
                                        steinBmag_ =
                                        XMLImageDataReader(FileName=infile)<br>
                                        steinBmag_.CellArrayStatus = []<br>
                                        steinBmag_.PointArrayStatus =
                                        ['B field magnitude']<br>
                                        <br>
                                        # get animation scene<br>
                                        animationScene1 =
                                        GetAnimationScene()<br>
                                        <br>
                                        # update animation scene based
                                        on data timesteps<br>
animationScene1.UpdateAnimationUsingDataTimeSteps()<br>
                                        <br>
                                        # get active view<br>
                                        renderView1 =
                                        GetActiveViewOrCreate('RenderView')<br>
                                        # uncomment following to set a
                                        specific view size<br>
                                        renderView1.ViewSize = [1090,
                                        761]<br>
                                        <br>
                                        I'm looking at the VTK examples
                                        and pvpython documentation, but
                                        any help is appreciated.<br>
                                        <br>
                                        Thanks.<br>
                                        <br>
                                        -jeff<br>
_______________________________________________<br>
                                        Powered by <a
                                          moz-do-not-send="true"
                                          href="http://www.kitware.com"
                                          rel="noreferrer"
                                          target="_blank">www.kitware.com</a><br>
                                        <br>
                                        Visit other Kitware open-source
                                        projects at <a
                                          moz-do-not-send="true"
                                          href="http://www.kitware.com/opensource/opensource.html"
                                          rel="noreferrer"
                                          target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                                        <br>
                                        Please keep messages on-topic
                                        and check the ParaView Wiki at:
                                        <a moz-do-not-send="true"
                                          href="http://paraview.org/Wiki/ParaView"
                                          rel="noreferrer"
                                          target="_blank">http://paraview.org/Wiki/ParaView</a><br>
                                        <br>
                                        Search the list archives at: <a
                                          moz-do-not-send="true"
                                          href="http://markmail.org/search/?q=ParaView"
                                          rel="noreferrer"
                                          target="_blank">http://markmail.org/search/?q=ParaView</a><br>
                                        <br>
                                        Follow this link to
                                        subscribe/unsubscribe:<br>
                                        <a moz-do-not-send="true"
                                          href="http://public.kitware.com/mailman/listinfo/paraview"
                                          rel="noreferrer"
                                          target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
                                      </blockquote>
                                    </div>
                                    <br>
                                  </div>
                                </blockquote>
                                <br>
                              </div>
                            </div>
                          </div>
                          <br>
_______________________________________________<br>
                          Powered by <a moz-do-not-send="true"
                            href="http://www.kitware.com"
                            rel="noreferrer" target="_blank">www.kitware.com</a><br>
                          <br>
                          Visit other Kitware open-source projects at <a
                            moz-do-not-send="true"
                            href="http://www.kitware.com/opensource/opensource.html"
                            rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                          <br>
                          Please keep messages on-topic and check the
                          ParaView Wiki at: <a moz-do-not-send="true"
                            href="http://paraview.org/Wiki/ParaView"
                            rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
                          <br>
                          Search the list archives at: <a
                            moz-do-not-send="true"
                            href="http://markmail.org/search/?q=ParaView"
                            rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
                          <br>
                          Follow this link to subscribe/unsubscribe:<br>
                          <a moz-do-not-send="true"
                            href="http://public.kitware.com/mailman/listinfo/paraview"
                            rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
                          <br>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>