Changeset 13123 for trunk/psLib/test/imageops/tap_psImageGeomManip.c
- Timestamp:
- May 1, 2007, 6:14:33 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/imageops/tap_psImageGeomManip.c (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tap_psImageGeomManip.c
r13084 r13123 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-05-0 1 00:08:52$7 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-05-02 04:14:33 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 154 154 plan_tests(237); 155 155 156 // test ImageRebin()157 // This function shall generate a rescaled version of a psImage structure158 // derived from a specified statistics method.156 // test psImageRebin() 157 // This function shall generate a rescaled version of a psImage 158 // structure derived from a specified statistics method. 159 159 if (1) { 160 160 psMemId id = psMemGetId(); … … 295 295 testRebinType(U16); 296 296 testRebinType(S8); 297 // Verify the returned psImage structure is nulland program execution297 // Verify the returned psImage structure is NULL and program execution 298 298 // doesn't stop, if the input image type is not supported. 299 299 // Following should be an error for unsupported type … … 305 305 ok(out == NULL, "psImageRebin returned NULL for unsupported type"); 306 306 307 // Verify the returned psImage structure is nulland program execution307 // Verify the returned psImage structure is NULL and program execution 308 308 // doesn't stop, if the mask type is not U8 309 309 // Following should be an error for invallid mask type … … 314 314 psFree(in); 315 315 316 // Verify the returned psImage structure is nulland program execution317 // doesn't stop, if the input parameter input is null.316 // Verify the returned psImage structure is NULL and program execution 317 // doesn't stop, if the input parameter input is NULL. 318 318 out2 = psImageRebin(NULL,NULL,NULL,0,1,&stats); 319 319 ok(out2 == NULL, "psImageRebin returned NULL with NULL input"); 320 320 321 // Verify the returned psImage structure is nulland program execution321 // Verify the returned psImage structure is NULL and program execution 322 322 // doesn't stop, if the input parameter scale is less than or equal to zero. 323 323 in = psImageAlloc(16, 16, PS_TYPE_F32); … … 327 327 ok(out2 == NULL, "psImageRebin returned NULL when the scale was zero"); 328 328 329 // Verify the returned psImage structure is nulland program execution330 // doesn't stop, if the input parameter stats is null.331 // Following should be an error for stats null329 // Verify the returned psImage structure is NULL and program execution 330 // doesn't stop, if the input parameter stats is NULL. 331 // Following should be an error for stats NULL 332 332 // XXX: Verify error 333 333 out2 = psImageRebin(NULL,in,NULL,0,1,NULL); 334 334 ok(out2 == NULL, "psImageRebin returned an NULL when the stats was NULL"); 335 335 336 // Verify the returned psImage structure is nulland program execution336 // Verify the returned psImage structure is NULL and program execution 337 337 // doesn't stop, if the input parameter psStats structure member options 338 338 // is zero or any value which doesn't correspond to a valid statistical … … 350 350 ok(out2 == NULL, "psImageRebin returned an image though the stats options was PS_STAT_USE_RANGE"); 351 351 352 // Verify the returned psImage structure is nulland program execution352 // Verify the returned psImage structure is NULL and program execution 353 353 // doesn't stop, if the input parameter psStats structure member options 354 354 // specifies more than one valid statistical method. … … 363 363 } 364 364 365 // test ImageRoll()365 // test psImageRoll() 366 366 if (1) { 367 367 psMemId id = psMemGetId(); … … 387 387 388 388 in = psImageAlloc(cols,rows,PS_TYPE_F32); 389 for (psS32 row=0;row<rows;row++) 390 { 391 psF32 *inRow = in->data.F32[row]; 392 for (psS32 col=0;col<cols;col++) { 393 inRow[col] = (psF32)row+(psF32)col/1000.0f; 389 for (psS32 row=0;row<rows;row++) { 390 for (psS32 col=0;col<cols;col++) { 391 in->data.F32[row][col] = (psF32)row+(psF32)col/1000.0f; 394 392 } 395 393 } … … 397 395 out = psImageRoll(NULL,in,0,0); 398 396 bool errorFlag = false; 399 for (psS32 row=0;row<rows;row++) 400 { 397 for (psS32 row=0;row<rows;row++) { 401 398 psF32 *inRow = in->data.F32[row]; 402 399 psF32 *outRow = out->data.F32[row]; … … 519 516 520 517 521 // Verify the returned psImage structure pointer is nulland program522 // execution doesn't stop, if input parameter input is null.518 // Verify the returned psImage structure pointer is NULL and program 519 // execution doesn't stop, if input parameter input is NULL. 523 520 out2 = psImageRoll(NULL,NULL,0,0); 524 if (out2 != NULL) 525 { 521 if (out2 != NULL) { 526 522 psError(PS_ERR_UNKNOWN, true,"psImageRoll did not return NULL though input image was NULL!?"); 527 523 return 2; … … 567 563 } 568 564 569 570 // testImageRotate() 565 // test psImageRotate() 571 566 if (1) { 572 567 psMemId id = psMemGetId(); … … 599 594 psImage *sImg = psImageAlloc(cols,rows,PS_TYPE_S16); 600 595 601 for(psS32 row=0;row<rows;row++) 602 { 596 for(psS32 row=0;row<rows;row++) { 603 597 psF32 *fRow = fImg->data.F32[row]; 604 598 psS16 *sRow = sImg->data.S16[row]; … … 612 606 // is to verify the results manually and bless it for automated comparison 613 607 // thereafter 614 615 608 616 609 // write results of various rotates to a file and verify with truth images … … 796 789 } 797 790 //HERE 798 // Verify the returned psImage structure pointer is nulland program799 // execution doesn't stop, if the input parameter input is null.791 // Verify the returned psImage structure pointer is NULL and program 792 // execution doesn't stop, if the input parameter input is NULL. 800 793 // Following should be an error 801 794 // XXX: Verify error … … 803 796 ok(fOut == NULL, "NULL was returned when the input image was NULL"); 804 797 805 // Verify the returned psImage structure pointer is nulland program798 // Verify the returned psImage structure pointer is NULL and program 806 799 // execution doesn't stop, if the specified interpolation mode is unallowed 807 800 // Following should be an error for unallowed interpolation type … … 882 875 ok(fRecycle == fOut, "psImageShift did recycle my image"); 883 876 884 // Verify the returned psImage structure pointer is nulland program885 // execution doesn't stop, if the input psImage structure pointer is null.877 // Verify the returned psImage structure pointer is NULL and program 878 // execution doesn't stop, if the input psImage structure pointer is NULL. 886 879 // Following should be an error 887 880 // XXX: Verify error … … 889 882 ok(fOut == NULL, "psImageShift did return NULL given a NULL input image"); 890 883 891 // Verify the returned psImage structure is nulland program execution884 // Verify the returned psImage structure is NULL and program execution 892 885 // doesn't stop, if the specified interpolation mode is unallowed. 893 886 // Following should be an error for unallowed interpolation mode … … 901 894 902 895 903 // test ImageResample()896 // test psImageResample() 904 897 if (1) { 905 898 psMemId id = psMemGetId(); 906 907 899 psS32 rows = 60; 908 900 psS32 cols = 80; … … 911 903 psErr *err; 912 904 913 psImage *image = psImageAlloc(cols,rows,PS_TYPE_F32); 914 for(psS32 row=0;row<rows;row++) 915 { 916 psF32 *imageRow = image->data.F32[row]; 917 for (psS32 col=0;col<cols;col++) { 918 imageRow[col] = row+2*col; 905 psImage *image = psImageAlloc(cols, rows, PS_TYPE_F32); 906 for(psS32 row=0;row<rows;row++) { 907 for (psS32 col=0;col<cols;col++) { 908 image->data.F32[row][col] = row+2*col; 919 909 } 920 910 } … … 925 915 ok(result == orig, "psImageResample() recycled image"); 926 916 ok(result->type.type == PS_TYPE_F32, "psImageResample() produced the correct type"); 927 928 929 917 ok(result->numCols == image->numCols*scale && result->numRows == image->numRows*scale, 930 918 "psImageResample() produced the correct size"); 931 932 919 933 920 bool errorFlag = false; … … 939 926 psMaskType maskVal; 940 927 psF32 truthValue; 941 for(psS32 row=0;row<result->numRows;row++) 942 { 928 for(psS32 row=0;row<result->numRows;row++) { 943 929 for (psS32 col=0;col<result->numCols;col++) { 944 930 // truthValue = psImagePixelInterpolate(image, … … 961 947 ok(!errorFlag, "psImageResample() produced the correct data values"); 962 948 963 // verify that image= nullis handled properly.949 // verify that image=NULL is handled properly. 964 950 psErrorClear(); 965 951 result = psImageResample(result,NULL,scale,PS_INTERPOLATE_FLAT); … … 1002 988 1003 989 1004 // test ImageTransform()990 // test psImageTransform() 1005 991 if (1) { 1006 992 psMemId id = psMemGetId(); … … 1013 999 1014 1000 psImage *in = psImageAlloc(cols,rows,PS_TYPE_F32); 1015 for (psS32 row=0;row<rows;row++) 1016 { 1017 psF32 *inRow = in->data.F32[row]; 1018 for (psS32 col=0;col<cols;col++) { 1019 inRow[col] = (psF32)row+(psF32)col/1000.0f; 1001 for (psS32 row=0;row<rows;row++) { 1002 for (psS32 col=0;col<cols;col++) { 1003 in->data.F32[row][col] = (psF32)row+(psF32)col/1000.0f; 1020 1004 } 1021 1005 } 1022 1006 P_PSIMAGE_SET_COL0(in, 1); 1023 psImage *out = psImageTransform(NULL, 1024 NULL, 1025 in, 1026 NULL, 1027 0, 1028 trans, 1029 psRegionSet(1,1+cols*2,0,rows*2), 1030 NULL, 1031 PS_INTERPOLATE_FLAT, 1032 -1); 1007 psImage *out = psImageTransform(NULL, NULL, in, NULL, 0, trans, 1008 psRegionSet(1,1+cols*2,0,rows*2), NULL, 1009 PS_INTERPOLATE_FLAT, -1); 1033 1010 1034 1011 ok(out != NULL, "psImageTransform() returned non-NULL"); … … 1036 1013 ok(out->numRows == rows*2 && out->numCols == cols*2, "psImageTransform() produced the correct size"); 1037 1014 1038 if ( 0) {1015 if (1) { 1039 1016 psMemId id = psMemGetId(); 1040 1017 psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc( … … 1045 1022 psMaskType maskVal; 1046 1023 bool errorFlag = false; 1047 for (psS32 row=0;row<out->numRows;row++) 1048 { 1049 psF32 *outRow = out->data.F32[row]; 1024 for (psS32 row=0;row<out->numRows;row++) { 1050 1025 for (psS32 col=0;col<cols;col++) { 1051 1026 psImageInterpolate(&imgVal, &varVal, &maskVal, … … 1054 1029 tmpIntOpts); 1055 1030 float inValue = imgVal; 1056 if (fabsf(outRow[col] - inValue) > 0.01) { 1057 diag("out at %d,%d was %g, expected %g", col,row,outRow[col], inValue); 1031 if (fabsf(out->data.F32[row][col] - inValue) > 0.01) { 1032 diag("out at %d,%d was %g, expected %g", col,row, 1033 out->data.F32[row][col], inValue); 1058 1034 errorFlag = true; 1059 1035 }
Note:
See TracChangeset
for help on using the changeset viewer.
