00001 #ifndef Impala_Core_Array_Pattern_PatSetBorder_h
00002 #define Impala_Core_Array_Pattern_PatSetBorder_h
00003
00004 #include "Core/Array/Pattern/BorderType.h"
00005 #include "Core/Array/Pattern/FuncBorderOp.h"
00006
00007 #ifdef PX_HORUS_USED
00008 #include "Core/Array/Pattern/PxFuncBorderOp.h"
00009 #endif
00010
00011 namespace Impala
00012 {
00013 namespace Core
00014 {
00015 namespace Array
00016 {
00017 namespace Pattern
00018 {
00019
00020
00029
00030 template<class ArrayT>
00031 inline void
00032 PatSetBorder(ArrayT* a, int numX, int numY,
00033 BorderType borderType = BORDERMIRROR)
00034 {
00035 switch (borderType) {
00036
00037 case BORDERMIRROR :
00038 #ifdef PX_HORUS_USED
00039 if (!PxRunParallel()) {
00040 #endif
00041 FuncBorderMirror2d(a, numX, numY);
00042
00043 #ifdef PX_HORUS_USED
00044 } else {
00045 PxFuncBorderMirror2d(a, numX, numY);
00046 }
00047 #endif
00048 break;
00049
00050 case BORDERPROPAGATE :
00051 #ifdef PX_HORUS_USED
00052 if (!PxRunParallel()) {
00053 #endif
00054
00055 FuncBorderPropagateNormalized2d(a, numX, numY, 1,1,1,1);
00056
00057 #ifdef PX_HORUS_USED
00058 } else {
00059 PxFuncBorderPropagateNormalized2d(a, numX, numY, 1,1,1,1);
00060 }
00061 #endif
00062 break;
00063 }
00064 }
00065
00066
00067
00068 template<class ArrayT, class ValT>
00069 void
00070 PatSetBorder(ArrayT* a, int numX, int numY,
00071 BorderType borderType, ValT borderValue,
00072 ValT leftBorderNorm, ValT rightBorderNorm,
00073 ValT topBorderNorm, ValT bottomBorderNorm)
00074 {
00075 switch (borderType) {
00076
00077 case BORDERCONSTANT :
00078 #ifdef PX_HORUS_USED
00079 if (!PxRunParallel()) {
00080 #endif
00081 FuncBorderConstant2d(a, numX, numY, borderValue);
00082
00083 #ifdef PX_HORUS_USED
00084 } else {
00085 PxFuncBorderConstant2d(a, numX, numY, borderValue);
00086 }
00087 #endif
00088 break;
00089
00090 case BORDERPROPAGATENORMALIZED :
00091 #ifdef PX_HORUS_USED
00092 if (!PxRunParallel()) {
00093 #endif
00094 FuncBorderPropagateNormalized2d(a, numX, numY,
00095 leftBorderNorm, rightBorderNorm,
00096 topBorderNorm, bottomBorderNorm);
00097
00098 #ifdef PX_HORUS_USED
00099 } else {
00100 PxFuncBorderPropagateNormalized2d(a, numX, numY,
00101 leftBorderNorm, rightBorderNorm,
00102 topBorderNorm, bottomBorderNorm);
00103 }
00104 #endif
00105 break;
00106 }
00107 }
00108
00109 }
00110 }
00111 }
00112 }
00113
00114 #endif