[vtkusers] Multiple volumes rendering with vtkGPUVolumeRayCastMapper or similar

amdelaossa adelaossa at gmail.com
Fri Aug 26 12:12:55 EDT 2016


Hello Álvaro,

It works! 
Rendering multiple overlapping data volumes with the same grid is possible with vtkGPUVolumeRayCastMapper.
Using numpy arrays was easy to gather the different 3-dimensional data arrays together by adding a 4th index to the combined array. 
The volume properties can be set independently for each one of the components.
Thanks for the help!

Best regards,
Alberto


> On 26 Aug 2016, at 15:55, amdelaossa <adelaossa at gmail.com> wrote:
> 
>> 
>> On 26 Aug 2016, at 15:43, Alvaro Sanchez <alvaro.sanchez at kitware.com <mailto:alvaro.sanchez at kitware.com>> wrote:
>> 
>> It is great to read that you are working on this feature for future releases of VTK. 
>> I think that it will be very useful for many people. 
>> In the mean time I would like to try your proposed approach of defining multiple components in one volume. 
>> Let me ask you something:
>> If data1, data2, data3 are my three independent three-dimensional data arrays, should I merge them first in a four-dimensional array where the first index is the component index?
>> 
>> 
>> You should merge them in a three-dimensional array (each component being dataN).  Checkout TestGPURayCastTwoComponentsIndependent, that could serve you as an example.  Going back to your initial question though, as Elvis pointed out, if your volumes are not overlapping you could create instead several vtkVolumes (each with its own mapper), this should also work.
> 
> 
> My volumes are overlapping but they are defined in the same (regular) grid. 
> So I need to use the multi-component trick. 
> However I still do not understand the format…
> Lets say that I have two 3D arrays data1 and data2 with identical number of components in each direction, i.e.  data1(Nx,Ny,Nz) and data2(Nx,Ny,Nz).
> Should merge them into another array which would look like this: 
> data(2 * Nx, Ny, Nz) 
> with data(i,j,k) = data1(i,j,k) for i<Nx and 
> data(i,j,k) = data2(i-Nx,j,k) for i>=Nx  
> 
> Is that right?
> 
> Thanks!
> Alberto
> 
>> 
>> Could you give an rough estimation of when multiple volumes rendering with vtkGPUVolumeRayCastMapper will be available in VTK?
>> 
>> 
>> My best guess would be VTK 8.
>> 
>> 
>> 
>> On Fri, Aug 26, 2016 at 6:39 AM, amdelaossa <adelaossa at gmail.com <mailto:adelaossa at gmail.com>> wrote:
>> Hi Álvaro,
>> 
>> Thanks a lot for your prompt answer!
>> See my comments below. 
>> 
>>> as you have noticed, multi-volume rendering is currently not supported in the vtkGPUVolumeRayCastMapper.  If you are building VTK with OpenGL2 however, it supports independent components so (depending on your use case) you might be able to render up to 4 volumes (one per component), provided you can arrange them in a four component array (this has the limitation that each component will need to have the same dimensions).  That said, we are working on giving support for multiple volumes in the next VTK release.
>> 
>> It is great to read that you are working on this feature for future releases of VTK. 
>> I think that it will be very useful for many people. 
>> In the mean time I would like to try your proposed approach of defining multiple components in one volume. 
>> Let me ask you something:
>> If data1, data2, data3 are my three independent three-dimensional data arrays, should I merge them first in a four-dimensional array where the first index is the component index?
>> 
>>> With regards to the solution you mentioned (https://github.com/bozorgi/VTKMultiVolumeRayCaster <https://github.com/bozorgi/VTKMultiVolumeRayCaster>), you could use it temporarily if it would solve your problem better than fitting the volumes as independent components.  It seems to implement a similar approach as we would do (connecting various inputs/ properties to the mapper) so it should not be extremely difficult to migrate to the official implementation in the future.  I have not tried it myself but please do let us know if you have any remarks once you try it.  As far as I know, if the python bindings are not explicitly disabled for these new classes then they should be also wrapped.
>> 
>> Alright. However this solution is currently not useful to me since it was implemented for VTK 5 (I think) and it fails to compile against VTK 7. 
>> So I am temporarily stuck here. I’d like to try your approach with the multi-components…
>> 
>> Could you give an rough estimation of when multiple volumes rendering with vtkGPUVolumeRayCastMapper will be available in VTK?
>> 
>> Thanks a lot!
>> 
>> Regards,
>> Alberto
>> 
>>> 
>>> Regads,
>>> Álvaro
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ---------- Forwarded message ----------
>>> From: amdelaossa <adelaossa at gmail.com <mailto:adelaossa at gmail.com>>
>>> Date: Thu, Aug 25, 2016 at 10:00 AM
>>> Subject: [vtkusers] Multiple volumes rendering with vtkGPUVolumeRayCastMapper or similar
>>> To: vtkusers at vtk.org <mailto:vtkusers at vtk.org>
>>> 
>>> 
>>> Dear all, 
>>> we (a research team <http://plasma.desy.de/research/simulation_and_theory/index_eng.html> in DESY, Germany) are strongly interested in rendering multiple data volumes in the same view with VTK. 
>>> We chose VTK for our 3D visualisation project on beam-plasma interactions due to its extended functionality and features, 
>>> its open source character and because it is written in C++ with bindings for python.
>>> However, we will require to show multiple volumes in the same view (representing the data of different particle species in our simulations).
>>> We are currently using a vtkGPUVolumeRayCastMapper object for each data set, which is then connected to a vtkVolume. 
>>> The different vtkVolume objects are then added to the vtkRenderer.
>>> We have tried to use different vtkRenderer objects for the different vtkVolumes, 
>>> but still only the first volume on the first vtkRenderer is displayed. 
>>> 
>>> Searching in the web, we have found the following (potential) solution:
>>> https://github.com/bozorgi/VTKMultiVolumeRayCaster <https://github.com/bozorgi/VTKMultiVolumeRayCaster>
>>> which is published here:
>>> http://www.ncbi.nlm.nih.gov/pubmed/24841148 <http://www.ncbi.nlm.nih.gov/pubmed/24841148>
>>> 
>>> It consists on new vtk classes to handle multiple volumes rendering.
>>> As it might work well for our purposes, we would like to ask your opinion about this new classes.
>>> Are you planning to incorporate something like this in the official VTK distribution soon?
>>> If not, we will be interested in incorporating this new class into our personal VTK installation.
>>> Then the question is: Will be the python bindings automatically generated for these new classes?
>>> 
>>> Thanks a lot for your support!
>>> 
>>> Best regards,
>>> Alberto
>>> 
>>> 
>>> _______________________________________________
>>> Powered by www.kitware.com <http://www.kitware.com/>
>>> 
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>>> 
>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
>>> 
>>> Search the list archives at: http://markmail.org/search/?q=vtkusers <http://markmail.org/search/?q=vtkusers>
>>> 
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers <http://public.kitware.com/mailman/listinfo/vtkusers>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Alvaro Sanchez
>>> Kitware, Inc.
>>> Senior R&D Engineer
>>> 21 Corporate Drive
>>> Clifton Park, NY 12065-8662
>>> Phone: 518-881-4901 <tel:518-881-4901>
>> 
>> 
>> 
>> -- 
>> Alvaro Sanchez
>> Kitware, Inc.
>> Senior R&D Engineer
>> 21 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4901

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160826/e09201c0/attachment.html>


More information about the vtkusers mailing list