Changeset 6806 for trunk/psLib/test/imageops/tst_psImagePixelExtract.c
- Timestamp:
- Apr 6, 2006, 12:55:18 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tst_psImagePixelExtract.c
r6778 r6806 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-04-0 5 01:49:41$8 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-06 22:55:18 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 341 341 } 342 342 343 //Added tests after subimage changes. 344 psFree(image); 345 image = psImageAlloc( c, r, PS_TYPE_F64 ); 346 for ( psS32 row = 0;row < r;row++ ) { 347 psF64 *imageRow = image->data.F64[ row ]; 348 psF64 rowOffset = row * 2; 349 for ( psS32 col = 0;col < c;col++ ) { 350 imageRow[ col ] = col + rowOffset; 351 } 352 } 353 image->col0 = 1; 354 image->row0 = 1; 355 psFree(out); 356 out = NULL; 357 out = psImageSlice(out,positions,image,mask,1, 358 psRegionSet(1,c,1,r),PS_CUT_X_POS,stat); 359 if (out == NULL) { 360 psError(PS_ERR_BAD_PARAMETER_NULL, false, 361 "psImageSlice failed to return the correct psVector. Got NULL instead.\n"); 362 return 112; 363 } 364 psFree(out); 365 out = NULL; 366 //Return NULL for incorrect image inputs. 367 image->row0 = -1; 368 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 369 out = psImageSlice(out,positions,image,mask,1, 370 psRegionSet(1,c,1,r),PS_CUT_X_POS,stat); 371 if (out != NULL) { 372 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 373 "psImageSlice failed to return NULL for invalid specified input.\n"); 374 return 113; 375 } 376 image->col0 = -1; 377 image->row0 = 1; 378 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 379 out = psImageSlice(out,positions,image,mask,1, 380 psRegionSet(1,c,1,r),PS_CUT_X_POS,stat); 381 if (out != NULL) { 382 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 383 "psImageSlice failed to return NULL for invalid specified input.\n"); 384 return 114; 385 } 386 image->col0 = 1; 387 //Return NULL for incorrect region inputs. 388 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 389 out = psImageSlice(out,positions,image,mask,1, 390 psRegionSet(0,c,1,r),PS_CUT_X_POS,stat); 391 if (out != NULL) { 392 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 393 "psImageSlice failed to return NULL for invalid specified input.\n"); 394 return 115; 395 } 396 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 397 out = psImageSlice(out,positions,image,mask,1, 398 psRegionSet(1,c,1,r+1),PS_CUT_X_POS,stat); 399 if (out != NULL) { 400 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 401 "psImageSlice failed to return NULL for invalid specified input.\n"); 402 return 116; 403 } 404 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 405 out = psImageSlice(out,positions,image,mask,1, 406 psRegionSet(1,c,1,-r-2),PS_CUT_X_POS,stat); 407 if (out != NULL) { 408 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 409 "psImageSlice failed to return NULL for invalid specified input.\n"); 410 return 117; 411 } 412 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 413 out = psImageSlice(out,positions,image,mask,1, 414 psRegionSet(c,1,1,r),PS_CUT_X_POS,stat); 415 if (out != NULL) { 416 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 417 "psImageSlice failed to return NULL for invalid specified input.\n"); 418 return 118; 419 } 420 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 421 out = psImageSlice(out,positions,image,mask,1, 422 psRegionSet(1,1,1,1),PS_CUT_X_POS,stat); 423 if (out != NULL) { 424 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 425 "psImageSlice failed to return NULL for invalid specified input.\n"); 426 return 119; 427 } 428 429 //Make sure that regions match appropriately... 430 out = psImageSlice(out,positions,image,mask,1, 431 psRegionSet(1,-1,1,-1),PS_CUT_Y_NEG,stat); 432 psVector *out2 = NULL; 433 out2 = psImageSlice(out2,positions,image,mask,1, 434 psRegionSet(0,0,0,0),PS_CUT_Y_NEG,stat); 435 if (out == NULL) { 436 psError(PS_ERR_BAD_PARAMETER_NULL, false, 437 "psImageSlice incorrectly returned NULL for valid inputs.\n"); 438 return 120; 439 } else if (out2 == NULL) { 440 psError(PS_ERR_BAD_PARAMETER_NULL, false, 441 "psImageSlice incorrectly returned NULL for valid inputs.\n"); 442 return 121; 443 } else if (out->n != out2->n) { 444 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 445 "psImageSlice failed to return matching vectors for equivalent inputs.\n"); 446 return 122; 447 } else if (out->data.F64[out->n-1] != out2->data.F64[out2->n-1] ) { 448 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 449 "psImageSlice failed to return matching vectors for equivalent inputs.\n"); 450 return 123; 451 } 452 psFree(out2); 453 343 454 psFree( image ); 344 455 psFree( positions );
Note:
See TracChangeset
for help on using the changeset viewer.
