[vtkusers] vtkBandedPolyDataContourFilter tolerance issues
Matt Sutton
matt.sutton at padtinc.com
Thu Oct 18 12:35:46 EDT 2012
Hello,
I'm experiencing what appears to be tolerance issues with the vtkBandedPolyDataContourFilter (for now vBPDCF) perhaps in conjunction with a lookup table that I have not been able to successfully resolve. I'm using VTK 5.10, and I'm looking for any guidance as to how best to proceed. The problem is as follows. The vBPDCF successfully contours my data set and produces isolines where I would expect it to produce them. However, for some inputs, the band colors on opposite sides of in isoline are the same color. I'm guessing here, but it seems to be a rounding issue, but I haven't been able to successfully resolve. Originally, I was instructing the vBPDCF to set the scalar mode to values and then I used a common lookup table between a ScalarBarActor and the output of the filter. I then change the vBPDCF to output index values and created a separate lookuptable that had the same number of table values as my original table, but the range of the lookup table was from 0 to numBands-1. I then used this lookup table with the indexed output for the polydata. This seemed to fix things for a while; however, the same problem has returned. I'm still getting bands on opposite sides of a contour line mapped to the same color.
Looking through the code for the vBPDCF, I see that there is a ClipTolerance that is a function of the input scalar range. It also appears that the InsertCell function takes this into account. Here is the code for that function:
inline int vtkBandedPolyDataContourFilter::InsertCell(vtkCellArray *cells,
int npts, vtkIdType *pts,
int cellId, double s,
vtkFloatArray *newS)
{
int idx = this->ComputeScalarIndex(s+this->ClipTolerance);
if ( !this->Clipping ||
(idx >= this->ClipIndex[0] && idx < this->ClipIndex[1]) )
{
cells->InsertNextCell(npts,pts);
if ( this->ScalarMode == VTK_SCALAR_MODE_INDEX )
{
newS->InsertTuple1(cellId++,idx);
}
else
{
newS->InsertTuple1(cellId++,this->ClipValues[idx]);
}
}
return cellId;
}
It looks like the ComputeScalarIndex is nudging the value by clip tolerance? Is there a more robust way to accomplish this?
Thanks,
Matt
We Bring Dimension To Your Ideas
Matthew Sutton
Lead Engineer, Software Development
Specialist Engineer
Phoenix Analysis & Design Technologies
7755 S. Research Dr, Suite 110
Tempe, AZ 85284
matt.sutton at padtinc.com
480-813-4884 x106 W
480-326-7940 M
480-813-4807 F
Simulation - Product Development - Rapid Prototyping
www.PADTINC.com
CONFIDENTIALITY NOTICE: This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Unless you are the intended recipient, you are hereby notified that copying, forwarding, printing or otherwise disseminating the information contained in or attached to this e-mail is strictly prohibited. If you are not the intended recipient, please notify the sender by telephone, and immediately and permanently delete and destroy all copies and printouts of this e-mail message and/or attachments.
More information about the vtkusers
mailing list