Doxygen Source Code Documentation
mri_to_mri.c File Reference
#include "mrilib.h"Go to the source code of this file.
Functions | |
| MRI_IMAGE * | mri_to_mri (int datum, MRI_IMAGE *oldim) |
| MRI_IMAGE * | mri_to_mri_scl (int datum, double factor, MRI_IMAGE *oldim) |
Function Documentation
|
||||||||||||
|
Definition at line 15 of file mri_to_mri.c. References ENTRY, MRI_IMAGE::kind, mri_max(), mri_maxabs(), mri_min(), mri_to_byte(), mri_to_byte_scl(), mri_to_complex(), mri_to_float(), mri_to_rgb(), mri_to_rgba(), mri_to_short(), mri_to_short_scl(), and RETURN. Referenced by AFNI_read_images(), IMREG_main(), ISQ_getimage(), main(), mri_cat2D(), mri_dup2D(), mri_scramble(), mri_warp3D_cubic(), mri_warp3D_linear(), mri_warp3D_NN(), mri_warp3D_quintic(), mri_warp_bicubic(), PH_popup_image(), PLUGIN_imseq_getim(), RCREND_imseq_getim(), and REND_imseq_getim().
00016 {
00017 MRI_IMAGE * newim ;
00018
00019 ENTRY("mri_to_mri") ;
00020
00021 if( oldim == NULL ) RETURN( NULL ); /* 09 Feb 1999 */
00022
00023 switch( datum ){
00024 default:
00025 fprintf(stderr,
00026 "\nUnsupported mri_to_mri conversion!\a\n") ;
00027 newim = NULL ;
00028 break ;
00029
00030 case MRI_short:{
00031 double imtop ;
00032 imtop = mri_maxabs( oldim ) ;
00033
00034 if( imtop <= 32767.0 )
00035 newim = mri_to_short( 1.0 , oldim ) ;
00036 else
00037 newim = mri_to_short_scl( 0.0 , 10000.0 , oldim ) ;
00038 }
00039 break ;
00040
00041 case MRI_float:
00042 newim = mri_to_float( oldim ) ;
00043 break ;
00044
00045 case MRI_byte:{
00046 float immin , immax ;
00047
00048 if( oldim->kind == MRI_byte ){
00049 newim = mri_to_byte( oldim ) ;
00050 } else {
00051 immin = mri_min( oldim ) ; immax = mri_max( oldim ) ;
00052 if( immin >= 0 && immax < 256 )
00053 newim = mri_to_byte_scl( 1.0 , 0.0 , oldim ) ;
00054 else
00055 newim = mri_to_byte_scl( 0.0 , 255.0 , oldim ) ;
00056 }
00057 }
00058 break ;
00059
00060 case MRI_complex:
00061 newim = mri_to_complex( oldim ) ;
00062 break ;
00063
00064 case MRI_rgb:
00065 newim = mri_to_rgb( oldim ) ; /* 11 Feb 1999 */
00066 break ;
00067
00068 case MRI_rgba:
00069 newim = mri_to_rgba( oldim ) ; /* 20 Mar 2002 */
00070 break ;
00071
00072 }
00073 RETURN( newim );
00074 }
|
|
||||||||||||||||
|
Definition at line 81 of file mri_to_mri.c. References ENTRY, complex::i, MRI_COMPLEX_PTR, mri_scale_to_float(), mri_to_byte_scl(), mri_to_complex(), mri_to_short(), MRI_IMAGE::nvox, complex::r, and RETURN. Referenced by main().
00082 {
00083 MRI_IMAGE * newim ;
00084
00085 ENTRY("mri_to_mri_scl") ;
00086
00087 if( oldim == NULL ) RETURN( NULL ); /* 09 Feb 1999 */
00088
00089 switch( datum ){
00090 default:
00091 fprintf(stderr,
00092 "\nUnsupported mri_to_mri conversion!\a\n") ;
00093 newim = NULL ;
00094 break ;
00095
00096 case MRI_short:
00097 newim = mri_to_short( factor , oldim ) ;
00098 break ;
00099
00100 case MRI_float:
00101 newim = mri_scale_to_float( factor , oldim ) ;
00102 break ;
00103
00104 case MRI_byte:
00105 newim = mri_to_byte_scl( factor , 0.0 , oldim ) ;
00106 break ;
00107
00108 case MRI_complex:{
00109 complex * cxar ; int ii , nvox ;
00110 newim = mri_to_complex( oldim ) ;
00111 cxar = MRI_COMPLEX_PTR(newim) ;
00112 nvox = newim->nvox ;
00113 for( ii=0 ; ii < nvox ; ii++ ){
00114 cxar[ii].r *= factor ; cxar[ii].i *= factor ;
00115 }
00116 }
00117 break ;
00118 }
00119 RETURN( newim );
00120 }
|