Hi,<div><br></div><div>I&#39;ve got a set of vtkImageData objects that come from different processors of a parallel simulation, where each object corresponds to a different spatial section of the total dataset. I&#39;m not able to change how the files are generated, and thus don&#39;t think I can use a pvti file. I need to combine these into one imagedata object, but I&#39;m running into problems. The data in the ImageData objects is cell wise constant</div>
<div><br></div><div>I&#39;ve tried using vtkImageAppend, but I keep running into memory errors:</div><div><div>imgs = {}</div><div>for i in range(0, self._nprocs):</div><div>       img = read_vti_file(vti_files[i])</div></div>
<div><div>       origin = img.GetOrigin()</div><div>       imgs[origin] = img</div></div><div><div>keys = imgs.keys()</div><div>keys.sort(key=itemgetter(1, 0))  # sort by y first, then x</div></div><div><br></div><div><div>
img_append = vtk.vtkImageAppend()</div><div>img_append.SetAppendAxis(1)</div><div>for k, g in groupby(keys, lambda x: x[1]):</div><div>    row_img = vtk.vtkImageAppend()</div><div>    row_img.SetAppendAxis(0)</div><div>    for origin in g:</div>
<div>        row_img.AddInput(imgs[origin])</div><div>    row_img.Update()</div><div>    img_append.AddInput(row_img.GetOutput())</div><div>img_append.Update()</div></div><div>img_append.GetOutput()</div><div><br></div><div>
As an alternative method, I&#39;ve tried using vtk.vtkAppendFilter() to join the imagedata objects. This works, but the output is an UnstructuredGrid, which I haven&#39;t been able to convert to an ImageData object. I&#39;ve tried using vtkProbeFilter to do this, but the vtkImageData object returned is interpolated from the UnstructuredGrid, whereas I need the data to be cell wise constant.</div>
<div><br></div><div>Any help combining the imagedata objects, or converting an UnstructuredGrid to an ImageData object would be greatly appreciated.</div><div><br></div><div>Many thanks,</div><div>Matthew</div><div><br></div>