Index: VolumeRendering/vtkVolumeTextureMapper2D.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/VolumeRendering/vtkVolumeTextureMapper2D.cxx,v
retrieving revision 1.2
diff -u -3 -p -r1.2 vtkVolumeTextureMapper2D.cxx
--- VolumeRendering/vtkVolumeTextureMapper2D.cxx	7 Jun 2005 18:32:06 -0000	1.2
+++ VolumeRendering/vtkVolumeTextureMapper2D.cxx	23 Dec 2005 14:59:35 -0000
@@ -63,7 +63,8 @@ void vtkVolumeTextureMapper2D_TraverseVo
   int              flag[3], tmpFlag, index;
   int              clipLow = 0, clipHigh = 0;
   vtkRenderWindow  *renWin = me->GetRenderWindow();
-  double           spacing[3], origin[3];
+  double           spacing[3], inputOrigin[3], origin[3];
+  int              inputExtent[6];
   unsigned char    zero[4];
   unsigned char    *texture;
   int              textureSize[2];
@@ -156,7 +157,15 @@ void vtkVolumeTextureMapper2D_TraverseVo
   // We need to know the spacing and origin of the data to set up the coordinates
   // correctly
   me->GetDataSpacing( spacing );
-  me->GetDataOrigin( origin );
+  me->GetDataOrigin( inputOrigin );
+  me->GetInput()->GetExtent( inputExtent );
+
+  // Compute the origin of the extent the volume origin is at voxel (0,0,0)
+  // but we want to consider (0,0,0) in voxels to be at
+  // (inputExtent[0], inputExtent[2], inputExtent[4]).
+  origin[0] = inputOrigin[0] + inputExtent[0]*spacing[0];
+  origin[1] = inputOrigin[1] + inputExtent[2]*spacing[1];
+  origin[2] = inputOrigin[2] + inputExtent[4]*spacing[2];
 
   // What is the first plane, the increment to move to the next plane, and the plane 
   // that is just past the end?
@@ -507,7 +516,8 @@ void vtkVolumeTextureMapper2D::RenderSav
   unsigned char    *tptr;
   float            *v, *t;
   vtkRenderWindow  *renWin = this->GetRenderWindow();
-  double           spacing[3], origin[3];
+  double           spacing[3], inputOrigin[3], origin[3];
+  int              inputExtent[6];  
   unsigned char    *texture;
   int              textureSize[2];
   int              xTile, yTile, xTotal, yTotal, tile, numTiles;
@@ -614,7 +624,16 @@ void vtkVolumeTextureMapper2D::RenderSav
   // We need to know the spacing and origin of the data to set up the coordinates
   // correctly
   this->GetDataSpacing( spacing );
-  this->GetDataOrigin( origin );
+  this->GetDataOrigin( inputOrigin );
+  this->GetInput()->GetExtent( inputExtent );
+
+  // Compute the origin of the extent the volume origin is at voxel (0,0,0)
+  // but we want to consider (0,0,0) in voxels to be at
+  // (inputExtent[0], inputExtent[2], inputExtent[4]).
+  origin[0] = inputOrigin[0] + inputExtent[0]*spacing[0];
+  origin[1] = inputOrigin[1] + inputExtent[2]*spacing[1];
+  origin[2] = inputOrigin[2] + inputExtent[4]*spacing[2];
+
 
   // What is the first plane, the increment to move to the next plane, and the plane 
   // that is just past the end?
@@ -963,7 +982,25 @@ void vtkVolumeTextureMapper2D::Initializ
     vtkTransform *volumeTransform = vtkTransform::New();
     
     volumeTransform->Identity();
-    volumeTransform->Translate(this->GetInput()->GetOrigin());
+
+    double inputOrigin[3];
+    this->GetInput()->GetOrigin(inputOrigin);
+
+    double inputSpacing[3];
+    this->GetInput()->GetSpacing(inputSpacing);
+
+    int inputExtent[6];
+    this->GetInput()->GetExtent(inputExtent);
+
+    // Compute the origin of the extent the volume origin is at voxel (0,0,0)
+    // but we want to consider (0,0,0) in voxels to be at
+    // (inputExtent[0], inputExtent[2], inputExtent[4]).
+    double extentOrigin[3];
+    extentOrigin[0] = inputOrigin[0] + inputExtent[0]*inputSpacing[0];
+    extentOrigin[1] = inputOrigin[1] + inputExtent[2]*inputSpacing[1];
+    extentOrigin[2] = inputOrigin[2] + inputExtent[4]*inputSpacing[2];
+
+    volumeTransform->Translate(extentOrigin);
     
     // Now concatenate the volume's matrix with this scalar data matrix
     worldToVolumeTransform->PreMultiply();
