core/vil/vil_na.h
Go to the documentation of this file.
00001 // This is core/vil/vil_na.h
00002 #ifndef vil_na_h_
00003 #define vil_na_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 
00008 //:
00009 // \file
00010 // \brief NA (Not Available) is a particular double NaN to represent missing data.
00011 // For example, where a vnl_vector<double> represents a series of samples from an image,
00012 // NA could be used to represent places where the measurement was taken outside the image.
00013 //
00014 // NA is distinct for the two other standard meanings of NaN - Indeterminate and Error.
00015 // It is entirely up to each algorithm to treat NA values meaningfully. Unless
00016 // a function's interpretation of NA is explicitly documented, you should assume that
00017 // it will be treated similarly to every other NaN.
00018 // The IEEE754 bit value used to represent NA in double-precision is 0x7ff00000000007a2, the
00019 // same as used by Octave and R. Initial values of NA are stored as signalling NaNs, but
00020 // many uses will convert this to the non-signalling variant 0x7ff80000000007a2. vil_na_isna()
00021 // will accept either variant.
00022 //
00023 // The single precision NA is stored as 0x7f8007a2. I cannot find any external support for
00024 // this or any other value for single precision NA. There is no automatic conversion between
00025 // the NA values during casting, promotion, etc. If you want to convert a float to double,
00026 // whilst preserving the NA-ness of the value, you will have to test for and set the new NA
00027 // value explicitly.
00028 //
00029 // This file is a cut-and-paste of the essential sections of vnl_na, since vil is not
00030 // allowed to depend upon vnl
00031 
00032 
00033 
00034 
00035 //: qNaN to indicate value Not Available.
00036 // Don't assume that any VXL functions will do something sensible in the face of NA, unless
00037 // explicitly documented.
00038 double   vil_na(double dummy);
00039 
00040 //: qNaN to indicate value Not Available.
00041 // Don't assume that any VXL functions will do something sensible in the face of NA, unless
00042 // explicitly documented.
00043 float   vil_na(float dummy);
00044 
00045 //: True if parameter is specific NA qNaN.
00046 // Tests for bit pattern 0x7ff00000000007a2, as used by Octave and R
00047 bool vil_na_isna(double);
00048 
00049 //: True if parameter is specific NA qNaN.
00050 // Tests for bit pattern 0x7f8007a2
00051 bool vil_na_isna(float);
00052 
00053 
00054 #endif // vil_na_h_