Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

mri_float_func.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006 
00007 #include "mrilib.h"
00008 
00009 /*** NOT 7D SAFE ***/
00010 
00011 /*** Makes a 2D image that is a given function of (x,y) ***/
00012 
00013 MRI_IMAGE * mri_float_func( int   nx    , int   ny ,
00014                             float xzero , float yzero ,
00015                             float dx    , float dy ,
00016                             float (* func)( float , float ) )
00017 {
00018    int ii , jj , jpos ;
00019    float yy ;
00020    MRI_IMAGE * im ;
00021    float *     flim ;
00022 
00023    im   = mri_new( nx ,ny , MRI_float ) ;
00024    flim = mri_data_pointer( im ) ;
00025 
00026    for( jj=0 ; jj < ny ; jj++ ){
00027       jpos = nx * jj ;
00028       yy   = yzero + jj * dy ;
00029       for( ii=0 ; ii < nx ; ii++ ){
00030          flim[ii+jpos] = func( xzero + ii*dx , yy ) ;
00031       }
00032    }
00033 
00034    return im ;
00035 }
 

Powered by Plone

This site conforms to the following standards: