1 /*****************************************************************************
2 Major portions of this software are copyrighted by the Medical College
3 of Wisconsin, 1994-2000, and are released under the Gnu General Public
4 License, Version 2. See the file README.Copyright for details.
5 ******************************************************************************/
6
7 #include "mrilib.h"
8
9 /*** NOT 7D SAFE ***/
10
11 /*** Makes a 2D image that is a given function of (x,y) ***/
12
mri_float_func(int nx,int ny,float xzero,float yzero,float dx,float dy,float (* func)(float,float))13 MRI_IMAGE * mri_float_func( int nx , int ny ,
14 float xzero , float yzero ,
15 float dx , float dy ,
16 float (* func)( float , float ) )
17 {
18 int ii , jj , jpos ;
19 float yy ;
20 MRI_IMAGE * im ;
21 float * flim ;
22
23 im = mri_new( nx ,ny , MRI_float ) ;
24 flim = mri_data_pointer( im ) ;
25
26 for( jj=0 ; jj < ny ; jj++ ){
27 jpos = nx * jj ;
28 yy = yzero + jj * dy ;
29 for( ii=0 ; ii < nx ; ii++ ){
30 flim[ii+jpos] = func( xzero + ii*dx , yy ) ;
31 }
32 }
33
34 return im ;
35 }
36