[vtkusers] How to get the IDs of min and max from a GetRange() ?
cory.quammen at kitware.com
Tue Jul 7 17:39:55 EDT 2015
You can use the LookupValue() member function, e.g.,
// Assuming vtkScalars is a subclass of vtkDataArray
minIndex = vtkScalars.LookupValue(minValue)
maxIndex = vtkScalars.LookupValue(maxValue)
This will do the scanning David mentioned and return (probably) the first
index that matches the value you are querying.
There is even a variant that puts all the IDs with the query value in a
Hope that helps,
On Tue, Jul 7, 2015 at 3:35 PM, David Cole via vtkusers <vtkusers at vtk.org>
> 0 0 1 2 8 9 10 9 0 0 0 9 10 9 8 6 4 3 0 0
> What's the index of 10?
> You'll have to scan looking for the first or last index, I think,
> since, in general, the min and max may occur any number of times in a
> data set.
> David C.
> On Tue, Jul 7, 2015 at 4:30 PM, mightos <mightos at gmail.com> wrote:
> > Hello
> > Let's say I have a vtkScalars with 100000 values.
> > I would like to know the minimum and maximum values and their position in
> > the vtkScalars.
> > I currently use vtkScalars.GetRange() to get the minimum value and
> > vtkScalars.GetRange() for the maximum. However, I was wondering how I
> > could get the indexes from that.
> > Any help is welcome :)
> > --
> > View this message in context:
> > Sent from the VTK - Users mailing list archive at Nabble.com.
> > _______________________________________________
> > Powered by www.kitware.com
> > Visit other Kitware open-source projects at
> > Please keep messages on-topic and check the VTK FAQ at:
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers