<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Thanks for your help, Sujin.<br>
    <br>
    What do you mean exactly by "your code works for me"? I sat the
    arrays names but am still getting the same behavior: the code runs
    fine, but I can't find the interpolated data. Do you know where it
    is? Thanks again.<br>
    <br>
    Martin<br>
    <br>
    <div class="moz-cite-prefix">On 13/05/2016 18:53, Sujin Philip
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAEWo2JMUcD8LNLVO=KozqeXkMD=72mPoY2DLkqS=wpEsHi1OkA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi Martin,<br>
                <br>
              </div>
              You need to set names for the point and cell data arrays.<br>
            </div>
            farray.SetName("pointdata") and farray.SetName("celldata")<br>
            <br>
          </div>
          after doing that your code works for me.<br>
          <br>
        </div>
        -Sujin<br>
        <div>
          <div>
            <div>
              <div><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, May 13, 2016 at 12:16 PM,
          Martin Genet <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:martin.genet@polytechnique.edu"
              target="_blank">martin.genet@polytechnique.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear
            everyone:<br>
            <br>
            Sorry for the triviality, but I'm getting confused with
            vtkProbeFilter: trying to probe an image with a mesh (not
            the opposite: I need the mesh data interpolated onto the
            image points), but can't get it to work.<br>
            <br>
            Consider the following code:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              import numpy<br>
              import vtk<br>
              <br>
              image = vtk.vtkImageData()<br>
              image.SetDimensions([3, 3, 1])<br>
              image.SetSpacing(1./numpy.array(image.GetDimensions()))<br>
              image.SetOrigin(numpy.array(image.GetSpacing())/2)<br>
              <br>
              points = vtk.vtkPoints()<br>
              points.InsertNextPoint([1./4, 1./4, 2./4])<br>
              points.InsertNextPoint([3./4, 1./4, 2./4])<br>
              points.InsertNextPoint([3./4, 3./4, 2./4])<br>
              points.InsertNextPoint([1./4, 3./4, 2./4])<br>
              <br>
              cell = vtk.vtkQuad()<br>
              cell.GetPointIds().SetId(0, 0)<br>
              cell.GetPointIds().SetId(1, 1)<br>
              cell.GetPointIds().SetId(2, 2)<br>
              cell.GetPointIds().SetId(3, 3)<br>
              <br>
              cell_array = vtk.vtkCellArray()<br>
              cell_array.InsertNextCell(cell)<br>
              <br>
              ugrid = vtk.vtkUnstructuredGrid()<br>
              ugrid.SetPoints(points)<br>
              ugrid.SetCells(vtk.VTK_QUAD, cell_array)<br>
              <br>
              farray = vtk.vtkFloatArray()<br>
              farray.SetNumberOfComponents(1)<br>
              farray.SetNumberOfTuples(1)<br>
              farray.SetTuple1(0, 2.)<br>
              ugrid.GetCellData().AddArray(farray)<br>
              <br>
              farray = vtk.vtkFloatArray()<br>
              farray.SetNumberOfComponents(1)<br>
              farray.SetNumberOfTuples(4)<br>
              farray.SetTuple1(0, 2.)<br>
              farray.SetTuple1(2, 2.)<br>
              farray.SetTuple1(3, 2.)<br>
              farray.SetTuple1(4, 2.)<br>
              ugrid.GetPointData().AddArray(farray)<br>
              <br>
              probe = vtk.vtkProbeFilter()<br>
              if (vtk.vtkVersion.GetVTKMajorVersion() >= 6):<br>
                  probe.SetInputData(image)<br>
                  probe.SetSourceData(ugrid)<br>
              else:<br>
                  probe.SetInput(image)<br>
                  probe.SetSource(ugrid)<br>
              probe.Update()<br>
              probed_image = probe.GetOutput()<br>
            </blockquote>
            <br>
            Problem is: probed_image contains only one array, called
            vtkValidPointMask, but no interpolated data.<br>
            <br>
            If I do:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              probed_scalars =
              probed_image.GetPointData().GetArray("vtkValidPointMask")<br>
              for k_voxels in
              xrange(probed_scalars.GetNumberOfTuples()): print
              probed_scalars.GetTuple1(k_voxels)<br>
            </blockquote>
            I'm getting:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              0.0<br>
              0.0<br>
              0.0<br>
              0.0<br>
              1.0<br>
              0.0<br>
              0.0<br>
              0.0<br>
              0.0<br>
            </blockquote>
            So I'm guessing the filter is able to figure out which image
            point lies within the mesh and which does not, but I can't
            find the interpolated data? Any help would be super
            appreciated. Thanks!<br>
            <br>
            Martin<br>
            <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"><a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a><br>
            <br>
            Please keep messages on-topic and check the VTK FAQ at: <a
              moz-do-not-send="true"
              href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer"
              target="_blank"><a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a></a><br>
            <br>
            Search the list archives at: <a moz-do-not-send="true"
              href="http://markmail.org/search/?q=vtkusers"
              rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
            <br>
            Follow this link to subscribe/unsubscribe:<br>
            <a moz-do-not-send="true"
              href="http://public.kitware.com/mailman/listinfo/vtkusers"
              rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>