2013-10-23 196 views
0

我有一个3D矢量字段,我存储在一个vtkImageData对象。所述vtkImageData对象包含两个数组:使用VTK阈值图像数据(vtkImageThreshold)

  1. 一个3成分vtkDoubleArray(矢量x,y和z分量)
  2. 含有一个单独的量

1个部件vtkDoubleArray我想提取两个阵列的相应元素,其中1分量阵列的值位于特定范围内。以下是我所尝试的:

vtkSmartPointer<vtkImageThreshold> threshold = 
     vtkSmartPointer<vtkImageThreshold>::New(); 
threshold->SetInputData(image); 
threshold->SetInputArrayToProcess(1, image->GetInformation()); // 1 is the Energy array index 
threshold->ThresholdBetween(1e-22, 2e-22); 
threshold->Update(); 

vtkSmartPointer<vtkImageData> thresholdedImage = threshold->GetOutput(); 

我也尝试过使用vtkThresholdPoints,但无济于事。任何建议将不胜感激。

回答

0

看起来我可以使用this example

vtkSmartPointer<vtkThresholdPoints> threshold = 
     vtkSmartPointer<vtkThresholdPoints>::New(); 
threshold->SetInputData(image); 
threshold->ThresholdBetween(1e-21, 2e-21); 
threshold->SetInputArrayToProcess(0, 0, 0, 
     vtkDataObject::FIELD_ASSOCIATION_POINTS, "Energy"); 
threshold->Update(); 

vtkSmartPointer<vtkPolyData> thresholded = threshold->GetOutput(); 

我没有意识到,这种方法是适用的,但它看起来是这样。这确实将我的数据类型从vtkImageData更改为vtkPolyData,我几乎不知道vtkThresholdPoints::SetInputArrayToProcess()的参数意味着什么。但是,它似乎在做这项工作。我很乐意听到其他建议!