[Paraview] compare two datasets in paraview

Eric E. Monson emonson at cs.duke.edu
Thu Jan 28 09:41:10 EST 2010


Hey again,

There may be other ways, too, but you can do this with the Python Programmable Filter (PPF). To have two inputs to the PPF you need to select both data sets in the pipeline (on mac it's command-click, others may be control-click...) and then apply the filter. Here is a sample script which subtracts the coordinates of the two data sets from each other and makes a new vector data attribute out of that difference:

# ===========
from paraview.vtk import vtkFloatArray

in0 = self.GetInputDataObject(0,0)
in1 = self.GetInputDataObject(0,1)
pti0 = in0.GetPoints()
pti1 = in1.GetPoints()
numPts = in0.GetNumberOfPoints()

vec = vtkFloatArray()
vec.SetName('coordDiff')
vec.SetNumberOfComponents(3)
vec.SetNumberOfTuples(numPts)

for ii in range(numPts):
	# compute velocity and put in vec
	tmpDiff = [0.0, 0.0, 0.0]
	pos1 = pti1.GetPoint(ii)
	pos0 = pti0.GetPoint(ii)
	for kk in range(len(tmpDiff)):
		tmpDiff[kk] = pos1[kk] - pos0[kk]
	vec.SetTuple3(ii,tmpDiff[0],tmpDiff[1],tmpDiff[2])

out1 = self.GetOutputDataObject(0)
out1.ShallowCopy(in0)
out1.GetPointData().AddArray(vec)
# ===========

This doesn't do any checking for matching IDs of the points or whether both sets have the same number of points (I have an extended script which searches for points with matching ID if you need help doing that), but if they really match it will work. (Others can let you know if there are better ways of doing this or if I've done anything "non-standard" in my script.)

Good luck,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Jan 28, 2010, at 7:10 AM, Kalpana Kanthasamy wrote:

> hi
>  
> me again, how do I compare the co-ordinates of two datasets in paraview.. I have two dataset..of the same set of points but their cordinates differ slightly. I need the number of these co-ordinates
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list