<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Works like a charm…thanks! Martin<br>
    <br>
    <div class="moz-cite-prefix">On 16/05/2016 19:55, Sujin Philip
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAEWo2JNk4Qkgfv7MNs3T-2HR5eS=yWSBx8yReRMggMDPTPOXWQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi Martin,<br>
                <br>
              </div>
              Attached is the modified script that I ran. This is the
              output of the script:<br>
              pointdata 1 9<br>
              (0.0,) (0.0,) (0.0,) (0.0,) (2.0,) (0.0,) (0.0,) (0.0,)
              (0.0,) <br>
              celldata 1 9<br>
              (0.0,) (0.0,) (0.0,) (0.0,) (2.0,) (0.0,) (0.0,) (0.0,)
              (0.0,) <br>
              vtkValidPointMask 1 9<br>
              (0.0,) (0.0,) (0.0,) (0.0,) (1.0,) (0.0,) (0.0,) (0.0,)
              (0.0,)<br>
              <br>
            </div>
            The results look correct. Is this not the behaviour you are
            getting? Let me know if you still have issues.<br>
            <br>
          </div>
          Thanks<br>
        </div>
        Sujin<br>
        <br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, May 13, 2016 at 7:45 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">
            <div 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.<span
                class="HOEnZb"><font color="#888888"><br>
                  <br>
                  Martin</font></span>
              <div>
                <div class="h5"><br>
                  <br>
                  <div>On 13/05/2016 18:53, Sujin Philip wrote:<br>
                  </div>
                  <blockquote 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"><a class="moz-txt-link-abbreviated" href="mailto:martin.genet@polytechnique.edu">martin.genet@polytechnique.edu</a></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"
                            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"
                            target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</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"><a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a></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>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>