[vtkusers] How can I plot a Hedgehog with programmatically-built data?

Andrew Maclean andrew.amaclean at gmail.com
Fri Jul 6 19:40:16 EDT 2018


The best way to get the data is to check out VTKExamples as detailed here.
Once you have done this the data files can be found
in VTKExamples/src/Testing/Data.

If you are a Python user I have usually created a function:
*get_program_parameters()*. This function tells you the data file used and
any parameters needed.

In the case of the Cxx code you will usually find code like this:

  if (argc < 2)
  {    std::cout << "Usage: " << argv[0] << " carotid.vtk" <<
std::endl;    return EXIT_SUCCESS;
  }


Alternatively, look at the CMakeLists.txt file in the directory where the
Cxx code lives. For the Cxx equivalent of the Python example you used, it
is in  VTKExamples/Visualization. If you look at the CMakeLists.txt file
there you will find a line:
------
add_test(${KIT}-ComplexV ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT}CxxTests
  TestComplexV ${DATA}/carotid.vtk)
------
Note that the paramters are also listed here e.g. in the case of
CorrectlyRenderTranslucentGeometry.cxx:
------
add_test(${KIT}-CorrectlyRenderTranslucentGeometry
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT}CxxTests
  TestCorrectlyRenderTranslucentGeometry 100 100 50 0.1 0 0)
------

Regards
   Andrew

---------- Forwarded message ----------
> From:
> ​​
>  Aron Helser <aron.helser at kitware.com>
> To: Jack Eiler <babybishops at gmail.com>
> Cc: vtkusers at public.kitware.com
> Bcc:
> Date: Fri, 6 Jul 2018 10:21:55 -0400
> Subject: Re: [vtkusers] How can I plot a Hedgehog with
> programmatically-built data? (Python)
> If you build VTK, with testing or with examples, the data files end up in
> the build directory. It's a binary file ~2.5Mb, or I'd attach it.
> The example uses  vtkStructuredPointsReader to read the file, then
> vtkPolyDataMapper , tells you carotid is probably a PolyData, so you can
> look for examples of constructing that. The example of exchanging data with
> Numpy arrays might be helpful.
> HTH,
> Aron
>
>
> On Fri, Jul 6, 2018 at 4:10 AM J. <babybishops at gmail.com> wrote:
>
>> I'd like to draw a Hedgehog plot in Python. I had a look at this example:
>>
>> https://lorensen.github.io/VTKExamples/site/Python/Visualization/ComplexV/
>>
>> But unfortunately the data for the plot there is just read from a file,
>> "carotid.vtk" (a file which, by the way, I can't find anywhere on the
>> Internet - maybe a download a link could be added to the examples page?).
>> Thus it's quite opaque exactly how this data needs to be presented. I've
>> been trying to guess my way to success by looking at some C code I found,
>> but I'm not getting any joy.
>>
>> Say I have a 2-dimensional python array of python 3-tuples representing
>> the values of a vector field at each point of a regular 3d grid. What steps
>> do I take to plot that as a hedgehog?
>>
>

-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180707/2d032ed5/attachment.html>


More information about the vtkusers mailing list