I (think that I) am allready precomputing the marching cubes. See my code snippet below, I think this would mean that the marching cubes are pre-calculated and can be cached?<div><br></div><div><div>for(int i = 0; i < numberOfFrames; ++i)</div>
<div>{</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>reader[i] = vtkSmartPointer<vtkStructuredPointsReader>::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>std::stringstream name;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>name << "C:/Temp/vtk/FTLE" << (i+1) << ".vtk";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cout << "Loading: " << name.str();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>reader[i]->SetFileName(name.str().c_str());</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>reader[i]->Update();</div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cout << ", and calculating ISO surface\n";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// Create surfaces between range specified</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>contours[i] = vtkSmartPointer<vtkMarchingCubes>::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>contours[i]->GenerateValues(10, minValue, maxValue); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>contours[i]->ComputeNormalsOn(); // fancy and expensive</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>contours[i]->ComputeScalarsOn();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>contours[i]->SetInputConnection(reader[i]->GetOutputPort());</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>contours[i]->Update();</div>
<div>}</div><br><div class="gmail_quote">On Thu, Jul 7, 2011 at 1:04 PM, Dominik Szczerba <span dir="ltr"><<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> When I load this sequence in Paraview, it is able to run very smoothly<br>
> (after the first run, which takes some time) while still allowing the user<br>
> to interact. Does anyone know how Paraview does this?<br>
<br>
</div>Probably by caching. Why not precompute marching cubes prior to rendering?<br>
<font color="#888888"><br>
Dominik<br>
</font><div><div></div><div class="h5"><br>
><br>
> Tijmen<br>
><br>
> On Wed, Jul 6, 2011 at 5:46 PM, Shashwath T.R. <<a href="mailto:trshash@gmail.com">trshash@gmail.com</a>> wrote:<br>
>><br>
>> Why not have multiple vtkMarchingCubes instances - one for each input, and<br>
>> then multiple mapper/actor sets? You could select which one you want to work<br>
>> on, and make the rest invisible...<br>
>> Shash<br>
>><br>
>> On Wed, Jul 6, 2011 at 4:37 PM, Tijmen Klein <<a href="mailto:T.R.Klein@student.rug.nl">T.R.Klein@student.rug.nl</a>><br>
>> wrote:<br>
>>><br>
>>> This is what I do. I set up the whole scene, load in all the different<br>
>>> readers, and connect the first reader to the vtkMarchingCubes. Then I use a<br>
>>> timer that calls an update function every second. This update function sets<br>
>>> the inputconnection of the vtkMarchingCubes to the current reader<br>
>>> (contours->setInputConnection(reader[current]->getOutputPort()). This is<br>
>>> working, but results in small (but very noticable) hickups in the<br>
>>> interaction. I think this is because the isosurfaces have to be<br>
>>> re-calculated every time. That's why I think that I will need an array of<br>
>>> vtkMarchingCubes too.<br>
>>><br>
>>> Tijmen<br>
>>><br>
>>> On Wed, Jul 6, 2011 at 11:02 AM, Dominik Szczerba <<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>><br>
>>> wrote:<br>
>>>><br>
>>>> You should update your reader only from a callback function once you<br>
>>>> have your scene/camera/etc set up...<br>
>>>><br>
>>>> Dominik<br>
>>>><br>
>>>> On Wed, Jul 6, 2011 at 10:51 AM, Tijmen Klein <<a href="mailto:T.R.Klein@student.rug.nl">T.R.Klein@student.rug.nl</a>><br>
>>>> wrote:<br>
>>>> > Thank you for the reply. First of all, I'm not trying to export a<br>
>>>> > animation;<br>
>>>> > it should be realtime and allowing the user to navigate the scene.<br>
>>>> ><br>
>>>> > I'm currently applying the fist technique (update the reader in a<br>
>>>> > loop).<br>
>>>> > Technically this works fine, but it is really slow and also blocks the<br>
>>>> > mean<br>
>>>> > thread of the program (the program simply freezes when switching<br>
>>>> > between 2<br>
>>>> > frames). A possible solution that I came up with is the following:<br>
>>>> > create N<br>
>>>> > pipelines (up to the mapper), where N is the number of frames. This<br>
>>>> > mean I<br>
>>>> > can load the data first, create the isosurfaces and then based on the<br>
>>>> > current time let the actor point to the corresponding mapper. This<br>
>>>> > would<br>
>>>> > mean that all the calculations are already completed.<br>
>>>> ><br>
>>>> > Is this a viable solution? It feels a bit hack-ish to do it like this.<br>
>>>> ><br>
>>>> > Tijmen<br>
>>>> ><br>
>>>> > On Tue, Jul 5, 2011 at 4:00 PM, Dominik Szczerba<br>
>>>> > <<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>><br>
>>>> > wrote:<br>
>>>> >><br>
>>>> >> There are a few possibilities. The simplest would be to update the<br>
>>>> >> reader in a loop and dumping screen renderings. More sophisticated<br>
>>>> >> would be to import them first into a temporal dataset and then<br>
>>>> >> request<br>
>>>> >> a specific time value.<br>
>>>> >><br>
>>>> >> Dominik<br>
>>>> >><br>
>>>> >> On Tue, Jul 5, 2011 at 2:57 PM, Tijmen Klein<br>
>>>> >> <<a href="mailto:T.R.Klein@student.rug.nl">T.R.Klein@student.rug.nl</a>><br>
>>>> >> wrote:<br>
>>>> >> > I'm trying to animate multiple input files. These files are in the<br>
>>>> >> > legacy<br>
>>>> >> > VTK format (.vtk), and named filename[x].vtk, where [x] is an<br>
>>>> >> > integer. A<br>
>>>> >> > contourfilter is used to generate isosurfaces, and these<br>
>>>> >> > isosurfaces<br>
>>>> >> > should<br>
>>>> >> > be animated.<br>
>>>> >> ><br>
>>>> >> > This is behaviour that is quite easy to achieve in Paraview (open<br>
>>>> >> > the<br>
>>>> >> > files,<br>
>>>> >> > apply contour filter, choose a frame or click play). How can<br>
>>>> >> > something<br>
>>>> >> > similar be achieved in VTK? It should be possible to create a<br>
>>>> >> > time-dependent<br>
>>>> >> > animation, but also manually set the current frame. I thought of<br>
>>>> >> > creating<br>
>>>> >> > multiple InputReaders, and have the 'current' reader's outputport<br>
>>>> >> > connected<br>
>>>> >> > to the input port of the contour filter. But I think this would not<br>
>>>> >> > be<br>
>>>> >> > very<br>
>>>> >> > efficient, since it's not possible to cache the results in this<br>
>>>> >> > way.<br>
>>>> >> > This<br>
>>>> >> > would mean that all the calculations happen again when the<br>
>>>> >> > animations<br>
>>>> >> > restarts from frame 1. What would be a better solution?<br>
>>>> >> ><br>
>>>> >> > Cheers,<br>
>>>> >> > Tijmen<br>
>>>> >> ><br>
>>>> >> > _______________________________________________<br>
>>>> >> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>>> >> ><br>
>>>> >> > Visit other Kitware open-source projects at<br>
>>>> >> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>>> >> ><br>
>>>> >> > Please keep messages on-topic and check the VTK FAQ at:<br>
>>>> >> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>>> >> ><br>
>>>> >> > Follow this link to subscribe/unsubscribe:<br>
>>>> >> > <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>>>> >> ><br>
>>>> >> ><br>
>>>> ><br>
>>>> ><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Please keep messages on-topic and check the VTK FAQ at:<br>
>>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>