public D getDerivative(boolean... isX) {
		if( derivatives == null ) {
			declareTree(isX.length);
		} else if( isX.length > stale.length ) {
			growTree(isX.length);
		}

		int index = 0;
		int prevIndex = 0;
		for( int level = 0; level < isX.length; level++ ) {
			index |= isX[level] ? 0 : 1 << level;

			if( stale[level][index] ) {
				stale[level][index] = false;
				derivatives[level][index].reshape(inputImage.getWidth(),inputImage.getHeight());

				if( level == 0 ) {
					if( isX[level]) {
						derivX.process(inputImage,derivatives[level][index]);
					} else {
						derivY.process(inputImage,derivatives[level][index]);
					}
				} else {
					D prev = derivatives[level-1][prevIndex];
					if( isX[level]) {
						derivDerivX.process(prev,derivatives[level][index]);
					} else {
						derivDerivY.process(prev,derivatives[level][index]);
					}
				}
			}
			prevIndex = index;
		}

		return derivatives[isX.length-1][index];
	}
public D getDerivative ( boolean ... isX ) { if ( derivatives == null ) { declareTree ( isX . length ) ; } else if ( isX . length > stale . length ) { growTree ( isX . length ) ; } int index = 0 ; int prevIndex = 0 ; for ( int level = 0 ; level < isX . length ; level ++ ) { index |= isX [ level ] ? 0 : 1 << level ; if ( stale [ level ] [ index ] ) { stale [ level ] [ index ] = false ; derivatives [ level ] [ index ] . reshape ( inputImage . getWidth ( ) , inputImage . getHeight ( ) ) ; if ( level == 0 ) { if ( isX [ level ] ) { derivX . process ( inputImage , derivatives [ level ] [ index ] ) ; } else { derivY . process ( inputImage , derivatives [ level ] [ index ] ) ; } } else { D prev = derivatives [ level - 1 ] [ prevIndex ] ; if ( isX [ level ] ) { derivDerivX . process ( prev , derivatives [ level ] [ index ] ) ; } else { derivDerivY . process ( prev , derivatives [ level ] [ index ] ) ; } } } prevIndex = index ; } return derivatives [ isX . length - 1 ] [ index ] ; }
Computes derivative images using previously computed lower level derivatives.  Only
computes/declares images as needed.