Write to vtkImageData using parallel threads

Hello,
I am working in C# and I am currently using setScalarComponentFromDouble function of vtkImageData to set values to ImageData grid. This function is not thread-safe. I have also tried getting image pointer through ImageData.GetScalarPointer() and then setting value to this pointer which is also not thread-safe. Is it possible to populate vtkImageData using parallel code?

Thank you,
Janhavi

Yes of course, in C++ we use threading all the time to populate images. So it should be doable, although I haven’t coded in C# for years.

Have you tried (and this is incorrect C# code but hopefully it will provide hints): 1) use img.AllocateScalars(int dataType, int numComponents); then 2) obtaining the data array arr=img.GetPointData().GetScalars(); finally use some variant of SetTuple (e.g., arr.SetTuple1(id,value)) to populate the image data?