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

#include "mrilib.h"

Go to the source code of this file.


Functions

MRI_IMAGEmri_transpose_float (MRI_IMAGE *im)
MRI_IMAGEmri_transpose_short (MRI_IMAGE *im)
MRI_IMAGEmri_transpose_byte (MRI_IMAGE *im)
MRI_IMAGEmri_transpose_int (MRI_IMAGE *im)
MRI_IMAGEmri_transpose_complex (MRI_IMAGE *im)
MRI_IMAGEmri_transpose_rgbyte (MRI_IMAGE *im)
MRI_IMAGEmri_transpose (MRI_IMAGE *im)

Function Documentation

MRI_IMAGE* mri_transpose MRI_IMAGE   im
 

Definition at line 150 of file mri_transpose.c.

References MRI_IMAGE::kind, mri_transpose_byte(), mri_transpose_complex(), mri_transpose_float(), mri_transpose_int(), mri_transpose_rgbyte(), and mri_transpose_short().

Referenced by GRA_refwrite_choose_CB(), main(), mri_read_1D(), mri_read_ascii(), mri_write_1D(), read_sxyz_1D(), sdata_from_1D(), THD_load_1D(), THD_open_1D(), and UC_read_opts().

00151 {
00152    if( im == NULL ) return NULL ;
00153 
00154    switch( im->kind ){
00155       case MRI_float  : return mri_transpose_float  (im) ;
00156       case MRI_short  : return mri_transpose_short  (im) ;
00157       case MRI_byte   : return mri_transpose_byte   (im) ;
00158       case MRI_int    : return mri_transpose_int    (im) ;
00159       case MRI_complex: return mri_transpose_complex(im) ;
00160       case MRI_rgb:     return mri_transpose_rgbyte (im) ;
00161    }
00162    return NULL ;
00163 }

MRI_IMAGE* mri_transpose_byte MRI_IMAGE   im
 

Definition at line 57 of file mri_transpose.c.

References ENTRY, MRI_IMAGE::kind, MRI_BYTE_PTR, MRI_COPY_AUX, mri_new(), MRI_IMAGE::nx, MRI_IMAGE::ny, and RETURN.

Referenced by mri_transpose().

00058 {
00059    MRI_IMAGE * om ;
00060    byte * iar , * oar ;
00061    int ii,jj,nx,ny ;
00062 
00063 ENTRY("mri_transpose_byte") ;
00064 
00065    if( im == NULL || im->kind != MRI_byte ) RETURN(NULL) ;
00066 
00067    nx  = im->nx ; ny = im->ny ;
00068    om  = mri_new( ny , nx , MRI_byte ) ;
00069    iar = MRI_BYTE_PTR(im) ;
00070    oar = MRI_BYTE_PTR(om) ;
00071 
00072    for( jj=0 ; jj < ny ; jj++ )
00073       for( ii=0 ; ii < nx ; ii++ )
00074          oar[jj+ii*ny] = iar[ii+jj*nx] ;
00075 
00076    MRI_COPY_AUX(om,im) ;
00077    RETURN(om) ;
00078 }

MRI_IMAGE* mri_transpose_complex MRI_IMAGE   im
 

Definition at line 103 of file mri_transpose.c.

References ENTRY, MRI_IMAGE::kind, MRI_COMPLEX_PTR, MRI_COPY_AUX, mri_new(), MRI_IMAGE::nx, MRI_IMAGE::ny, and RETURN.

Referenced by mri_transpose().

00104 {
00105    MRI_IMAGE * om ;
00106    complex * iar , * oar ;
00107    int ii,jj,nx,ny ;
00108 
00109 ENTRY("mri_transpose_complex") ;
00110 
00111    if( im == NULL || im->kind != MRI_complex ) RETURN(NULL) ;
00112 
00113    nx  = im->nx ; ny = im->ny ;
00114    om  = mri_new( ny , nx , MRI_complex ) ;
00115    iar = MRI_COMPLEX_PTR(im) ;
00116    oar = MRI_COMPLEX_PTR(om) ;
00117 
00118    for( jj=0 ; jj < ny ; jj++ )
00119       for( ii=0 ; ii < nx ; ii++ )
00120          oar[jj+ii*ny] = iar[ii+jj*nx] ;
00121 
00122    MRI_COPY_AUX(om,im) ;
00123    RETURN(om) ;
00124 }

MRI_IMAGE* mri_transpose_float MRI_IMAGE   im
 

Only for 2D images *

Definition at line 11 of file mri_transpose.c.

References ENTRY, MRI_IMAGE::kind, MRI_COPY_AUX, MRI_FLOAT_PTR, mri_new(), MRI_IMAGE::nx, MRI_IMAGE::ny, and RETURN.

Referenced by mri_transpose().

