void	WindowAdapterTest::testWindowAdapter() {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "window adapter test");
	// create an image
	Image<unsigned char>	image(16, 16);
	for (unsigned int x = 0; x < 16; x++) {
		for (unsigned int y = 0; y < 16; y++) {
			image.pixel(x, y) = x * y;
		}
	}

	// create the subframe
	ImageRectangle	frame(ImagePoint(4, 4), ImageSize(8, 8));
	debug(LOG_DEBUG, DEBUG_LOG, 0, "frame: %s", frame.toString().c_str());

	// create an adapter for a subframe
	WindowAdapter<unsigned char>	adapter(image, frame);

	// access the subframe
	ImageSize	size = adapter.getSize();
	debug(LOG_DEBUG, DEBUG_LOG, 0, "adapter size: %s",
		size.toString().c_str());
	for (int x = 0; x < size.width(); x++) {
		for (int y = 0; y < size.height(); y++) {
			unsigned char	value = adapter.pixel(x, y);
			unsigned char	v
				= (frame.origin().x() + x) * (frame.origin().y() + y);
			if (v != value) {
				debug(LOG_DEBUG, DEBUG_LOG, 0, "expected %d != %d found",
					(int)v, (int)value);
			}
			CPPUNIT_ASSERT(value == v);
		}
	}
	debug(LOG_DEBUG, DEBUG_LOG, 0, "window adapter test complete");
}
/**
 * \brief Compute size of the complex fourier transform image
 *
 * We are using the real data DFTs from the fftw3 library, which uses a layout
 * different from what you would expect from our image types. When going 
 * through a pixel array In our image types, the quickly increasing
 * coordinate is the horizontal coordinate, which we usually call the
 * x coordinate, and which is also the first coordinate. In FFTW3, the slowly
 * increasing coordinate when going through the FFT array is the second
 * coordinate. So if an image has width w and height h, then we have
 * treat it as a data array with n0 = h and n1 = w. The corresponding
 * fourier transform array for the real data transforms then has dimensions
 * n0 and (n1/2 + 1). But since again the second coordinate is the one that
 * increases quickly, we have to create an image of width (n1/2 + 1) and
 * height n0.
 *
 * All this is unimportant as long as we don't look at the fourier transform
 * as an image in its own right. Only then does it become important how we
 * interpret the coordinates.
 *
 * \param size	size of the image to be fourier transformed
 */
ImageSize	FourierImage::fsize(const ImageSize& size) {
	int	w = size.width();
	int	h = size.height();
	int	n0 = h;
	int	n1 = w;
	ImageSize	result(2 * (1 + n1 / 2), n0);
	debug(LOG_DEBUG, DEBUG_LOG, 0, "fourier image size %s -> %s",
		size.toString().c_str(), result.toString().c_str());
	return result;
}