contrib/mul/mmn/mmn_order_cost.h
Go to the documentation of this file.
00001 #ifndef mmn_order_cost_h_
00002 #define mmn_order_cost_h_
00003 //:
00004 // \file
00005 // \brief Functions to re-arrange cost data to match index rank
00006 // \author Tim Cootes
00007 
00008 #include <vil/vil_image_view.h>
00009 
00010 //: (i0,i1,i2) gives ordering of v0,v1,v2
00011 //  Each i is {0,1,2}, indicating rank of equivalent v
00012 //  ie if i0=1, then v0 is the middle value
00013 //  if i1=2, then v1 is the largest value
00014 void mmn_get_order(unsigned v0, unsigned v1, unsigned v2,
00015                    unsigned& i0, unsigned& i1, unsigned& i2);
00016 
00017 //: (i0,i1,i2) gives rank of v0,v1,v2
00018 //  I.e. v[i0] is smallest, v[i2] is largest
00019 void mmn_get_rank(unsigned v0, unsigned v1, unsigned v2,
00020                   unsigned& i0, unsigned& i1, unsigned& i2);
00021 
00022 //: Create new view of data, with axes re-arranged
00023 //  \a c(i1,i2,i3) is the value associated with i1 on node v1,
00024 //  i2 on node v2 etc.
00025 //  The i-axis of the returned image is associated with the node
00026 //  min(v1,v2,v3), the j axis with mid(v1,v2,v3) and the k with
00027 //  max(v1,v2,v3)
00028 //  The inverse operation is given by mmn_unorder_cost
00029 vil_image_view<double> mmn_order_cost(const vil_image_view<double>& c,
00030                                       unsigned v1, unsigned v2, unsigned v3);
00031 
00032 //: Make new view of data, with axes re-arranged. Inverse of mmn_order_cost
00033 //  The i-axis of c is associated with the node min(v1,v2,v3), 
00034 //  the j axis with mid(v1,v2,v3) and the k with max(v1,v2,v3)
00035 //  Returns image r, where r(i1,i2,i3) is the value associated 
00036 //  with i1 on node v1, i2 on node v2 etc.
00037 vil_image_view<double> mmn_unorder_cost(const vil_image_view<double>& c,
00038                                         unsigned v1, unsigned v2, unsigned v3);
00039 
00040 #endif // mmn_order_cost_h_