00012 {
00013    MRI_IMAGE * om ;
00014    float * iar , * oar ;
00015    int ii,jj,nx,ny ;
00016 
00017 ENTRY("mri_transpose_float") ;
00018 
00019    if( im == NULL || im->kind != MRI_float ) RETURN(NULL) ;
00020 
00021    nx  = im->nx ; ny = im->ny ;
00022    om  = mri_new( ny , nx , MRI_float ) ;
00023    iar = MRI_FLOAT_PTR(im) ;
00024    oar = MRI_FLOAT_PTR(om) ;
00025 
00026    for( jj=0 ; jj < ny ; jj++ )
00027       for( ii=0 ; ii < nx ; ii++ )
00028          oar[jj+ii*ny] = iar[ii+jj*nx] ;
00029 
00030    MRI_COPY_AUX(om,im) ;
00031    RETURN(om) ;
00032 }

MRI_IMAGE* mri_transpose_int MRI_IMAGE   im
 

Definition at line 80 of file mri_transpose.c.

References ENTRY, MRI_IMAGE::kind, MRI_COPY_AUX, MRI_INT_PTR, mri_new(), MRI_IMAGE::nx, MRI_IMAGE::ny, and RETURN.

Referenced by mri_transpose().

00081 {
00082    MRI_IMAGE * om ;
00083    int * iar , * oar ;
00084    int ii,jj,nx,ny ;
00085 
00086 ENTRY("mri_transpose_int") ;
00087 
00088    if( im == NULL || im->kind != MRI_int ) RETURN(NULL) ;
00089 
00090    nx  = im->nx ; ny = im->ny ;
00091    om  = mri_new( ny , nx , MRI_int ) ;
00092    iar = MRI_INT_PTR(im) ;
00093    oar = MRI_INT_PTR(om) ;
00094 
00095    for( jj=0 ; jj < ny ; jj++ )
00096       for( ii=0 ; ii < nx ; ii++ )
00097          oar[jj+ii*ny] = iar[ii+jj*nx] ;
00098 
00099    MRI_COPY_AUX(om,im) ;
00100    RETURN(om) ;
00101 }

MRI_IMAGE* mri_transpose_rgbyte MRI_IMAGE   im
 

Definition at line 126 of file mri_transpose.c.

References ENTRY, MRI_IMAGE::kind, MRI_COPY_AUX, mri_new(), MRI_RGB_PTR, MRI_IMAGE::nx, MRI_IMAGE::ny, and RETURN.

Referenced by mri_transpose().

00127 {
00128    MRI_IMAGE * om ;
00129    rgbyte * iar , * oar ;
00130    int ii,jj,nx,ny ;
00131 
00132 ENTRY("mri_transpose_rgbyte") ;
00133 
00134    if( im == NULL || im->kind != MRI_rgb ) RETURN(NULL) ;
00135 
00136    nx  = im->nx ; ny = im->ny ;
00137    om  = mri_new( ny , nx , MRI_rgb ) ;
00138    iar = (rgbyte *) MRI_RGB_PTR(im) ;
00139    oar = (rgbyte *) MRI_RGB_PTR(om) ;
00140 
00141    for( jj=0 ; jj < ny ; jj++ )
00142       for( ii=0 ; ii < nx ; ii++ )
00143          oar[jj+ii*ny] = iar[ii+jj*nx] ;
00144 
00145    MRI_COPY_AUX(om,im) ;
00146    RETURN(om) ;
00147 }

MRI_IMAGE* mri_transpose_short MRI_IMAGE   im
 

Definition at line 34 of file mri_transpose.c.

References ENTRY, MRI_IMAGE::kind, MRI_COPY_AUX, mri_new(), MRI_SHORT_PTR, MRI_IMAGE::nx, MRI_IMAGE::ny, and RETURN.

Referenced by mri_transpose().

00035 {
00036    MRI_IMAGE * om ;
00037    short * iar , * oar ;
00038    int ii,jj,nx,ny ;
00039 
00040 ENTRY("mri_transpose_short") ;
00041 
00042    if( im == NULL || im->kind != MRI_short ) RETURN(NULL) ;
00043 
00044    nx  = im->nx ; ny = im->ny ;
00045    om  = mri_new( ny , nx , MRI_short ) ;
00046    iar = MRI_SHORT_PTR(im) ;
00047    oar = MRI_SHORT_PTR(om) ;
00048 
00049    for( jj=0 ; jj < ny ; jj++ )
00050       for( ii=0 ; ii < nx ; ii++ )
00051          oar[jj+ii*ny] = iar[ii+jj*nx] ;
00052 
00053    MRI_COPY_AUX(om,im) ;
00054    RETURN(om) ;
00055 }
 

Powered by Plone

This site conforms to the following standards: