[vtkusers] vtkThresholdTable - VTK 7.0
João Luis
joaolsvieira at gmail.com
Tue Jun 28 12:59:37 EDT 2016
Hello guys,
Any ideas about how to build a vtkThresholdTable with characters (e.g
L,P,C,N) representing MinValue/ MaxValue? I have a python version but in
C++ is returning NULL/empty. Following my code and the *.CSV I am trying to
filter (simulate 3 distinct tables L=line Table; P=plane Table; C=cone
Table)
Thank you very much.
Python
# Set up filters for extracting feature types
self.thresholders = {}
for threshVals in [('line', 'K', 'M'), ('plane', 'O','Q'), ('cone',
'B', 'D')]:
tt = vtkThresholdTable()
tt.SetInputConnection(self.rdr.GetOutputPort())
tt.SetInputArrayToProcess(0, 0, 0,
vtkDataObject.FIELD_ASSOCIATION_ROWS, 'Vector Type')
tt.SetMinValue(vtkVariant(threshVals[1]))
tt.SetMaxValue(vtkVariant(threshVals[2]))
tt.SetMode(vtkThresholdTable.ACCEPT_BETWEEN)
self.thresholders[threshVals[0]] = tt
C++
const char* tnames [] = { "line", "plane", "cone" };
char tminmax [] = { 'K', 'M', 'O', 'Q', 'B', 'D' };
unsigned int numThresh = sizeof(tnames) / sizeof(tnames[0]); // == 3
for (unsigned ti = 0; ti < numThresh; ++ti)
{
thHoldTable = vtkSmartPointer<vtkThresholdTable>::New();
thHoldTable->SetInputConnection(readerStructureData->GetOutputPort
());
thHoldTable->SetInputArrayToProcess(0, 0, 0, vtkDataObject::
FIELD_ASSOCIATION_ROWS, "Vector Type");
thHoldTable->SetMinValue(vtkVariant(tminmax[2*ti]));
thHoldTable->SetMaxValue(vtkVariant(tminmax[2*ti+1]));
thHoldTable->SetMode(vtkThresholdTable::ACCEPT_BETWEEN);
thHoldTable->Update();
thresholders[tnames[ti]] = thHoldTable;
}
*.csv
FElemID
Structural Type
Vector Type
Depth
Easting
Northing
Elevation
SiteID
Borehole_Dip
Borehole_DipDirection
CA
Structure_Dip
Structure_DipDirection
Channel 1
Channel 2
Channel 3
1
Ctt
P
0
0
0
2
FSEX-41
-47
137.2
60
75
1
1
1
1
Ctt
P
0
0
0
0
FSEX-41
-47
137.2
0
0
1
1
1
2
Ctt
L
1
1
1
2
FSEX-42
-46
135.9
0
0
7
1
1
2
Ctt
L
1
1
1
1
FSEX-42
-46
135.9
45
0
7
1
1
2
Ctt
L
1
1
1
0
FSEX-42
-46
135.9
60
45
7
1
1
3
Ctt
C
2
2
0
2
FSEX-47
-45
30
5
1
1
1
3
Ctt
C
2
2
0
1
FSEX-47
-45
30
45
1
1
1
3
Ctt
C
2
2
0
0
FSEX-47
-45
30
85
1
1
1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160628/f6b87c8a/attachment.html>
More information about the vtkusers
mailing list