Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

kernel-rfpulse.c

Go to the documentation of this file.
00001 /************************************************************************* 00002 * $Id: kernel-rfpulse.c,v 1.5 2005/09/07 07:31:50 yougz Exp $ 00003 ************************************************************************** 00004 This software is governed by the CeCILL license under French law and 00005 abiding by the rules of distribution of free software. You can use, 00006 modify and/ or redistribute the software under the terms of the CeCILL 00007 license as circulated by CEA, CNRS and INRIA at the following URL 00008 "http://www.cecill.info". 00009 00010 As a counterpart to the access to the source code and rights to copy, 00011 modify and redistribute granted by the license, users are provided only 00012 with a limited warranty and the software's author, the holder of the 00013 economic rights, and the successive licensors have only limited 00014 liability. 00015 00016 In this respect, the user's attention is drawn to the risks associated 00017 with loading, using, modifying and/or developing or reproducing the 00018 software by the user in light of its specific status of free software, 00019 that may mean that it is complicated to manipulate, and that also 00020 therefore means that it is reserved for developers and experienced 00021 professionals having in-depth computer knowledge. Users are therefore 00022 encouraged to load and test the software's suitability as regards their 00023 requirements in conditions enabling the security of their systems and/or 00024 data to be ensured and, more generally, to use and operate it in the 00025 same conditions as regards security. 00026 00027 The fact that you are presently reading this means that you have had 00028 knowledge of the CeCILL license and that you accept its terms. 00029 00030 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00031 l'Image). All rights reserved. See License.txt for details. 00032 00033 Version 1.0 05/09/2005 00034 *************************************************************************/ 00035 #include "kernel-rfpulse.h" 00036 00045 void KernelPulse(EXPERIENCE3D * expr, EVENT * event) 00046 { 00047 double w1, x, y, z, dw,edw, alpha, beta, delta, sb, cb, sd, cd; 00048 double antx, anty, antz, p1, p2, p3, p5, p6, p9; 00049 double r1x, r2x, tau; 00050 double r1y, r2y, r1z, r2z; 00051 int ix, iy, iz, it, n; 00052 int xmin; 00053 int xmax; 00054 00055 #ifdef HAVE_MPI 00056 if (expr->mpi_slice_x0 == -1) { 00057 xmin = 0; 00058 xmax = expr->nfovx; 00059 } else { 00060 xmin=expr->mpi_slice_x0; 00061 xmax=xmin+mpi_get_slice_width(expr, xmin); 00062 } 00063 #else 00064 xmin = 0; 00065 xmax = expr->nfovx; 00066 #endif 00067 00068 00069 if (event->pulse_duration && event->ang) { 00070 r1x = G * event->agx; 00071 r2x = expr->xf + expr->obx - event->agxoff; 00072 r1y = G * event->agy; 00073 r2y = expr->yf + expr->oby - event->agyoff; 00074 r1z = G * event->agz; 00075 r2z = expr->zf + expr->obz - event->agzoff; 00076 00077 00078 n = 1; 00079 alpha = event->ang; 00080 tau = event->pulse_duration; 00081 w1 = alpha / tau; 00082 00083 for (it = 0; it < n; it++) 00084 for (ix = xmin; ix < xmax; ix++) 00085 for (iy = expr->nfovy - 1; iy >= 0; iy--) 00086 for (iz = expr->nfovz - 1; iz >= 0; iz--) { 00087 antx = expr->magstate[0][ix][iy][iz]; 00088 anty = expr->magstate[1][ix][iy][iz]; 00089 antz = expr->magstate[2][ix][iy][iz]; 00090 x = expr->px * ix - r2x; 00091 y = expr->py * iy - r2y; 00092 z = expr->pz * iz - r2z; 00093 // dw = (r1x * x) + (r1y * y) + (r1z * z) -expr->G_edw + G_rad_T*expr->G_deche[ix][iy][iz]; 00094 if (expr->FLAG_RESONANCE==ON) 00095 { /* pulse angle are considered not afected by resonance frequency shift */ 00096 dw = G_rad_T*(event->agx*x + event->agy*y + event->agz*z); 00097 } 00098 else 00099 { /* pulse angle are affected by resonance frequency shift */ 00100 edw = expr->G_edw *(expr->B0+1.*(event->agx*x + event->agy*y + event->agz*z) + expr->G_deche[ix][iy][iz]); 00101 dw = G_rad_T*(event->agx*x + event->agy*y + event->agz*z + expr->G_deche[ix][iy][iz]) - edw; 00102 } 00103 00104 beta = -atan2(dw, w1); 00105 delta = -tau * sqrt(dw * dw + w1 * w1); 00106 sb = sin(beta); 00107 cb = cos(beta); 00108 sd = sin(delta); 00109 cd = cos(delta); 00110 00111 p5 = cd--; /* p5=cd, cd = cd-1 */ 00112 p1 = 1 + sb * sb * cd; 00113 p2 = sb * sd; 00114 p3 = cb * sb * cd; 00115 p6 = -cb * sd; 00116 p9 = 1 + cb * cb * cd; 00117 expr->magstate[0][ix][iy][iz] = 00118 p1 * antx + p2 * anty + p3 * antz; 00119 expr->magstate[1][ix][iy][iz] = 00120 -p2 * antx + p5 * anty + p6 * antz; 00121 expr->magstate[2][ix][iy][iz] = 00122 p3 * antx - p6 * anty + p9 * antz; 00123 } 00124 /* T2* effect management*/ 00125 expr->to = expr->to + tau; 00126 if (alpha > M_PI/2) expr->to =expr->to * -1; 00127 } 00128 }

Generated on Wed Oct 19 09:28:34 2005 for SIMRI3D by doxygen 1.3.7