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

#include "mrilib.h"

Go to the source code of this file.


Functions

MRI_IMAGEmri_new (int nx, int ny, MRI_TYPE kind)
MRI_IMAGEmri_new_vol_empty (int nx, int ny, int nz, MRI_TYPE kind)
MRI_IMAGEmri_new_vol (int nx, int ny, int nz, MRI_TYPE kind)
MRI_IMAGEmri_new_7D_generic (int nx, int ny, int nz, int nt, int nu, int nv, int nw, MRI_TYPE kind, int make_space)

Function Documentation

MRI_IMAGE* mri_new int    nx,
int    ny,
MRI_TYPE    kind
 

Definition at line 13 of file mri_new.c.

References mri_new_7D_generic().

Referenced by AB_interp(), AFNI_dataset_slice(), AFNI_func_overlay(), AFNI_overlay(), AREN_render(), copy_bitvector(), CREN_render(), DSETN_func(), DT_read_opts(), FD_brick_to_mri(), FD_brick_to_series(), get_dfile_params(), GRA_doshift(), HISTO_main(), ISQ_make_bar(), ISQ_make_image(), ISQ_make_montage(), ISQ_process_mri(), ISQ_snapsave(), main(), MCW_pbar_to_mri(), MREN_render(), mri_2dalign_setup(), mri_aff2d_byte(), mri_aff2d_rgb(), mri_affine_bicubic(), mri_align_crao(), mri_align_dfspace(), mri_cat2D(), mri_colorsetup(), mri_cut_2D(), mri_dup2D(), mri_dup2D_rgb2(), mri_dup2D_rgb3(), mri_dup2D_rgb4(), mri_dup2D_rgb_NN(), mri_expand_2D(), mri_fft2D(), mri_flatten(), mri_flippo(), mri_float_func(), mri_inflate_pbm(), mri_nsize(), mri_psinv(), mri_read(), mri_read_1D(), mri_read_3A(), mri_read_3D(), mri_read_analyze75(), mri_read_ascii_ragged(), mri_read_dicom(), mri_read_ge4(), mri_read_ppm(), mri_read_ppm3(), mri_read_siemens(), mri_read_stuff(), mri_resize_NN(), mri_rota(), mri_rota_bilinear(), mri_sharpen(), mri_shift2D_bilinear(), mri_shift_1D(), mri_sobel(), mri_stat_seq(), mri_to_complex_ext(), mri_transpose_byte(), mri_transpose_complex(), mri_transpose_float(), mri_transpose_int(), mri_transpose_rgbyte(), mri_transpose_short(), mri_try_mri(), mri_try_pgm(), mri_warp3D_align_fitim(), mri_warp_bicubic(), mri_warp_bilinear(), mri_zeropad_2D(), new_bitvector(), PBAR_bigexpose_CB(), PH_fakeim(), plot_graphs(), PLOT_matrix_gray(), project_byte_mip(), read_input_data(), REG_command_line(), RIC_ToCardiacPhase(), RIC_ToRespPhase(), RT_process_data(), SPLASH_decodexx(), THD_average_timeseries(), THD_extract_many_series(), THD_extract_series(), THD_orient_guess(), ts_to_ftime(), TSGEN_main(), TTget_ppm(), and VOLREG_main().

00014 {
00015    MRI_IMAGE *newim ;
00016 
00017    newim = mri_new_7D_generic( nx,ny , 1,1,1,1,1 , kind , TRUE ) ;
00018    return newim ;
00019 }

MRI_IMAGE* mri_new_7D_generic int    nx,
int    ny,
int    nz,
int    nt,
int    nu,
int    nv,
int    nw,
MRI_TYPE    kind,
int    make_space
 

Definition at line 41 of file mri_new.c.

