Doxygen Source Code Documentation
2tocx.c File Reference
#include "mrilib.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
Function Documentation
|
convert three sub-briks to a raw dataset with consecutive triplets Definition at line 9 of file 2tocx.c. References a2, argc, complex::i, MRI_COMPLEX_PTR, MRI_FLOAT_PTR, mri_free(), mri_new(), mri_read(), mri_to_float(), mri_write(), MRI_IMAGE::nx, MRI_IMAGE::ny, and complex::r.
00010 { 00011 int nx,ny,ii,npix ; 00012 MRI_IMAGE * im1 , * im2 , * flim , * cxim ; 00013 float * a1 , * a2 ; 00014 complex * cxar ; 00015 00016 if( argc < 4 ){ 00017 printf("Usage: 2tocx im1 im2 cxim\n") ; 00018 exit(0) ; 00019 } 00020 00021 im1 = mri_read( argv[1] ) ; 00022 im2 = mri_read( argv[2] ) ; 00023 if( im1 == NULL || im2 == NULL ) exit(1) ; 00024 00025 flim = mri_to_float(im1) ; mri_free(im1) ; im1 = flim ; a1 = MRI_FLOAT_PTR(im1) ; 00026 flim = mri_to_float(im2) ; mri_free(im2) ; im2 = flim ; a2 = MRI_FLOAT_PTR(im2) ; 00027 00028 nx = im1->nx ; ny = im1->ny ; npix = nx*ny ; 00029 00030 cxim = mri_new( nx , ny , MRI_complex ) ; 00031 cxar = MRI_COMPLEX_PTR(cxim) ; 00032 00033 for( ii=0 ; ii < npix ; ii++ ){ 00034 cxar[ii].r = a1[ii] ; 00035 cxar[ii].i = a2[ii] ; 00036 } 00037 00038 mri_write( argv[3] , cxim ) ; 00039 exit(0) ; 00040 } |