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_uncat2D.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006    
00007 #include "mrilib.h"
00008 
00009 /* not 7D safe */
00010 
00011 /*---------------------------------------------------------------------------------------
00012   Extract images of size (nx,ny) from  larger image im
00013 -----------------------------------------------------------------------------------------*/
00014 
00015 MRI_IMARR * mri_uncat2D( int nx , int ny , MRI_IMAGE * im )
00016 {
00017    MRI_IMARR * imar ;
00018    MRI_IMAGE * qim ;
00019    int nxim , nyim , ii,jj,kk , kind ;
00020 
00021 ENTRY("mri_uncat2D") ;
00022 
00023    if( nx < 1 || ny < 1 || im == NULL ) RETURN(NULL) ;
00024 
00025    kind = im->kind ;
00026 
00027    nxim = im->nx / nx ;
00028    nyim = im->ny / ny ;
00029    if( nxim < 1 || nyim < 1 ) RETURN(NULL) ;
00030 
00031    INIT_IMARR(imar) ;
00032 
00033    for( jj=0 ; jj < nyim ; jj++ ){
00034       for( ii=0 ; ii < nxim ; ii++ ){
00035          qim = mri_cut_2D( im , ii*nx , (ii+1)*nx-1 , jj*ny , (jj+1)*ny-1 ) ;
00036          if( qim != NULL ) ADDTO_IMARR(imar,qim) ;
00037          else              fprintf(stderr,"mri_uncat2D: NULL image error!\n") ;
00038       }
00039    }
00040 
00041    RETURN(imar) ;
00042 }
 

Powered by Plone

This site conforms to the following standards: