ospray cinematic rendering

Hi, i was trying to render a MRI volume using OSPRay,

rw = vtk.vtkRenderWindow()
r = vtk.vtkRenderer()
rw.AddRenderer(r)
rtp = vtk.vtkOSPRayPass()
r.SetPass(rtp)

the code i used is as shown above, when i try to run the code, i get the error vtkmodules doesn’t have OSPRayPass. do i need to add something while building vtk? or is there any other way of getting access to it in vtkmodules?

Thanks

OSPRay cannot do “cinematic rendering” (Siemens’ term for photorealistic volumetric rendering of medical images) yet - see raytracing in vtk. As far as I understand, OSPray is also primarily runs on the CPU, so most likely it won’t be able to provide near-interactive frame rates.

NVidia OptiX (via VisRTX) is more promising as it can take advantage of modern GPUs, but it does not yet support volume rendering at all.

I guess we need to wait until VTK’s OSPRay and/or OptiX volume rendering capabilities improve. Probably things would happen faster by providing funding to Kitware. We would not like to be the only group to fund this but if others are interested in this, too, then we would be happy to contribute.

thank you, your explanation cleared my misunderstanding. Right now is there anyway to do photo realistic rendering in vtk other than writing our own system?

thanks

Sorry to revive an old thread but this seemed to be the place to show off some recent pictures of path traced volume rendering via OSPRay 2.

Disclaimer: this image was made in OSPRayStudio, not VTK per se, but we should be able to get the same image out of VTK master or ParaView 5.9. We will need at least an openvdb import to get this data in…

Thanks for sharing, this looks very promising!

The image above is the 3D Slicer CTACardio sample data set, which can be downloaded from here: https://slicer.kitware.com/midas3/download/item/292309/CTA-cardio.nrrd

1 Like

It looks like this nrrd uses gzip encoding which isn’t supported in VTK 9.0 (or at least exposed in the current python wheel) which is a shame, I’d like to have a play around with it.

ParaView has a .nrrd reader and it works fine on this data, so you could either borrow PV’s nrrd reading code path for your VTK program, or more easily import it once in a ParaView session and export into .vti to work with in your program.

I’ve uploaded a non-compressed nrrd version here: https://1drv.ms/u/s!Arm_AFxB9yqHxKU-SGibtXFc1atL9w?e=REPXHE

So for some reason VTK 9.0’s NRRD reader doesn’t seem to like this file either, Dave’s suggestion of using ParaView to convert to a vti worked fine so I can always play with that instead. Right now I’ve just used an HSV colormap with a linear opacity transfer function. I’m probably going to have a go at Ospray rendering or at least exporting as a POV file for external raytracing.

I get the following error output when trying to read the revised NRRD file:

2020-11-12 16:14:24.555 (   0.405s) [        2AE9D740]      vtkNrrdReader.cxx:333    ERR| vtkNrrdReader (0x5f9bc00): /home/fraser/Downloads/CTAcardio.nrrd is not a nrrd file.
2020-11-12 16:14:24.555 (   0.405s) [        2AE9D740]       vtkExecutive.cxx:753    ERR| vtkCompositeDataPipeline (0x61212f0): Algorithm vtkNrrdReader(0x5f9bc00) returned failure for request: vtkInformation (0x625d600)
  Debug: Off
  Modified Time: 589566
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_INFORMATION
  ALGORITHM_AFTER_FORWARD: 1
  FORWARD_DIRECTION: 0


2020-11-12 16:14:24.555 (   0.405s) [        2AE9D740]vtkStreamingDemandDrive:846    ERR| vtkCompositeDataPipeline (0x61212f0): No whole extent has been set in the information for output port 0 on algorithm vtkNrrdReader(0x5f9bc00).
2020-11-12 16:14:24.555 (   0.405s) [        2AE9D740]vtkStreamingDemandDrive:846    ERR| vtkCompositeDataPipeline (0x61212f0): No whole extent has been set in the information for output port 0 on algorithm vtkNrrdReader(0x5f9bc00).
vtkNrrdReader (0x5f9bc00)
  Debug: On
  Modified Time: 589513
  Reference Count: 2
  Registered Events: (none)
  Executive: 0x61212f0
  ErrorCode: Success
  Information: 0x61a85e0
  AbortExecute: Off
  Progress: 0
  Progress Text: (None)
  FileName: /home/fraser/Downloads/CTAcardio.nrrd
  FileNames: 0
  FilePrefix: (none)
  FilePattern: %s.%d
  FileNameSliceOffset: 0
  FileNameSliceSpacing: 1
  DataScalarType: unsigned short
  NumberOfScalarComponents: 1
  File Dimensionality: 2
  File Lower Left: Off
  Swap Bytes: Off
  DataIncrements: (1, 1)
  DataExtent: (0, 0, 0, 0, 0, 0)
  DataSpacing: (1, 1, 1)
  DataDirection: (1, 0, 0, 0, 1, 0, 0, 0, 1)
  DataOrigin: (0, 0, 0)
  HeaderSize: 1
  Internal File Name: (none)
  Data Mask: 18446744073709551615
  DataVOI: (0, 0, 0, 0, 0, 0)
  Transform: (none)
  ScalarArrayName: ImageFile
  Encoding: raw
1 Like