[vtk-developers] isnan

Berk Geveci berk.geveci at kitware.com
Sat Jan 13 10:56:03 EST 2007


> I've got a dataset that uses NaN as a data value to indicate invalid pixels. A couple of places in VTK, such as vtkDataArray's GetRange() are fooled by this value.  A small test for NaN pixels would fix this problem, and native isnan() and std::isnan() don't seem to introduce significant preformance hits.

Can you elaborate on what you mean by "significant performance hit"?
Getting the range of an array is something that is done very often and
is probably one of the bottlenecks in a few applications. I wouldn't
want to impact that too much to support NaN. Too much is a little
vague, of course. I would say 20% is too much, 5% is acceptable.

Another concern I have with introducing this support is that it is one
of those things that would really require changes to a lot of VTK.
Unless you have the resource to make a sweeping change and put a long
term plan in place, I would stick with "VTK does not support NaN".
Otherwise, users will expect it to work (because they saw that filter
X handles it) and get in trouble in unexpected places. I am currently
having a similar problem with the blanking support that was added to
structured and uniform grids. It will take me years more to bring the
blanking support to an acceptable level. Maybe you could write a
filter that would replace NaNs with some "invalid value"? I know it is
a hack...

-berk



More information about the vtk-developers mailing list