Changeset 1926
- Timestamp:
- Sep 29, 2004, 9:50:43 AM (22 years ago)
- Location:
- trunk/psLib/test/image
- Files:
-
- 2 edited
-
tst_psImageManip.c (modified) (13 diffs)
-
verified/tst_psImageManip.stderr (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageManip.c
r1922 r1926 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-09-29 00:28:21$8 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-09-29 19:50:43 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 860 860 psImage* out = NULL; 861 861 psImage* out2 = NULL; 862 psImage* out3 = NULL; 863 psImage* mask = NULL; 862 864 psImage* meanTruth = NULL; 865 psImage* meanTruthWMask = NULL; 863 866 psImage* maxTruth = NULL; 864 867 psStats stats; … … 875 878 #define testRebinType(DATATYPE) \ 876 879 in = psImageAlloc(16,16,PS_TYPE_##DATATYPE); \ 880 mask = psImageAlloc(16,16,PS_TYPE_U8); \ 877 881 meanTruth = psImageAlloc(4,4,PS_TYPE_F32); \ 882 meanTruthWMask = psImageAlloc(4,4,PS_TYPE_F32); \ 878 883 maxTruth = psImageAlloc(6,6,PS_TYPE_F32); \ 879 884 memset(meanTruth->data.F32[0],0,sizeof(psF32)*4*4); \ 885 memset(meanTruthWMask->data.F32[0],0,sizeof(psF32)*4*4); \ 880 886 memset(maxTruth->data.F32[0],0,sizeof(psF32)*6*6); \ 881 887 for (int row = 0; row<16; row++) { \ 882 888 ps##DATATYPE* inRow = in->data.DATATYPE[row]; \ 883 889 psF32* meanTruthRow = meanTruth->data.F32[row/4]; \ 890 psF32* meanTruthWMaskRow = meanTruthWMask->data.F32[row/4]; \ 884 891 psF32* maxTruthRow = maxTruth->data.F32[row/3]; \ 892 psU8* maskRow = mask->data.U8[row]; \ 885 893 for (int col = 0; col<16; col++) { \ 894 if(col != 15) { \ 895 maskRow[col] = 0; \ 896 } else { \ 897 maskRow[col] = 1; \ 898 } \ 886 899 inRow[col] = row + col; \ 887 900 meanTruthRow[col/4] += row + col; \ … … 889 902 maxTruthRow[col/3] = row+col; \ 890 903 } \ 904 if(maskRow[col] == 0 ) { \ 905 meanTruthWMaskRow[col/4] += row + col; \ 906 } \ 891 907 } \ 892 908 } \ 893 909 for (int row = 0; row<4; row++) { \ 894 910 psF32* meanTruthRow = meanTruth->data.F32[row]; \ 911 psF32* meanTruthWMaskRow = meanTruthWMask->data.F32[row]; \ 895 912 for (int col = 0; col<4; col++) { \ 896 913 meanTruthRow[col] /= 16; \ 914 if ( col == 3 ) { \ 915 meanTruthWMaskRow[col] /= 12; \ 916 } else { \ 917 meanTruthWMaskRow[col] /= 16; \ 918 } \ 897 919 } \ 898 920 } \ … … 921 943 } \ 922 944 } \ 945 stats.options = PS_STAT_SAMPLE_MEAN; \ 946 out3 = psImageRebin(NULL,in,mask,1,4,&stats); \ 947 for (int row = 0; row<4; row++) { \ 948 ps##DATATYPE* outRow = out3->data.DATATYPE[row]; \ 949 psF32* truthRow = meanTruthWMask->data.F32[row]; \ 950 for ( int col = 0; col<4; col++) { \ 951 if(abs((int)outRow[col]-(int)truthRow[col]) > FLT_EPSILON) { \ 952 psError(__func__,"psImageRebin with mask didn't produce the proper mean " \ 953 "result at (%d,%d) [%f vs %f].", \ 954 col,row,outRow[col],truthRow[col]); \ 955 return 3; \ 956 } \ 957 } \ 958 } \ 923 959 stats.options = PS_STAT_MAX; \ 924 960 out2 = psImageRebin(out,in,NULL,0,3,&stats); \ … … 951 987 psFree(in); \ 952 988 psFree(out); \ 989 psFree(out3); \ 990 psFree(mask); \ 953 991 psFree(meanTruth); \ 992 psFree(meanTruthWMask); \ 954 993 psFree(maxTruth); 955 994 … … 961 1000 // Verify the returned psImage structure is null and program execution 962 1001 // doesn't stop, if the input image type is not supported. 963 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error .");1002 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for unsupported type."); 964 1003 in = psImageAlloc(16,16,PS_TYPE_U8); 1004 mask = psImageAlloc(16,16,PS_TYPE_F32); 965 1005 stats.options = PS_STAT_SAMPLE_MEAN; 966 1006 out = psImageRebin(NULL,in,NULL,0,4,&stats); … … 970 1010 return 14; 971 1011 } 1012 // Verify the returned psImage structure is null and program execution 1013 // doesn't stop, if the mask type is not U8 1014 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for invallid mask type."); 1015 out = psImageRebin(NULL,in,mask,1,4,&stats); 1016 if(out != NULL) { 1017 psError(__func__,"psImageRebin return an image eventhough the " 1018 "mask is not the correct type."); 1019 return 17; 1020 } 1021 psFree(mask); 972 1022 psFree(in); 973 1023 … … 986 1036 // doesn't stop, if the input parameter scale is less than or equal to zero. 987 1037 in = psImageAlloc(16, 16, PS_TYPE_F32); 988 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error .");1038 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for scale < 0."); 989 1039 out2 = psImageRebin(NULL,in,NULL,0,0,&stats); 990 1040 … … 997 1047 // Verify the returned psImage structure is null and program execution 998 1048 // doesn't stop, if the input parameter stats is null. 999 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error .");1049 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for stats null."); 1000 1050 out2 = psImageRebin(NULL,in,NULL,0,1,NULL); 1001 1051 … … 1010 1060 // is zero or any value which doesn't correspond to a valid statistical 1011 1061 // method. 1012 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error .");1062 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for stats options 0."); 1013 1063 stats.options = 0; 1014 1064 out2 = psImageRebin(NULL,in,NULL,0,1,&stats); … … 1020 1070 } 1021 1071 1022 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error .");1072 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for stat options use range."); 1023 1073 stats.options = PS_STAT_USE_RANGE; 1024 1074 out2 = psImageRebin(NULL,in,NULL,0,1,&stats); … … 1033 1083 // doesn't stop, if the input parameter psStats structure member options 1034 1084 // specifies more than one valid statistical method. 1035 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error .");1085 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for stats with multiple options."); 1036 1086 stats.options = PS_STAT_SAMPLE_MEAN + PS_STAT_MAX; 1037 1087 out2 = psImageRebin(NULL,in,NULL,0,1,&stats); -
trunk/psLib/test/image/verified/tst_psImageManip.stderr
r1923 r1926 125 125 Following should error as overlay isn't within image boundaries 126 126 <DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection 127 Specified subset range, [32:<LINENO>,64:<LINENO>], lies outsidepsImage's boundaries, [0:<LINENO>,0:<LINENO>].127 Specified subset range, [32:<LINENO>,64:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>]. 128 128 <DATE><TIME>|<HOST>|I|testImageOverlay 129 129 Following should error as overlay is NULL … … 160 160 161 161 <DATE><TIME>|<HOST>|I|testImageRebin 162 Following should be an error .162 Following should be an error for unsupported type. 163 163 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 164 164 Specified psImage type, psU8, is not supported. 165 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 166 Can not operate on a NULL psImage. 167 <DATE><TIME>|<HOST>|I|testImageRebin 168 Following should be an error. 165 <DATE><TIME>|<HOST>|I|testImageRebin 166 Following should be an error for invallid mask type. 167 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 168 Input psImage mask type, psF32, is not the supported mask datatype of psU8. 169 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 170 Can not operate on a NULL psImage. 171 <DATE><TIME>|<HOST>|I|testImageRebin 172 Following should be an error for scale < 0. 169 173 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 170 174 Specified scale value, 0, must be a positive value. 171 175 <DATE><TIME>|<HOST>|I|testImageRebin 172 Following should be an error .176 Following should be an error for stats null. 173 177 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 174 178 Specified statistic can not be NULL. 175 179 <DATE><TIME>|<HOST>|I|testImageRebin 176 Following should be an error .180 Following should be an error for stats options 0. 177 181 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 178 182 Specified statistic option, 0, is not valid. Must specify one and only one statistic type. 179 183 <DATE><TIME>|<HOST>|I|testImageRebin 180 Following should be an error .184 Following should be an error for stat options use range. 181 185 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 182 186 Specified statistic option, 8192, is not valid. Must specify one and only one statistic type. 183 187 <DATE><TIME>|<HOST>|I|testImageRebin 184 Following should be an error .188 Following should be an error for stats with multiple options. 185 189 <DATE><TIME>|<HOST>|E|psLib.image.psImageRebin 186 190 Specified statistic option, 2049, is not valid. Must specify one and only one statistic type.
Note:
See TracChangeset
for help on using the changeset viewer.
