[vtkusers] Double error check in vtkImageData?

Elvis Stansvik elvis.stansvik at orexplore.com
Thu Aug 31 03:00:13 EDT 2017


I wouldn't call it a mistake, just regular defensive programming. Neither
function is documented as doing any bounds checking, so I would say that
the author of GetScalarPointer was right in checking the args, if the
intention was for that function to provide checking as an undocumented
perk, as the checking done by GetArrayPointer is not part of its contract.

Whether it should be changed for performance reasons I'll leave to the
heavyweights on this list :)

Elvis


Den 31 aug. 2017 6:54 fm skrev "Andaharoo" <Andx_roo at live.com>:

In vtkImageData, GetScalarPointer(x, y, z) error checks by checking if the
coordinates are in the bounds of the image. It then calls
GetArrayPointer(int[]) which error checks again (with identical code) which
finally returns the results.

What's the reason for this? Is this a mistake? Seems to me the first error
check is not needed.



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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 VTK FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170831/9f1ab9af/attachment.html>


More information about the vtkusers mailing list