我想要計算圖像的FFT,讀取圖像,ITK SmartPointer被稱爲「imagen」。 用於計算FFT的函數(fftw_plan_dft_r2c_2d)的輸入需要一個2D double *指針作爲輸入。正因爲如此我這樣做:用於計算FFT的2D雙*指針中的圖像的像素值FFT_2D
double *in = (double*) imagen.GetPointer(); // conversión de itk.smartpointer --> double*.
但是,當我嘗試訪問該圖像的像素值,它們並未定義 的「形象」的pixeltype是雙:
typedef double PixelType;
typedef itk::Image < PixelType, 2> ImageType;
ImageType::Pointer imagen;
而圖像是從框架trhoug讀取使用Qt的用戶界面:
imagen=ui.imageframe->imagereader;
任何人都可以幫助我嗎?我需要在2D double *指針中計算fft的圖像值。
乾杯和感謝您的幫助先進!
安東尼奧·戈麥斯巴爾克羅
EDITED
我已經解決了我的問題,是貼在下面,但現在的問題是將結果轉換爲一個二維矩陣,而不知道它的第二個維度,直到執行時間,因爲圖像是在執行期間加載的,而不是在編譯期間,任何提示?謝謝!
SOLUTION
double *in;
ImageType::IndexType pixelIndex;
ImageType::PixelType pixelValue;
for (int x = 0; x<ancho; x++){
for (int y = 0; y<alto; y++){
pixelIndex[0] = x; //x position
pixelIndex[1] = y; //y position
ImageType::PixelType pixel2 = imagen->GetPixel(pixelIndex);
*(in+x*ancho+y) = static_cast <double> (imagen->GetPixel(pixelIndex));
}
}