References MRI_DATA::byte_data, calloc, MRI_DATA::complex_data, MRI_DATA::double_data, MRI_IMAGE::dt, MRI_IMAGE::du, MRI_IMAGE::dv, MRI_IMAGE::dw, MRI_IMAGE::dx, MRI_IMAGE::dy, MRI_IMAGE::dz, ENTRY, MRI_DATA::float_data, MRI_IMAGE::fname, MRI_IMAGE::foffset, MRI_IMAGE::fondisk, MRI_IMAGE::im, MRI_DATA::int_data, MRI_IMAGE::kind, mri_data_pointer(), MRI_FATAL_ERROR, MRI_IMAGE::name, MRI_IMAGE::nt, MRI_IMAGE::nu, MRI_IMAGE::nv, MRI_IMAGE::nvox, MRI_IMAGE::nw, MRI_IMAGE::nx, MRI_IMAGE::nxy, MRI_IMAGE::nxyz, MRI_IMAGE::nxyzt, MRI_IMAGE::ny, nz, MRI_IMAGE::nz, MRI_IMAGE::pixel_size, RETURN, MRI_DATA::rgb_data, MRI_DATA::rgba_data, MRI_DATA::short_data, MRI_IMAGE::to, MRI_IMAGE::uo, MRI_IMAGE::vo, MRI_IMAGE::was_swapped, MRI_IMAGE::wo, MRI_IMAGE::xo, MRI_IMAGE::yo, and MRI_IMAGE::zo.

Referenced by mri_new(), mri_new_vol(), mri_new_vol_empty(), mri_try_7D(), and niml_to_mri().

00044 {
00045    MRI_IMAGE *newim ;
00046    int npix ;
00047 
00048 ENTRY("mri_new_7D_generic") ;
00049 
00050    newim = (MRI_IMAGE *)calloc( 1, sizeof(MRI_IMAGE) ) ;
00051 
00052    if( newim == NULL ){
00053       fprintf( stderr , "malloc failure for new image pointer\n" ) ;
00054       MRI_FATAL_ERROR ;
00055    }
00056 
00057    if( nx < 1 ) nx = 1 ;  /* 18 Mar 2005: fix stupid user problems */
00058    if( ny < 1 ) ny = 1 ;
00059    if( nz < 1 ) nz = 1 ;
00060    if( nt < 1 ) nt = 1 ;
00061    if( nu < 1 ) nu = 1 ;
00062    if( nv < 1 ) nv = 1 ;
00063    if( nw < 1 ) nw = 1 ;
00064 
00065    newim->nx   = nx ;
00066    newim->ny   = ny ; newim->nxy   = nx*ny ;
00067    newim->nz   = nz ; newim->nxyz  = nx*ny*nz ;
00068    newim->nt   = nt ; newim->nxyzt = nx*ny*nz*nt ;
00069    newim->nu   = nu ;
00070    newim->nv   = nv ;
00071    newim->nw   = nw ; newim->nvox  = newim->nxyzt * nu*nv*nw ;
00072 
00073    newim->kind = kind ;
00074    newim->name = NULL ;
00075 
00076    newim->dx = newim->dy = newim->dz =
00077    newim->dt = newim->du = newim->dv = 1.0 ;  /* default dimensions */
00078 
00079    newim->dw = -666.0 ;  /* 05 Feb 2001 - flag that dimensions aren't set */
00080 
00081    newim->xo = newim->yo = newim->zo =
00082    newim->to = newim->uo = newim->vo = newim->wo = 0.0 ;  /* default offsets */
00083 
00084    newim->was_swapped = 0 ;  /* 07 Mar 2002 - flag that bytes were swapped */
00085 
00086 #ifdef USE_MRI_LABELS
00087    newim->xlab[0] = '\0' ;          /* default labels */
00088    newim->ylab[0] = '\0' ;
00089    newim->zlab[0] = '\0' ;
00090    newim->tlab[0] = '\0' ;
00091    newim->ulab[0] = '\0' ;
00092    newim->vlab[0] = '\0' ;
00093    newim->wlab[0] = '\0' ;
00094 #endif
00095 
00096 #ifdef USE_MRI_DELAY
00097    newim->fname   = NULL ;
00098    newim->foffset = newim->fondisk = 0 ;
00099 #endif
00100 
00101    npix = newim->nvox ;
00102 
00103    switch( kind ){
00104 
00105       case MRI_byte:
00106          if( make_space )
00107             newim->im.byte_data = (byte *)calloc( npix,sizeof(byte) ) ;
00108          else
00109             newim->im.byte_data = NULL ;
00110          newim->pixel_size = sizeof(byte) ;
00111       break ;
00112 
00113       case MRI_short:
00114          if( make_space )
00115             newim->im.short_data = (short *)calloc( npix,sizeof(short) ) ;
00116          else
00117             newim->im.short_data = NULL ;
00118          newim->pixel_size = sizeof(short) ;
00119       break ;
00120 
00121       case MRI_int:
00122          if( make_space )
00123             newim->im.int_data = (int *)calloc( npix,sizeof(int) ) ;
00124          else
00125             newim->im.int_data = NULL ;
00126          newim->pixel_size = sizeof(int) ;
00127       break ;
00128 
00129       case MRI_float:
00130          if( make_space )
00131             newim->im.float_data = (float *)calloc( npix,sizeof(float) ) ;
00132          else
00133             newim->im.float_data = NULL ;
00134          newim->pixel_size = sizeof(float) ;
00135       break ;
00136 
00137       case MRI_double:
00138          if( make_space )
00139             newim->im.double_data = (double *)calloc( npix,sizeof(double) ) ;
00140          else
00141             newim->im.double_data = NULL ;
00142          newim->pixel_size = sizeof(double) ;
00143       break ;
00144 
00145       case MRI_complex:
00146          if( make_space )
00147             newim->im.complex_data = (complex *)calloc( npix,sizeof(complex) ) ;
00148          else
00149             newim->im.complex_data = NULL ;
00150          newim->pixel_size = sizeof(complex) ;
00151       break ;
00152 
00153       case MRI_rgb:
00154          if( make_space )
00155             newim->im.rgb_data = (byte *)calloc( 3*npix,sizeof(byte) ) ;
00156          else
00157             newim->im.rgb_data = NULL ;
00158          newim->pixel_size = 3 * sizeof(byte) ;
00159       break ;
00160 
00161       case MRI_rgba:
00162          if( make_space )
00163             newim->im.rgba_data = (rgba *)calloc( npix,sizeof(rgba) ) ;
00164          else
00165             newim->im.rgb_data = NULL ;
00166          newim->pixel_size = sizeof(rgba) ;
00167       break ;
00168 
00169       default:
00170          fprintf( stderr , "mri_new: unrecognized image kind %d\n",(int)kind ) ;
00171          MRI_FATAL_ERROR ;
00172    }
00173 
00174    if( make_space && mri_data_pointer(newim) == NULL ){
00175       fprintf( stderr , "malloc failure for image space: %d bytes\n",npix*newim->pixel_size ) ;
00176       MRI_FATAL_ERROR ;
00177    }
00178 
00179    RETURN(newim) ;
00180 }

