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_scale.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Functions

void mri_scale_inplace (float fac, MRI_IMAGE *im)

Function Documentation

void mri_scale_inplace float   ,
MRI_IMAGE  
 

27 Nov 2001: mri_scale.c *

Definition at line 7 of file mri_scale.c.

References ENTRY, complex::i, MRI_IMAGE::kind, mri_data_pointer(), MRI_IMAGE::nvox, and complex::r.

Referenced by mri_read3D_analyze75(), and mri_read_analyze75().

00008 {
00009    register int ii , nvox ;
00010    void *vp ;
00011 
00012 ENTRY("mri_scale_inplace") ;
00013 
00014    if( im == NULL || fac == 1.0 || fac == 0.0 ) EXRETURN ;
00015    vp = mri_data_pointer( im ) ; if( vp == NULL ) EXRETURN ;
00016    nvox = im->nvox ;
00017 
00018    switch( im->kind ){
00019 
00020       case MRI_byte:{
00021          byte *pp = (byte *) vp ;
00022          for( ii=0 ; ii < nvox ; ii++ ) pp[ii] *= fac ;
00023       }
00024       break ;
00025 
00026       case MRI_short:{
00027          short *pp = (short *) vp ;
00028          for( ii=0 ; ii < nvox ; ii++ ) pp[ii] *= fac ;
00029       }
00030       break ;
00031 
00032       case MRI_float:{
00033          float *pp = (float *) vp ;
00034          for( ii=0 ; ii < nvox ; ii++ ) pp[ii] *= fac ;
00035       }
00036       break ;
00037 
00038       case MRI_int:{
00039          int *pp = (int *) vp ;
00040          for( ii=0 ; ii < nvox ; ii++ ) pp[ii] *= fac ;
00041       }
00042       break ;
00043 
00044       case MRI_double:{
00045          double *pp = (double *) vp ;
00046          for( ii=0 ; ii < nvox ; ii++ ) pp[ii] *= fac ;
00047       }
00048       break ;
00049 
00050       case MRI_complex:{
00051          complex *pp = (complex  *) vp ;
00052          for( ii=0 ; ii < nvox ; ii++ ){
00053            pp[ii].r *= fac; pp[ii].i *= fac;
00054          }
00055       }
00056       break ;
00057 
00058       case MRI_rgb:{
00059          byte *pp = (byte *) vp ;
00060          nvox *= 3 ;
00061          for( ii=0 ; ii < nvox ; ii++ ) pp[ii] *= fac ;
00062       }
00063       break ;
00064    }
00065 
00066    EXRETURN ;
00067 }
 

Powered by Plone

This site conforms to the following standards: