[vtk-developers] Class design for spline visualizations

Lin M majcjc at gmail.com
Wed Jun 3 09:25:22 EDT 2015


Hi Dr. Thompson,

Is there any example for 2- and 3-d Bezier Interpolation?

Best,
Lin

On Sat, May 30, 2015 at 1:54 PM, Lin M <majcjc at gmail.com> wrote:

> Hi Dr. Thompson,
>
> I have written a helper function to generate control points for arbitrary
> ellipse and modified the PatchInterpolation.py test to image test which
> contains line, circle and ellipse.
>
> A question about the push the data. I followed the instruction in
> https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md,
> but I didn't see the message when doing the commit step.
>
> Some/Module/Testing/Data/Baseline/MyTest.png.md5: Added content to Git at refs/data/MD5/...
> Some/Module/Testing/Data/Baseline/MyTest.png.md5: Added content to local store at .ExternalData/MD5/...
> Content link Some/Module/Testing/Data/Baseline/MyTest.png.md5 -> .ExternalData/MD5/...
>
> The image test runs correctly in my local machine.
>
> Best,
> Lin
>
> On Sat, May 23, 2015 at 12:16 AM, David Thompson <
> david.thompson at kitware.com> wrote:
>
>> Hi Lin,
>>
>> I believe VTK expects each test to generate a single baseline image whose
>> filename matches the Python script name (e.g.,
>> TestSynchronizedTemplates3D.py
>> <https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Core/Testing/Python/TestSynchronizedTemplates3D.py> must
>> have its baseline image named TestSynchronizedTemplates3D.
>> <https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Core/Testing/Python/TestSynchronizedTemplates3D.py>png
>> in the Data/Baselines directory).
>>
>>     David
>>
>> On May 22, 2015, at 23:15, Lin M <majcjc at gmail.com> wrote:
>>
>> Hi Dr. Thompson
>>
>> I changed the python test to baseline image and followed the instructions
>> in the VTK Data page, but running CMake doesn't seem to make the .md5
>> files. Do you have any idea about that?
>>
>> I outputed two images named bezier-circle.png and bezier-line.png and put
>> them in source-tree/Filters/Bezier/Testing/Data/Baseline.
>>
>> Best,
>> Lin
>>
>>
>> On Tue, May 19, 2015 at 1:52 PM, David Thompson <
>> david.thompson at kitware.com> wrote:
>>
>>> Hi Lin,
>>>
>>> A few additional things that might help:
>>>
>>> 1. When you are done reviewing the merge request I assigned to you,
>>> please click "Accept merge request" or add a "+1" comment so that it will
>>> become part of the splines/filter-bezier branch.
>>>
>>> 2. A good pattern to follow for the image-based test is
>>> Filters/Sources/Testing/Python/TestPlatonicSolids.py . You can see how it
>>> obtains the path to img_file and calls vtk.test.Testing.compareImage to
>>> perform a rendering to compare. The baseline image that the rendering is
>>> compared against is not stored in the VTK git repo. Instead, MD5 checksums
>>> of images are stored in the git repo and the images are uploaded
>>> separately. See
>>>
>>>
>>> https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md
>>>
>>> for a description of how to generate a test image, add its MD5 sum, and
>>> upload it with your merge request.
>>>
>>> 3. If you are going to generate helper methods to create conic sections,
>>> then be aware that you'll have to return multiple sets of control points
>>> because ellipses cannot be represented with a single patch (it is best to
>>> return one patch per quadrant) because of the way they are parameterized.
>>>
>>>         David
>>>
>>> > On May 18, 2015, at 10:45 PM, Lin M <majcjc at gmail.com> wrote:
>>> >
>>> > Hi Dr. Thompson
>>> >
>>> > Thanks! I'll look into that and implement the test asap.
>>> >
>>> > Best,
>>> > Lin
>>> >
>>> > On Mon, May 18, 2015 at 10:36 PM, David Thompson <
>>> david.thompson at kitware.com> wrote:
>>> > Hi Lin,
>>> >
>>> > Sorry for the slow reply.
>>> >
>>> > > Is there any dataset for precomputed Bezier interpolation? I'm
>>> currently comparing the result with my manual calculating. In this way I
>>> can not test many examples and it's quite low efficient.
>>> >
>>> > I've pushed a merge request to the project that adds a couple simple
>>> test cases. I'll add some more over the next few days. You can run the test
>>> by building VTK with the VTK_WRAP_PYTHON option turned ON and then running:
>>> >
>>> >     make
>>> >     ./bin/vtkpython
>>> /path/to/src/Filters/Bezier/Testing/Python/PatchInterpolation.py
>>> >
>>> > If you uncomment the lines below the "For debugging, ..." message in
>>> PatchInterpolation.py, running the test will create some files (named
>>> bezier-circle.vtk and bezier-line.vtk) that you can load into ParaView.
>>> >
>>> > 1. As I mentioned earlier, it would be great to do image-based
>>> testing. A good exercise would be to modify the Python test into an image
>>> test version.
>>> >
>>> > 2. Another good exercise would be to generate control points for other
>>> conic sections such as hyperbolas, parabolas, and the more generate case of
>>> ellipses. I recommend "The NURBS Book" by Les Piegl; the circle quadrant
>>> example in the Python test is from pp. 26--32 of the book. It would be
>>> really nice to have a utility that would create control points given a few
>>> shape parameters. For example:
>>> >
>>> >     ctrlPts, prange = ellipse(major_radius=2, minor_radius=1)
>>> >     ctrlPts, prange = hyperbola(semi_major_axis=2/3, eccentricity=1)
>>> >
>>> > Once we have the 1-, 2-, and 3-d Bezier interpolation tested, we can
>>> work on converting B-splines into Bézier patches and testing that.
>>> >
>>> >         David
>>> >
>>> > >
>>> > > On Mon, Apr 27, 2015 at 1:46 PM, David Thompson <
>>> david.thompson at kitware.com> wrote:
>>> > > Hi Lin,
>>> > >
>>> > > > ... I changed the method to compute binomial coefficient from
>>> vtkMath::Binomial to vtkMath::Factorial using our memoization improvement
>>> and tried to merge from Lin.Ma/filter-bezier to Spline/filter-bezier.
>>> > >
>>> > > Great! I can see that you were able to merge to the branch.
>>> > >
>>> > > > What do you think is the proper thing to do next?
>>> > >
>>> > > Right now, it looks like TestPatchInterpolation is modifying the
>>> array holding control point coordinates. I think it would be a good idea to
>>> write the interpolated points to a separate array and then make the test
>>> verify that Bernstein polynomial is being computed properly.
>>> > >
>>> > > There are 2 ways to verify things: value tests and image tests.
>>> > >
>>> > > 1. Value testing. Interpolate a few different r values on a few
>>> different sets of control points and compare the resulting point
>>> coordinates to values you know are good. The comparison must allow for
>>> small differences due to the differences in floating-point arithmetic
>>> implementations on different platforms.
>>> > >
>>> > > 2. Image testing. Plot the interpolated points and compare the
>>> rendering of the interpolated points to one you have verified is correct.
>>> While not as accurate as value testing, it can often be easier to debug a
>>> failing test with a rendered image. VTK provides utilities for comparing
>>> images (also allowing for small differences due to floating-point math,
>>> OpenGL implementations, and so on). The image baselines that get compared
>>> to your test's rendering are stored outside of the git repository to keep
>>> the repository from getting bloated. Instead, the MD5 sum of the baseline
>>> images are stored in the git repository and the images are stored
>>> separately on Kitware's servers, which can be queried to find a file with a
>>> given MD5 sum.
>>> > >
>>> > > Please take a look at this documentation on adding test data and
>>> baseline images to VTK:
>>> > >
>>> > >
>>> https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md
>>> > >
>>> > > and see if you can add an image-based test of the patch
>>> interpolation.
>>> > >
>>> > >         David
>>> > >
>>> >
>>> >
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150603/c2736365/attachment-0001.html>


More information about the vtk-developers mailing list