static void LoadAndTransformImage( GenericImage<P>& transform, const GenericImage<P1>& image, bool parallel, int maxProcessors ) { Rect r = image.SelectedRectangle(); if ( !r.IsRect() ) return; int w = FFTC::OptimizedLength( r.Width() ); int h = FFTC::OptimizedLength( r.Height() ); int dw2 = (w - r.Width()) >> 1; int dh2 = (h - r.Height()) >> 1; transform.AllocateData( w, h, image.NumberOfSelectedChannels(), (image.NumberOfSelectedChannels() < 3 || image.FirstSelectedChannel() != 0) ? ColorSpace::Gray : image.ColorSpace() ); transform.Zero().Move( image, Point( dw2, dh2 ) ); ApplyInPlaceFourierTransform( transform, FFTDirection::Forward, parallel, maxProcessors ); }