factored out the common code needed for IntegralSlidingWindowTransform