template<class DstArrayT, class SrcArrayT, class NgbT>
Definition at line 25 of file PatNgbOp2d.h. References Impala::Core::Array::CheckBorderSize(), FuncNgbOp2dDispatch(), ILOG_VAR, ILOG_WARNING, Impala::Core::Array::PAR_PART, PatSetBorder(), PxArrayDeletePD(), PxArrayForceNonDistributed(), PxArrayPD(), PxArrayPostStateTrans(), PxArrayPreStateTrans(), PxRunLazyParallel(), PxRunParallel(), STRONG, and WEAK. Referenced by Impala::Samples::Talk::DoTalkNgb2d(), Impala::Core::Histogram::MakeCooccurenceMatrix(), Impala::Core::Array::MakeIntegral(), Impala::Core::Array::Percentile(), and Impala::Core::Array::Watershed(). 00026 { 00027 ILOG_VAR(Impala.Core.Array.Pattern.PatNgbOp2d); 00028 int numX = ngb.Width() / 2; 00029 int numY = ngb.Height() / 2; 00030 SrcArrayT* checkedSrc = CheckBorderSize(src, numX, numY); 00031 if(borderAlreadySet && (checkedSrc != src)) 00032 { 00033 ILOG_WARNING("borderAlreadySet==true, but border too smal... " << 00034 "ignoring border"); 00035 borderAlreadySet = false; 00036 } 00037 00038 /* 00039 if ((dst == 0) || (dst == (DstArrayT*) checkedSrc)) 00040 dst = ArrayClone<DstArrayT>(checkedSrc); 00041 // Above code prevents the user from doing a neighbourhood operation in 00042 // place. Michiel wanted to do just that for making cooccurence matrices for 00043 // lbp features. So for now it is a warning although it is a slightabuse of 00044 // this pattern. 00045 */ 00046 if (dst == 0) 00047 dst = ArrayClone<DstArrayT>(checkedSrc); 00048 if(dst == (DstArrayT*) checkedSrc) 00049 { 00050 static bool didWarning = false; 00051 if(!didWarning) 00052 ILOG_WARNING("You're doing a neighbourhood operation in place. " << 00053 "Is this really what you want?"); 00054 didWarning = true; 00055 } 00056 00057 #ifdef PX_HORUS_USED 00058 if (!PxRunParallel()) { // run sequential 00059 #endif 00060 if(!borderAlreadySet) 00061 PatSetBorder(checkedSrc, numX, numY); 00062 FuncNgbOp2dDispatch(dst, checkedSrc, ngb); 00063 00064 #ifdef PX_HORUS_USED 00065 } else { // run parallel 00066 PxArrayPreStateTrans(checkedSrc, PAR_PART, STRONG); 00067 PxArrayPreStateTrans(dst, PAR_PART, WEAK); 00068 PatSetBorder(PxArrayPD(checkedSrc), numX, numY); 00069 FuncNgbOp2dDispatch(PxArrayPD(dst), 00070 PxArrayPD(checkedSrc), ngb); 00071 if (PxArrayPD(checkedSrc) != PxArrayPD(src)) 00072 PxArrayDeletePD(checkedSrc); 00073 PxArrayPostStateTrans(dst); 00074 00075 if (!PxRunLazyParallel()) { 00076 PxArrayForceNonDistributed(src); 00077 PxArrayForceNonDistributed(dst); 00078 } 00079 } 00080 #endif 00081 00082 if (checkedSrc != src) 00083 delete checkedSrc; 00084 }
Here is the call graph for this function:
|