Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

ExportMinMaxPos.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_ExportMinMaxPos_h
00002 #define Impala_Core_Array_Trait_ExportMinMaxPos_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Element/E0SmallVal2.h"
00006 #include "Core/Array/Element/E0LargeVal.h"
00007 #include "Core/Geometry/PointZ.h"
00008 
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Array
00014 {
00015 namespace Trait
00016 {
00017 
00018 
00019 template<class ArithT, class DataT>
00020 class ExportMinMaxPos
00021 {
00022 public:
00023     typedef Pattern::TagPixOpOut       DirectionCategory;
00024     typedef Pattern::TagTransVar       TransVarianceCategory;
00025     typedef Pattern::Tag1Phase         PhaseCategory;
00026 
00027     ExportMinMaxPos()
00028     {
00029         Reset();
00030     }
00031 
00032     void DoIt(const ArithT& v, int x, int y)
00033     {
00034         if(v<mMinVal)
00035         {
00036             mMinVal = v;
00037             mMinPos.mX = x;
00038             mMinPos.mY = y;
00039         }
00040         else
00041             if(v>mMaxVal)
00042             {
00043                 mMaxVal = v;
00044                 mMaxPos.mX = x;
00045                 mMaxPos.mY = y;
00046             }
00047     }
00048 
00049     void DoIt(const Vec3Real64& v, int x, int y)
00050     {
00051         int i;
00052         for(i=1 ; i<=3 ; i++)
00053         {
00054             if(v.getValue(i) < mMinVal)
00055             {
00056                 mMinVal = v.getValue(i);
00057                 mMinPos.mX = x;
00058                 mMinPos.mY = y;
00059             }
00060             else
00061                 if(v.getValue(i) > mMaxVal)
00062                 {
00063                     mMaxVal = v.getValue(i);
00064                     mMaxPos.mX = x;
00065                     mMaxPos.mY = y;
00066                 }
00067         }
00068     }
00069 
00070     void Reset()
00071     {
00072         mMinVal = Element::E0LargeVal<ArithT>(ArithT());
00073         mMaxVal = Element::E0SmallVal2<ArithT>(ArithT());
00074     }
00075 
00076 //private:
00077     ArithT mMinVal;
00078     ArithT mMaxVal;
00079     Geometry::PointZ mMinPos;
00080     Geometry::PointZ mMaxPos;
00081 };
00082 
00083 } // namespace Trait
00084 } // namespace Array
00085 } // namespace Core
00086 } // namespace Impala
00087 
00088 #endif

Generated on Fri Mar 19 09:30:56 2010 for ImpalaSrc by  doxygen 1.5.1