View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000169VTK(No Category)public2003-09-02 15:062016-08-12 09:54
ReporterNicholas Schwarz 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000169: Problem with raycasting and stereo
DescriptionWhen raycasting image data into a stereo enabled render window the stereo pairs are reversed, i.e. the left and right eye images are swapped.
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0000605)
Mathieu Malaterre (developer)
2004-02-02 16:48

When raycasting image data (using VTK 4.2) into a stereo enabled render window the stereo pairs are reversed, i.e. the left and right eye images are swapped. When rendering polygonal data in a stereo enabled render window the stereo pairs are correct.

A partial fix is achieved by setting the camera's eye angle to a negative value. This will only work when exclusively using VTK's ray casting methods. Using this partial fix, if a ray casted image is intermixed with polygonal objects (or anything else in VTK that properly generates stereo pairs) the pair generated with ray casting is correct while the pair generated from the polygonal objets is reversed.

The following C++ example demonstrates this bug:

/******************************************************************************
 * Program: RayCatBug - A little VTK program that demonstrates reversed
 * stereo paris when ray casting.
 * Author: Nicholas Schwarz, schwarz@evl.uic.edu
 * (Taken mostly from VTK examples)
 * Language: C++
 * Date: Date: 2003/08/22
 *****************************************************************************/

#include <vtk/vtkColorTransferFunction.h>
#include <vtk/vtkPiecewiseFunction.h>
#include <vtk/vtkRenderer.h>
#include <vtk/vtkRenderWindow.h>
#include <vtk/vtkRenderWindowInteractor.h>
#include <vtk/vtkStructuredPointsReader.h>
#include <vtk/vtkVolume.h>
#include <vtk/vtkVolumeProperty.h>
#include <vtk/vtkVolumeRayCastCompositeFunction.h>
#include <vtk/vtkVolumeRayCastMapper.h>

int main(int argc, char** argv) {
  
  vtkStructuredPointsReader* reader = vtkStructuredPointsReader::New();
  reader -> SetFileName("$VTK_DATA_ROOT/Data/ironProt.vtk");
  
  vtkColorTransferFunction* color = vtkColorTransferFunction::New();
  color -> AddRGBPoint(0.0, 0.0, 1.0, 1.0);
  color -> AddRGBPoint(64.0, 1.0, 0.0, 0.0);
  color -> AddRGBPoint(128.0, 0.0, 0.0, 1.0);
  color -> AddRGBPoint(192.0, 0.0, 1.0, 0.0);
  color -> AddRGBPoint(255.0, 0.0, 0.2, 0.0);
  
  vtkPiecewiseFunction* opacity = vtkPiecewiseFunction::New();
  opacity -> AddPoint(20, 0.0);
  opacity -> AddPoint(255, 0.2);
  
  vtkVolumeProperty* property = vtkVolumeProperty::New();
  property -> SetColor(color);
  property -> SetScalarOpacity(opacity);
  property -> ShadeOn();
  property -> SetInterpolationTypeToLinear();
  
  vtkVolumeRayCastCompositeFunction* composite = vtkVolumeRayCastCompositeFunction::New();
  composite -> SetCompositeMethodToInterpolateFirst();
  
  vtkVolumeRayCastMapper* mapper = vtkVolumeRayCastMapper::New();
  mapper -> SetVolumeRayCastFunction(composite);
  mapper -> SetInput((vtkImageData*)reader -> GetOutput());
  
  vtkVolume* volume = vtkVolume::New();
  volume -> SetMapper(mapper);
  volume -> SetProperty(property);
  
  vtkRenderer* ren = vtkRenderer::New();
  ren -> AddVolume(volume);
  
  vtkRenderWindow* renWin = vtkRenderWindow::New();
  renWin -> StereoCapableWindowOn();
  renWin -> StereoRenderOn();
  renWin -> SetStereoTypeToCrystalEyes();
  renWin -> SetSize(600, 600);
  renWin -> AddRenderer(ren);
  
  vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
  iren -> SetRenderWindow(renWin);
  iren -> Initialize();
  iren -> Start();
  
  iren -> Delete();
  renWin -> Delete();
  ren -> Delete();
  volume -> Delete();
  mapper -> Delete();
  composite -> Delete();
  property -> Delete();
  opacity -> Delete();
  color -> Delete();
  reader -> Delete();
  
  return 0;
  
}

(0000994)
System Admin (reporter)
2004-04-28 13:13

I think this is fixed, but Ken is the person who did it....
(0003567)
Ken Martin (developer)
2006-01-13 15:17

Lisa is merging changes to fix this issue
(0003643)
Lisa Avila (developer)
2006-01-31 11:16

Moved the fix from a branch of VTK (where it was fixed years ago) onto the main tree. Tested ray casting and is working correctly for red/blue stereo.
(0008200)

2007-07-28 08:10
edited on: 2007-08-08 14:51

removing spam message from this note.

(0036697)
Kitware Robot (administrator)
2016-08-12 09:54

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2007-08-08 14:51 Luis Ibanez Assigned To Sylvain Jaume =>
2007-08-08 14:51 Luis Ibanez Summary Goodsite => Problem with raycasting and stereo
2007-08-08 14:51 Luis Ibanez Note Edited: 0008200
2007-08-08 14:51 Luis Ibanez Project @10@ => VTK
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2016-08-12 09:54 Kitware Robot Note Added: 0036697
2016-08-12 09:54 Kitware Robot Status expired => closed
2016-08-12 09:54 Kitware Robot Resolution no change required => moved
2016-08-12 09:54 Kitware Robot Assigned To => Kitware Robot


Copyright © 2000 - 2018 MantisBT Team