[vtkusers] ImageReslice and Interpolation Can anyone help?

Janny Dong janny.dong at gmail.com
Thu Jun 14 16:31:21 EDT 2007


Hi David,

Yours is probably the quickest reply I've got so far through this list.
Thanks again! Now I know how vtkProbeFilter works. Looks like I have to
figure out a way to interpolate my data outside VTK. I am considering
getting all the data available and then use vtkImageReslice, since it
provides several choices of interpolation method.

Could you explain a little bit of the Matrices for axial, coronal, sagittal,
oblique view orientations part in your example code?

//static double axialElements[16] = {

  //         1, 0, 0, 0,
  //         0, 1, 0, 0,
  //         0, 0, 1, 0,
  //         0, 0, 0, 1 };

  //static double coronalElements[16] = {
  //         1, 0, 0, 0,
  //         0, 0, 1, 0,
  //         0,-1, 0, 0,
  //         0, 0, 0, 1 };

  static double sagittalElements[16] = {
           0, 0,-1, 0,
           1, 0, 0, 0,
           0,-1, 0, 0,
           0, 0, 0, 1 };

  //static double obliqueElements[16] = {
  //         1, 0, 0, 0,
  //         0, 0.866025, -0.5, 0,
  //         0, 0.5, 0.866025, 0,
  //         0, 0, 0, 1 };


I don't quite understand the four different view orientations. Last time I
tried axial view and got the first image in my email. I got a blank scene
with other view orientations.

Thanks,
Janny

On 6/14/07, David Gobbi <dgobbi at atamai.com> wrote:
>
> Hi Janny,
>
> You can avoid the second triangularization if you use vtkPlaneSource to
> create the polydata that you probe your original points with.  The
> SetXResolution and SetYResolution methods of vtkPlaneSource set the
> number of "squares" that the plane is divided into in X and Y.  The
> number of points along each edge is equal to the resolution plus one.
>
> The reason that you weren't seeing anything is that you have to generate
> polygons from the points before they can be rendered (unless you render
> them as verts, in which case the points are just rendered as points).
>
> The single color for the "outside" is there because of the way that
> vtkProbeFilter works.  It can only do interpolation within the triangles
> produced by the triangularization, everything outside is set to a
> background color.  To properly fill in these values you would have to do
> your interpolation using something like radial basis functions or with a
> relaxation method, neither of which is supported in VTK.
>
> - David
>
>
>
> Janny Dong wrote:
> > Hey David,
> >
> > Thank you so much. I tried the vtkDelaunay2D then vtkProbeFilter
> > approach you suggested. What I did is use vtkDelaunay2D to triangulate
> > a polydata set of 16 points with known scalars, then probe it with
> > another polydata set of 36 points, then use vtkDelaunay2D again and
> > map the output to polydata mapper and display them. I got Image1 as
> > attached. I did triangulation again because the render window was
> > blank if I map output of vtkProbeFilter directly to polydata mapper. I
> > may have done something wrong.
> >
> > Another thing is if the known data points are not evenly distributed,
> > I got Image2, where all known 16 data are at the bottom left area.
> > The area outside the known data values was interpolated as one color.
> > Is it normal that the data outside the 4*4 area got the same scalar
> > value?
> >
> > Thanks,
> > Janny
> >
> >
> > On 6/13/07, *David Gobbi* < dgobbi at atamai.com
> > <mailto:dgobbi at atamai.com>> wrote:
> >
> >     Hi Janny,
> >
> >     If your original data points do not form a complete, regular grid,
> >     then
> >     vtkImageReslice won't give you the result you want.  You can't use
> >     vtkImageReslice to fill in the gaps.
> >
> >     Instead, you could try using vtkDelaunay2D to triangularize the data
> >     followed by vtkProbeFilter to interpolate the data.  A limitation of
> >     ProbeFilter is that it always does linear interpolation, and it
> cannot
> >     interpolate beyond the hull of the original set of points.
> >
> >     - David
> >
> >
> >     Janny Dong wrote:
> >     > I am trying to get a color contour map out of several data points.
> >     > Let's say, I need a nice and smooth 2D color map of dimension
> >     5*5, so
> >     > that's 25 points. I know the positions of the points of course,
> >     but I
> >     > only know 10 data values (scalars). Therefore I need some
> >     > interpolation to get to know data values (scalars) at all
> positions
> >     > and map them to colors.
> >     >
> >     > I put my data into ImageData, and I am using ImageReslice in
> >     order to
> >     > do the interpolation I want. I constructed pipelines following the
> >     > example David Gobbi provided at
> >     >
> >
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/ImageProcessing/Cxx/ImageSlicing.cxx?root=VTK&content-type=text/plain
> >     <
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/ImageProcessing/Cxx/ImageSlicing.cxx?root=VTK&content-type=text/plain
> >
> >     > <
> >
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/ImageProcessing/Cxx/ImageSlicing.cxx?root=VTK&content-type=text/plain
> >     <
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/ImageProcessing/Cxx/ImageSlicing.cxx?root=VTK&content-type=text/plain
> >>
> >     >
> >     > Then I got an image as attached. For now, I just input 10 random
> >     > scalar values to 10 positions. I used cubic interpolation. What
> >     I want
> >     > is interpolation over the whole image area, not just near every
> >     point.
> >     > How can I achieve such visualization effect?
> >     >
> >     > Actually I just tried everything to get the visualization effect
> >     from
> >     > the Matlab functions griddata, which fits a surface of the form z
> =
> >     > f(x,y) to the data in the (usually) nonuniformly spaced vectors
> >     > (x,y,z), but I couldn't find a way in VTK to do the interpolation.
> I
> >     > read from Matlab help document that the griddata methods (nearest
> >     > neighbor, cubic, linear) are based on a Delaunay triangulation
> >     of the
> >     > data that uses Qhull. However I have no experience with Qhull
> >     and not
> >     > much time to dig into it. Also, I have to do the project in C++
> not
> >     > Matlab. VTK is such a powerful visualization tool so I hope I
> >     could do
> >     > it with VTK.
> >     >
> >     > Thanks a lot.
> >     > Janny
> >     >
> >     >
> >
> ------------------------------------------------------------------------
> >     >
> >     >
> >
> ------------------------------------------------------------------------
> >
> >     >
> >     > _______________________________________________
> >     > This is the private VTK discussion list.
> >     > Please keep messages on-topic. Check the FAQ at:
> >     http://www.vtk.org/Wiki/VTK_FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
> >     > Follow this link to subscribe/unsubscribe:
> >     > http://www.vtk.org/mailman/listinfo/vtkusers
> >     <http://www.vtk.org/mailman/listinfo/vtkusers>
> >     >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> > ------------------------------------------------------------------------
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070614/a7ee1e8c/attachment.htm>


More information about the vtkusers mailing list