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

#include "mrilib.h"

Go to the source code of this file.


Data Structures

struct  fourbytes
struct  twobytes

Functions

int mri_short_order (void)
int mri_int_order (void)
void mri_swap2 (int n, short *ar)
void mri_swap4 (int n, int *ar)

Function Documentation

int mri_int_order void   
 

Definition at line 25 of file mri_order.c.

00026 {
00027    union { unsigned char bb[4] ;
00028            int           ii ; } fred ;
00029 
00030    fred.bb[0] = 1 ; fred.bb[1] = fred.bb[2] = fred.bb[3] = 0 ;
00031 
00032    return (fred.ii == 1) ? LSB_FIRST : MSB_FIRST ;
00033 }

int mri_short_order void   
 

Definition at line 13 of file mri_order.c.

Referenced by adwarp_refashion_dataset(), AFNI_refashion_dataset(), main(), r_fill_resampled_data_brick(), THD_copy_dset_subs(), THD_dataset_info(), THD_fetch_dataset(), THD_force_malloc_type(), THD_get_write_order(), THD_init_one_datablock(), THD_load_analyze(), THD_load_ctfmri(), THD_load_ctfsam(), THD_load_datablock(), THD_open_analyze(), THD_open_ctfmri(), THD_open_ctfsam(), and THD_write_datablock().

00014 {
00015    union { unsigned char bb[2] ;
00016            short         ss    ; } fred ;
00017 
00018    fred.bb[0] = 1 ; fred.bb[1] = 0 ;
00019 
00020    return (fred.ss == 1) ? LSB_FIRST : MSB_FIRST ;
00021 }

void mri_swap2 int    n,
short *    ar
 

Definition at line 39 of file mri_order.c.

References twobytes::a, twobytes::b, and tt.

Referenced by adwarp_refashion_dataset(), AFNI_refashion_dataset(), main(), RT_read_image(), THD_fetch_dataset(), THD_load_analyze(), THD_load_ctfmri(), THD_load_datablock(), and THD_write_datablock().

00040 {
00041    register int ii ;
00042    register twobytes * tb = (twobytes *) ar ;
00043    register unsigned char tt ;
00044 
00045    for( ii=0 ; ii < n ; ii++ ){
00046       tt       = tb[ii].a ;
00047       tb[ii].a = tb[ii].b ;
00048       tb[ii].b = tt ;
00049    }
00050    return ;
00051 }

void mri_swap4 int    n,
int *    ar
 

Definition at line 57 of file mri_order.c.

References fourbytes::a, fourbytes::b, fourbytes::c, fourbytes::d, and tt.

Referenced by adwarp_refashion_dataset(), AFNI_refashion_dataset(), main(), RT_read_image(), THD_fetch_dataset(), THD_load_analyze(), THD_load_datablock(), and THD_write_datablock().

00058 {
00059    register int ii ;
00060    register fourbytes * tb = (fourbytes *) ar ;
00061    register unsigned char tt , uu ;
00062 
00063    for( ii=0 ; ii < n ; ii++ ){
00064       tt       = tb[ii].a ;
00065       tb[ii].a = tb[ii].d ;
00066       tb[ii].d = tt ;
00067 
00068       uu       = tb[ii].b ;
00069       tb[ii].b = tb[ii].c ;
00070       tb[ii].c = uu ;
00071    }
00072    return ;
00073 }
 

Powered by Plone

This site conforms to the following standards: