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  

dicom_to_raw.c

Go to the documentation of this file.
00001 #include "mrilib.h"
00002 
00003 int main( int argc , char *argv[] )
00004 {
00005   MRI_IMARR *imar ;
00006   int kk,ii , nn ;
00007   char iname[1024] ;
00008 
00009   if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
00010     printf("Usage: dicom_to_raw fname ...\n"
00011            "Reads images from DICOM file 'fname' and writes them to raw\n"
00012            "file(s) 'fname.raw.0001' etc.\n"
00013           ) ;
00014     exit(0) ;
00015   }
00016            
00017   for( kk=1 ; kk < argc ; kk++ ){
00018     imar = mri_read_dicom( argv[kk] ) ;
00019     if( imar == NULL ){
00020       fprintf(stderr,"++ Can't read from file %s\n",argv[kk]) ; continue ;
00021     }
00022     nn = IMARR_COUNT(imar) ;
00023     for( ii=0 ; ii < nn ; ii++ ){
00024       sprintf(iname,"%s.raw.%04d",argv[kk],ii+1) ;
00025       mri_write( iname, IMARR_SUBIM(imar,ii) ) ;
00026     }
00027     DESTROY_IMARR(imar) ;
00028   }
00029 
00030   exit(0) ;
00031 }
 

Powered by Plone

This site conforms to the following standards: