contrib/mul/vil3d/vil3d_property.h
Go to the documentation of this file.
00001 #ifndef vil3d_property_h_
00002 #define vil3d_property_h_
00003 //:
00004 // \file
00005 //
00006 // There is no class or function called vil3d_property.
00007 //
00008 // The image class vil3d_image_resource has the method :
00009 // \code
00010 //   bool get_property(char const *label, void *property_value = 0) const;
00011 // \endcode
00012 // which allow format extensions to be added without cluttering the
00013 // interface to vil_image_resource. The idea is that properties can be
00014 // identified by a "label" (some name or other textual description)
00015 // through which clients can obtain or manipulate extra properties.
00016 //
00017 // A false return value means that the underlying image does not
00018 // understand the given property or that the given data was invalid.
00019 // A true return value means it does understand the property and has
00020 // used the supplied data according to the relevant protocol.
00021 // Passing a null pointer as the second argument can be useful for
00022 // protocols for manipulating boolean properties (i.e. when there is
00023 // no data to be passed).
00024 //
00025 // To make this work in practice, it is necessary to avoid name clashes
00026 // and to make sure everyone agrees on the meaning of the property data.
00027 // That is the purpose of this file. The set of labels is a namespace in
00028 // the general sense of the word. We only have one namespace, so try
00029 // not to clutter it. All property labels described in this file should
00030 // begin with "vil3d_property_" and that chunk of the namespace is reserved.
00031 //
00032 // An example
00033 // \code
00034 // float vs[3];
00035 // vcl_cout << "Volume of image is ";
00036 // if (image.get_property(vil3d_property_voxel_size, &voxel_size))
00037 //   vcl_cout << vs[0]*vs[1]*vs[2]*im.ni()*im.nj()*im.nk() << vcl_endl;
00038 // else
00039 //   vcl_cout << "unknown\n";
00040 // \endcode
00041 //
00042 // \author Ian Scott - Copied from fsm's design in vil.
00043 
00044 
00045 //: Indicate whether this is an in-memory image or an on-disk image
00046 //  By default an image is not in-memory, and since this is a boolean property
00047 //  the return value of get_property(), which is "false" by default, will be
00048 //  correct.  Only in-memory images must implement this property, and return
00049 //  "true".
00050 #define vil3d_property_memory "memory"
00051 
00052 //: Indicate that you can't call put_view on this image.
00053 //  By default an image is not read-only, and since this is a boolean property
00054 //  the return value of get_property(), which is "false" by default, will be
00055 //  correct.  Only images which do not allow put_view must implement this
00056 //  property, and return "true".
00057 #define vil3d_property_read_only "read-only"
00058 
00059 
00060 //: voxel size in metres.
00061 // Type is float[3].
00062 // If this property exists you may get and set the values
00063 // through the size_i(), and set_pixel_size() members of vil3d_image_resource.
00064 #define vil3d_property_voxel_size "voxel_size"
00065 
00066 //: Original image origin in pixels.
00067 // Measured from vil3d origin in standard direction.
00068 // Type is float[3].
00069 #define vil3d_property_origin_offset "origin_offset"
00070 
00071 #endif // vil3d_property_h_