Use of Parallel.ForEach or Parallel.For for ActiViz data parallelism
This post has NOT been accepted by the mailing list yet.
I am trying to test whether or not it is possible to achieve multithreading simply by using Parallel.ForEach statement on VTK pipeline.
Just to test-out whether or not it is or not, I have created the class that takes-in vtkImageData and adds an arbitrary constant to the vtkImageData using vtkImageMathematics:
public void add_constant(vtkImageData dose3D, double constant)
vtkImageMathematics dose_addC = vtkImageMathematics.New();
Then I'm trying to add different constants in parallel by using parallel.foreach:
Parallel.ForEach(numbers, (current_number, pls, index) =>
vtkcalculation calc = new vtkcalculation();
I would totally have given-up the idea, thinking it is too simple-minded... only it "sometimes" works. For the times that it does not work, I get the same exception at vtkImageMathmatics constructor line: "error: table already has a non-null entry at mteIndex"
Is it possible to implement Parallel.ForEach or Parallel.For statements with VTK or would I have to resort to multithreading classes in VTK? If latter is the case, would anyone know how to implement those for this case?