[Paraview] Data set comparison

Luca.Clementi at tororosso.com Luca.Clementi at tororosso.com
Fri Apr 2 10:14:09 EDT 2010


Dear Berl,
I'm still struggling to compile 3.6.2!
 When I'm done with that I will take a look at the new one.

For the moment I did a programmable filter that return directly the 
difference of the two scalars (find it attached below), I'm still trying 
to validate its results.

Thanks for your help!
Luca

-----------------------------------------------
i0 = self.GetInputDataObject(0,0)
i1 = self.GetInputDataObject(0,1)
o = self.GetOutputDataObject(0)

input0=i0.GetPointData().GetArray("meanTotalPressureMonitor")
input1=i1.GetPointData().GetArray("meanTotalPressureMonitor")

outputData = vtk.vtkDoubleArray()
outputData.SetName("diffTotalPressure")

numCell = i0.GetNumberOfPoints()
for i in range(numCell):
    val = input0.GetValue(i) - input1.GetValue(i)
    outputData.InsertNextValue(val)

o.GetPointData().AddArray(outputData)
-----------------------------------------------

paraview-bounces at paraview.org wrote on 03/31/2010 03:54:02 PM:
> 
> Is there any chance you can compile from source? There is an easy way
> of doing this in 3.8. (There will be an even easier one after 3.8).
> 
> Requirements:
> - ParaView compiled with Python
> - NumPy
> 
> Recipe:
> - Select 2 objects in the pipeline browser
> - Apply Programmable Filter
> - Use a script like the following:
> 
> output.PointData.append(inputs[0].PointData['Normals'] -
> inputs[1].PointData['Normals'], 'difference')
> 
> (replace Normals with whatever array you want to compare).
> 
> Note that you will still need to merge the blocks beforehand if your
> objects are multi-block.
> 
> -berk
> 
> On Wed, Mar 31, 2010 at 6:19 AM,  <Luca.Clementi at tororosso.com> wrote:
> > paraview-bounces at paraview.org wrote on 03/30/2010 07:12:48 PM:
> >>
> >> Unfortunately, you have to copy the array with something like:
> >>
> >> copy_array = original_array.NewInstance()
> >> copy_array.DeepCopy(original_array)
> >> copy_array.SetName("foo")
> >> copy_array.UnRegister(None)
> >>
> >> Having said that there might be a better way of doing this. Are you
> >> planning to use the calculator to compare these arrays later in the
> >> pipeline?
> >>
> >
> > Dear Berk,
> > Yes, I'd like to get the difference of the two arrays.
> > Maybe I should try to do it directly in the programmable filter and 
simply
> > return the result array...
> >
> > Any suggestion is welcome...
> >
> > Thank you very much for your help,
> > Luca
> >
> >
> >
> >> -berk
> >>
> >> On Mon, Mar 29, 2010 at 11:34 AM,  <Luca.Clementi at tororosso.com> 
wrote:
> >> > Dear Berk,
> >> >
> >> > this really helped me a lot, thanks!
> >> >
> >> >
> >> > But now Im stuck with another problem.
> >> >
> >> > The scalar value that I'm trying to compare from the two data sets
> > have the
> >> > same names.
> >> >
> >> >
> >> > meanTotalPressure
> >> >
> >> >
> >> > So when I do the AddArray() in my script the second array simply
> > overrides
> >> > the first one.
> >> >
> >> > http://www.vtk.org/doc/nightly/html/
> >> classvtkFieldData.html#a22259e3c071ac8ff7a62ac49e9f1a92e
> >> >
> >> >
> >> > I tried to change the name with SetName() method, but it changes 
the
> > Array
> >> > name globally, and the second time I run the filter the GetArray
> > returns
> >> > NoneType object.
> >> >
> >> >
> >> > Do I have to copy the object to rename it?
> >> >
> >> >
> >> > Sincerely,
> >> >
> >> > Luca
> >> >
> >> > -----------------------------------
> >> >
> >> > i0 = self.GetInputDataObject(0,0)
> >> > i1 = self.GetInputDataObject(0,1)
> >> > o = self.GetOutputDataObject(0)
> >> > print "the class is: " +
> >> > 
str(i0.GetPointData().GetArray("meanTotalPressureMonitor").__class__)
> >> > array0 = i0.GetPointData().GetArray("meanTotalPressureMonitor")
> >> > array0.SetName("meanTotalPressure0")
> >> > o.GetPointData().AddArray(array0)
> >> > array1 = i1.GetPointData().GetArray("meanTotalPressureMonitor")
> >> > array1.SetName("meanTotalPressure1")
> >> > o.GetPointData().AddArray(array1)
> >> > -----------------------------------
> >> >
> >> >
> >> > Berk Geveci <berk.geveci at kitware.com> wrote on 03/23/2010 08:57:52 
PM:
> >> >>
> >> >> This is because the EnSight reader produces a multi-block dataset.
> > Try
> >> >> applying Merge Blocks filter first.
> >> >>
> >> >> -berk
> >> >>
> >> >> On Mon, Mar 22, 2010 at 1:12 PM,  <Luca.Clementi at tororosso.com>
> > wrote:
> >> >> > Hi all,
> >> >> > Im trying to compare two data sets in Ensight .case format.
> >> >> >
> >> >> > I found only this thread referring to data set comparison:
> >> >> > 
http://www.cmake.org/pipermail/paraview/2008-November/010034.html
> >> >> >
> >> >> > But I could not get it to work. I tried resamply directly the 
two
> >> >> > Ensight
> >> >> > data reader. Then I also tried to filter the two Ensight data
> > readers
> >> >> > through a CellDatatoPointData reader and also through a 
CellCenter
> > (with
> >> >> > vertex cells active), but I always get:
> >> >> > ERROR: In
> >> >> > /home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/
> >> >> ParaView3/VTK/Filtering/vtkDataSet.cxx,
> >> >> > line 406
> >> >> > vtkUnstructuredGrid (0x3a46da0): Point array vtkValidPointMask 
with
> > 1
> >> >> > components, only has 3726 tuples but there are 407364 
pointsERROR:
> > In
> >> >> > /home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/
> >> >> ParaView3/VTK/Filtering/vtkDataSet.cxx,
> >> >> > line 406
> >> >> > vtkUnstructuredGrid (0x67183e0): Point array vtkValidPointMask 
with
> > 1
> >> >> > components, only has 3726 tuples but there are 407364 points
> >> >> >
> >> >> >
> >> >> > ERROR: In
> >> >> > /home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/
> >> >> ParaView3/VTK/Filtering/vtkExecutive.cxx,
> >> >> > line 757
> >> >> > vtkCompositeDataPipeline (0x65c0b20): Algorithm
> >> >> > vtkPVGeometryFilter(0x65bdb80) returned failure for request:
> >> >> > vtkInformation (0x67155a0)
> >> >> >  Debug: Off
> >> >> >  Modified Time: 13672858
> >> >> >  Reference Count: 1
> >> >> >  Registered Events: (none)
> >> >> >  Request: REQUEST_DATA
> >> >> >  FROM_OUTPUT_PORT: 0
> >> >> >  ALGORITHM_AFTER_FORWARD: 1
> >> >> >  FORWARD_DIRECTION: 0
> >> >> >
> >> >> >
> >> >> > I also tried the programmable filter suggested in the previous
> > email,
> >> >> > (using two input file with the same geometry), but in that case 
I
> > always
> >> >> > get:
> >> >> >
> >> >> > paraview version 3.6.2, Date: 2009-05-18
> >> >> >
> >> >> > Traceback (most recent call last):
> >> >> >  File "<string>", line 25, in <module>
> >> >> >  File "<string>", line 5, in RequestData
> >> >> > AttributeError: GetPointData
> >> >> >
> >> >> >
> >> >> > That's the filter Im trying to use:
> >> >> > i0 = self.GetInputDataObject(0,0)
> >> >> > i1 = self.GetInputDataObject(0,1)
> >> >> > o = self.GetOutputDataObject(0)
> >> >> > o.GetPointData().AddArray(i0.GetPointData().GetArray
> >> >> ("meanTotalPressureMonitor"))
> >> >> > o.GetPointData().AddArray(i1.GetPointData().GetArray
> >> >> ("meanTotalPressureMonitor"))
> >> >> >
> >> >> >
> >> >> > Thank you very much for your help!
> >> >> >
> >> >> > Sincerely,
> >> >> > Luca
> >> >> >
> >> >> >
> >> >> >
> >> >
> >> >
> >>
> > 
> 
_________________________________________________________________________________________________________________
> >> > Questo messaggio è da intendersi esclusivamente ad uso del
> > destinatario e
> >> > può contenere informazioni che sono di natura privilegiata,
> > confidenziale
> >> > o non divulgabile secondo le leggi vigenti. Se il lettore del 
presente
> >> > messaggio non è il destinatario designato, o il dipendente/agente
> >> > responsabile
> >> > per la consegna del messaggio al destinatario designato, si informa
> > che ogni
> >> > disseminazione, distribuzione o copiatura di questa comunicazione è
> >> > strettamente proibita anche ai sensi del decreto legislativo 196/03 
.
> > Se
> >> > avete ricevuto questo messaggio per errore, vi preghiamo di
> > notificarcelo
> >> > immediatamente a mezzo e-mail di risposta e successivamente di
> > procedere
> >> > alla cancellazione di questa e-mail e relativi allegati dal vostro
> > sistema.
> >> >
> >>
> > 
> 
_________________________________________________________________________________________________________________
> >> > This message is intended only for the use of the addressee and may
> > contain
> >> > information that is privileged, confidential and exempt from
> >> > disclosure under applicable law. If the reader of this message is 
not
> > the
> >> > intended recipient, or the employee or agent responsible for
> > delivering the
> >> > message to the intended recipient, you are hereby notified that any
> >> > dissemination, distribution or copying of this communication is
> > strictly
> >> > prohibited. If you have received this e-mail in error, please 
notify
> > us
> >> > immediately by return e-mail and delete this e-mail and all
> > attachments from
> >> > your system.
> >> >
> >>
> > 
> 
_________________________________________________________________________________________________________________
> >> >
> >> _______________________________________________
> >> 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
> >
> >
> > 
> 
_________________________________________________________________________________________________________________
> > Questo messaggio è da intendersi esclusivamente ad uso del 
> destinatario e può contenere informazioni che sono di natura 
> privilegiata, confidenziale
> > o non divulgabile secondo le leggi vigenti. Se il lettore del 
> presente messaggio non è il destinatario designato, o il dipendente/
> agente responsabile
> > per la consegna del messaggio al destinatario designato, si 
> informa che ogni disseminazione, distribuzione o copiatura di questa
> comunicazione è
> > strettamente proibita anche ai sensi del decreto legislativo 196/
> 03 . Se avete ricevuto questo messaggio per errore, vi preghiamo di 
> notificarcelo
> > immediatamente a mezzo e-mail di risposta e successivamente di 
> procedere alla cancellazione di questa e-mail e relativi allegati 
> dal vostro sistema.
> > 
> 
_________________________________________________________________________________________________________________
> > This message is intended only for the use of the addressee and may
> contain information that is privileged, confidential and exempt from
> > disclosure under applicable law. If the reader of this message is 
> not the intended recipient, or the employee or agent responsible for
> delivering the
> > message to the intended recipient, you are hereby notified that 
> any dissemination, distribution or copying of this communication is 
strictly
> > prohibited. If you have received this e-mail in error, please 
> notify us immediately by return e-mail and delete this e-mail and 
> all attachments from
> > your system.
> > 
> 
_________________________________________________________________________________________________________________
> >
> _______________________________________________
> 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


_________________________________________________________________________________________________________________
Questo messaggio è da intendersi esclusivamente ad uso del destinatario e può contenere informazioni che sono di natura privilegiata, confidenziale
o non divulgabile secondo le leggi vigenti. Se il lettore del presente messaggio non è il destinatario designato, o il dipendente/agente responsabile
per la consegna del messaggio al destinatario designato, si informa che ogni disseminazione, distribuzione o copiatura di questa comunicazione è 
strettamente proibita anche ai sensi del decreto legislativo 196/03 . Se avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo
immediatamente a mezzo e-mail di risposta e successivamente di procedere alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.
_________________________________________________________________________________________________________________
This message is intended only for the use of the addressee and may contain information that is privileged, confidential and exempt from 
disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the 
message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly 
prohibited. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from 
your system.
_________________________________________________________________________________________________________________


More information about the ParaView mailing list