[ismrmrd] 177/177: tweak to the indexing

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:02:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag v1.1.0.beta.1
in repository ismrmrd.

commit 33b5c7a49a27451389f4c3d3776c0f8a9b41da80
Author: Souheil Inati <souheil.inati at nih.gov>
Date:   Wed Nov 5 13:09:50 2014 -0500

    tweak to the indexing
---
 utilities/ismrmrd_fftw.h | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/utilities/ismrmrd_fftw.h b/utilities/ismrmrd_fftw.h
index 5a8e661..bf783c0 100644
--- a/utilities/ismrmrd_fftw.h
+++ b/utilities/ismrmrd_fftw.h
@@ -37,43 +37,43 @@ int fft2c(NDArray<complex_float_t> &a, bool forward)
 	fftwf_complex* tmp = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*a.getNumberOfElements());
 
 	if (!tmp) {
-		std::cout << "Error allocating temporary storage for FFTW" << std::endl;
-		return -1;
+            std::cout << "Error allocating temporary storage for FFTW" << std::endl;
+            return -1;
 	}
 
 	for (size_t f = 0; f < ffts; f++) {
-		size_t index = f*elements;
-		fftshift(reinterpret_cast<std::complex<float>*>(tmp),&a(index),a.getDims()[0],a.getDims()[1]);
-
-		//Create the FFTW plan
-		fftwf_plan p;
-		if (forward) {
-			p = fftwf_plan_dft_2d(a.getDims()[1], a.getDims()[0], tmp,tmp, FFTW_FORWARD, FFTW_ESTIMATE);
-		} else {
-			p = fftwf_plan_dft_2d(a.getDims()[1], a.getDims()[0], tmp,tmp, FFTW_BACKWARD, FFTW_ESTIMATE);
-		}
-		fftwf_execute(p);
-
-		fftshift(&a(index),reinterpret_cast<std::complex<float>*>(tmp),a.getDims()[0],a.getDims()[1]);
-
-		//Clean up.
-		fftwf_destroy_plan(p);
+
+            fftshift(reinterpret_cast<std::complex<float>*>(tmp),&a(0,0,f),a.getDims()[0],a.getDims()[1]);
+
+            //Create the FFTW plan
+            fftwf_plan p;
+            if (forward) {
+                p = fftwf_plan_dft_2d(a.getDims()[1], a.getDims()[0], tmp,tmp, FFTW_FORWARD, FFTW_ESTIMATE);
+            } else {
+                p = fftwf_plan_dft_2d(a.getDims()[1], a.getDims()[0], tmp,tmp, FFTW_BACKWARD, FFTW_ESTIMATE);
+            }
+            fftwf_execute(p);
+            
+            fftshift(&a(0,0,f),reinterpret_cast<std::complex<float>*>(tmp),a.getDims()[0],a.getDims()[1]);
+            
+            //Clean up.
+            fftwf_destroy_plan(p);
 	}
 
 	std::complex<float> scale(std::sqrt(1.0f*elements),0.0);
         for (size_t n=0; n<a.getNumberOfElements(); n++) {
-            a(n) /= scale;
+            a.getDataPtr()[n] /= scale;
         }
 	fftwf_free(tmp);
 	return 0;
 }
 
 int fft2c(NDArray<complex_float_t> &a) {
-	return fft2c(a,true);
+    return fft2c(a,true);
 }
 
 int ifft2c(NDArray<complex_float_t> &a) {
-	return fft2c(a,false);
+    return fft2c(a,false);
 }
 
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list