MantisBT - VTK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0007213 | VTK | (No Category) | public | 2008-06-19 15:32 | 2014-10-02 11:52 |
Reporter | David Feng | ||||
Assigned To | Cory Quammen | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | OS Version | |||
Product Version | |||||
Target Version | Fixed in Version | 5.10.0 | |||
Project | |||||
Type | |||||
Summary | 0007213: vtkImageData interpolation on XZ and YZ images | ||||
Description | After creating an image of dimensions (x,1,z), where x and y are integers larger than 1, interpolation via vtkProbeFilter began behaving incorrectly. Specifically, interpolating the points (0,0,0) and (0,0,10) would return the same value. I found two bugs responsible for this behavior, both in the FindCell(...) function in vtkImageData.cxx: 1 - The cell indexing code assumes that the dimensions will be used in order (use XY instead of XZ). When a dimension is of size 1, the code assumes that there are zero cells/voxels in that direction. This is incorrect -- there is always at least one cell/voxel in each dimension. The computed indices for out-of-order dimensions are therefore incorrect, ignoring upper dimensions. To fix this, I simply check if any dimension is of size 1 and increment it before the cell index is computed. This should not affect in-order images, as the upper dimensions of their pixel indices are all zero. 2 - The interpolation weights assume that the dimensions will be used in order. They need to be shifted down to accommodate missing dimensions. This shifting is a bit tricky. It can be done in two passes. First, check the y dimension -- if it of size 1, shift all even-indexed blocks of weights to the front of the weights array. Second, check the x dimension -- if it is of size 1, shift all even-indexed weights to the front of the array. The z dimension can be ignored, as it clearly already works properly. I have included the patch in the additional information section of this report. | ||||
Steps To Reproduce | |||||
Additional Information | Index: vtkImageData.cxx =================================================================== RCS file: /cvsroot/VTK/VTK/Filtering/vtkImageData.cxx,v retrieving revision 1.31 diff -u -r1.31 vtkImageData.cxx --- vtkImageData.cxx 24 Mar 2008 20:52:47 -0000 1.31 +++ vtkImageData.cxx 19 Jun 2008 19:09:54 -0000 @@ -767,6 +767,34 @@ this->Voxel->InterpolateFunctions(pcoords,weights); // + // Dimensions are used for cell indexing later. if a dimension has only one + // voxel, we need to make sure it still has one cell. Also, + // the coordinate weights need to be shifted to ignore that dimension. + // This is ugly. The order of these ifs makes a difference. + // + + // + // is y trivial? if so, keep all even blocks of two weights + // + if (dims[1] == 1) + { + dims[1] = 2; + weights[2] = weights[4]; + weights[3] = weights[5]; + } + + // + // is x trivial? if so, keep all even indexed weights + // + if (dims[0] == 1) + { + dims[0] = 2; + weights[1] = weights[2]; + weights[2] = weights[4]; + weights[3] = weights[6]; + } + + // // From this location get the cell id // subId = 0; | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2008-06-19 15:32 | David Feng | New Issue | |||
2008-06-20 10:30 | David Feng | Note Added: 0012440 | |||
2008-06-20 10:35 | David Feng | Note Added: 0012441 | |||
2008-06-20 10:40 | David Feng | Note Added: 0012442 | |||
2008-06-20 11:44 | David Feng | Note Added: 0012446 | |||
2011-02-26 10:33 | David Gobbi | Assigned To | => David Gobbi | ||
2011-02-26 10:33 | David Gobbi | Status | backlog => tabled | ||
2011-06-16 13:11 | Zack Galbreath | Category | => (No Category) | ||
2014-10-02 11:27 | Cory Quammen | Assigned To | David Gobbi => Cory Quammen | ||
2014-10-02 11:51 | Cory Quammen | Note Added: 0033472 | |||
2014-10-02 11:52 | Cory Quammen | Status | backlog => closed | ||
2014-10-02 11:52 | Cory Quammen | Resolution | open => fixed | ||
2014-10-02 11:52 | Cory Quammen | Fixed in Version | => 5.10.0 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|