Changeset 2860 for trunk/psLib/test/image/tst_psImageManip.c
- Timestamp:
- Jan 3, 2005, 11:58:53 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageManip.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageManip.c
r2855 r2860 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $9 * @date $Date: 200 4-12-30 20:18:37$8 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-03 21:58:53 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1279 1279 psImage* fOut = NULL; 1280 1280 psImage* sOut = NULL; 1281 psImage* s32Out = NULL;1282 1281 psImage* fBiOut = NULL; 1283 1282 psImage* sBiOut = NULL; … … 1290 1289 psImage* fImg = psImageAlloc(cols,rows,PS_TYPE_F32); 1291 1290 psImage* sImg = psImageAlloc(cols,rows,PS_TYPE_S16); 1292 psImage* s32Img = psImageAlloc(cols,rows,PS_TYPE_S32);1293 1291 1294 1292 for(psS32 row=0;row<rows;row++) { 1295 1293 psF32* fRow = fImg->data.F32[row]; 1296 1294 psS16* sRow = sImg->data.S16[row]; 1297 psS32* s32Row = s32Img->data.S32[row];1298 1295 for (psS32 col=0;col<cols;col++) { 1299 1296 fRow[col] = (psF32)(row)+(psF32)(col)/100.0f; 1300 1297 sRow[col] = row-2*col; 1301 s32Row[col] = row-2*col;1302 1298 } 1303 1299 } … … 1324 1320 psS32 index = 0; 1325 1321 psBool fail = false; 1322 psF32 radianRot; 1326 1323 for (psS32 rot=-180;rot<=180;rot+=45) { 1327 1324 psImage* oldOut = fOut; 1328 1325 psImage* oldBiOut = fBiOut; 1329 fOut = psImageRotate(fOut,fImg,rot,-1.0,PS_INTERPOLATE_FLAT); 1330 fBiOut = psImageRotate(fBiOut,fImg,rot,-1.0,PS_INTERPOLATE_BILINEAR); 1326 1327 if (rot == 90) { 1328 radianRot = PS_PI_2; 1329 } else if (rot == -90) { 1330 radianRot = PS_PI+PS_PI_2; 1331 } else if (rot == 180 || rot == -180) { 1332 radianRot = PS_PI; 1333 } else { 1334 radianRot = ((float)rot)*PS_PI/180.0; 1335 } 1336 1337 fOut = psImageRotate(fOut,fImg,radianRot,-1.0,PS_INTERPOLATE_FLAT); 1338 fBiOut = psImageRotate(fBiOut,fImg,radianRot,-1.0,PS_INTERPOLATE_BILINEAR); 1331 1339 // Verify the returned psImage structure is equal to the input 1332 1340 // parameter out if provided. … … 1339 1347 return 4; 1340 1348 } 1341 sOut = psImageRotate(sOut,sImg,r ot,-1.0,PS_INTERPOLATE_FLAT);1342 sBiOut = psImageRotate(sBiOut,sImg,r ot,-1.0,PS_INTERPOLATE_BILINEAR);1349 sOut = psImageRotate(sOut,sImg,radianRot,-1.0,PS_INTERPOLATE_FLAT); 1350 sBiOut = psImageRotate(sBiOut,sImg,radianRot,-1.0,PS_INTERPOLATE_BILINEAR); 1343 1351 if (! psImageWriteSection(fOut,0,0,0,NULL,index,"temp/fOut.fits") ) { 1344 1352 psError(PS_ERR_UNKNOWN, true,"Can not write to temp/fOut.fits, so why continue!?"); … … 1466 1474 } 1467 1475 1468 // Verify psImage structure returned is NULL and program execution doesn't stop1469 // if the input image type is not supported. Do not check for 0 degree rotation1470 // since an imgae copy will be used.1471 if (rot != 0 ) {1472 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error invalid type for rotate.");1473 s32Out = psImageRotate(s32Out,s32Img,rot,-1.0,PS_INTERPOLATE_FLAT);1474 if( s32Out != NULL ) {1475 psError(PS_ERR_UNKNOWN, true,"psImage returned is not NULL for invalid image type.");1476 return 5;1477 }1478 }1479 1480 1476 index++; 1481 1477 } … … 1517 1513 psFree(sBiTruth); 1518 1514 psFree(fBiOut); 1519 psFree(s32Img);1520 psFree(s32Out);1521 1515 1522 1516 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.
