[vtkusers] Beginner question Max counts in image

David Doria daviddoria at gmail.com
Fri Jan 7 13:02:34 EST 2011


On Fri, Jan 7, 2011 at 12:45 PM, Emma Saunders
<emmasaunders123 at gmail.com> wrote:
> Hi all,
>
> I am having what I should imaginge is a very simple problem.  I would simply
> like to read the maximum intensity in an image.  I have obtained the array
> data (inarray) of the scalars from the image and am attempting to use:
>
> double range[2]
>
> inarray->Getrange(range,-1) as I was under the impression this gave the
> magnitude of the tuples in an array.  This however returns 0,500.  Which is
> not the limits on a histoggram of the same image.
>
> I would ideally like to use the GetDataTypeValueMin() function but this is
> not present  in the header files I have with VTK 5.2 or 5.4.
>
> Any suggestions to help a begineer are appreciated.
>
> Thanks
>
> Happy New Year
>
> Emma

I agree, it doesn't work as I would expect. In this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/ArrayRange

at the end I have called

  ints->GetValueRange(valuesRange, -1);

on an array with values:

  ints->InsertNextValue(-50);
  ints->InsertNextValue(15);
  ints->InsertNextValue(25);

The documentation says it takes the L2 norm of the values before
finding the min/max, so I would expect the output to be

15, 50 (or maybe 15, -50)

Instead, the output is (-50, 25), just as if -1 had not been passed.

Are we missing something?

David



More information about the vtkusers mailing list