Doxygen Source Code Documentation
mri_equal.c
Go to the documentation of this file.00001 #include "mrilib.h" 00002 00003 /*! Test if 2 images are equal. 00004 Returns 1 if they are, 0 if they are not. [30 Jun 2003] */ 00005 00006 int mri_equal( MRI_IMAGE *aim , MRI_IMAGE *bim ) 00007 { 00008 char *aar , *bar ; 00009 int nn ; 00010 00011 ENTRY("mri_equal") ; 00012 00013 if( aim == bim ) RETURN( 1 ); 00014 if( aim == NULL || bim == NULL ) RETURN( 0 ); 00015 00016 if( aim->nvox != bim->nvox ) RETURN( 0 ); 00017 if( aim->kind != bim->kind ) RETURN( 0 ); 00018 00019 aar = mri_data_pointer(aim) ; if( aar == NULL ) RETURN( 0 ); 00020 bar = mri_data_pointer(bim) ; if( bar == NULL ) RETURN( 0 ); 00021 00022 nn = memcmp( aar , bar , aim->nvox * aim->pixel_size ) ; 00023 if( nn != 0 ) nn = 0 ; 00024 else nn = 1 ; 00025 RETURN( nn); 00026 }