MRI_IMAGE* mri_new_vol int    nx,
int    ny,
int    nz,
MRI_TYPE    kind
 

Definition at line 32 of file mri_new.c.

References mri_new_7D_generic(), and nz.

Referenced by mri_cut_3D(), mri_flip3D(), mri_read3D_analyze75(), mri_warp3D_cubic(), mri_warp3D_linear(), mri_warp3D_NN(), mri_warp3D_quintic(), THD_rota3D(), and THD_rota3D_matvec().

00033 {
00034    MRI_IMAGE *newim ;
00035    newim = mri_new_7D_generic( nx,ny,nz , 1,1,1,1 , kind , TRUE ) ;
00036    return newim ;
00037 }

MRI_IMAGE* mri_new_vol_empty int    nx,
int    ny,
int    nz,
MRI_TYPE    kind
 

Definition at line 23 of file mri_new.c.

References mri_new_7D_generic(), and nz.

Referenced by AFNI_make_widgets(), AIVVV_imseq_addto(), AIVVV_imseq_popup(), BFIT_compute(), BFIT_main(), CORREL_main(), dset_to_mri(), EDIT_add_bricklist(), IMREG_main(), main(), MASKAVE_main(), mri_1D_fromstring(), mri_read_3D_delay(), mri_read_ascii(), mri_zeropad_3D(), process_1ddata(), read_input_data(), RT_registration_2D_onevol(), RT_registration_2D_setup(), RT_start_dataset(), THD_autonudge(), THD_init_datablock_brick(), and XImage_to_mri().

00024 {
00025    MRI_IMAGE *newim ;
00026    newim = mri_new_7D_generic( nx,ny,nz , 1,1,1,1 , kind , FALSE ) ;
00027    return newim ;
00028 }
 

Powered by Plone

This site conforms to the following standards: