Commit 20c66a20 authored by Ken Martin's avatar Ken Martin
Browse files

BUG: error in reading 3D volumes of data

parent 08969572
...@@ -574,6 +574,7 @@ static void vtkImageReaderUpdate2(vtkImageReader *self, vtkImageData *data, ...@@ -574,6 +574,7 @@ static void vtkImageReaderUpdate2(vtkImageReader *self, vtkImageData *data,
int inExtent[6]; int inExtent[6];
int dataExtent[6]; int dataExtent[6];
int comp, pixelSkip; int comp, pixelSkip;
int filePos, correction;
// Get the requested extents. // Get the requested extents.
data->GetExtent(inExtent); data->GetExtent(inExtent);
...@@ -671,11 +672,23 @@ static void vtkImageReaderUpdate2(vtkImageReader *self, vtkImageData *data, ...@@ -671,11 +672,23 @@ static void vtkImageReaderUpdate2(vtkImageReader *self, vtkImageData *data,
outPtr0 += outIncr[0]; outPtr0 += outIncr[0];
} }
// move to the next row in the file and data // move to the next row in the file and data
self->File->seekg(self->File->tellg() + streamSkip0, ios::beg); filePos = self->File->tellg();
// watch for case where we might rewind too much
// if that happens, store the value in correction and apply later
if (filePos + streamSkip0 >= 0)
{
self->File->seekg(self->File->tellg() + streamSkip0, ios::beg);
correction = 0;
}
else
{
correction = streamSkip0;
}
outPtr1 += outIncr[1]; outPtr1 += outIncr[1];
} }
// move to the next image in the file and data // move to the next image in the file and data
self->File->seekg(self->File->tellg() + streamSkip1, ios::beg); self->File->seekg(self->File->tellg() + streamSkip1 + correction,
ios::beg);
outPtr2 += outIncr[2]; outPtr2 += outIncr[2];
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment