Changeset 4128 for trunk/psLib/test/image/tst_psImageGeomManip.c
- Timestamp:
- Jun 6, 2005, 4:29:44 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageGeomManip.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageGeomManip.c
r4069 r4128 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-06-0 1 20:37:39$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-06-07 02:29:44 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 536 536 mkdir("temp",0777); 537 537 remove 538 ("temp/fOut.fits") 539 ; 540 remove 541 ("temp/sOut.fits") 542 ; 543 remove 544 ("temp/fBiOut.fits") 545 ; 546 remove 547 ("temp/sBiOut.fits"); 548 ; 538 ("temp/out.fits"); 549 539 psS32 index = 0; 550 540 psBool fail = false; 551 541 psF32 radianRot; 542 543 psFits* fOutFile = psFitsAlloc("temp/fOut.fits"); 544 psFits* sOutFile = psFitsAlloc("temp/sOut.fits"); 545 psFits* fBiOutFile = psFitsAlloc("temp/fBiOut.fits"); 546 psFits* sBiOutFile = psFitsAlloc("temp/sBiOut.fits"); 547 if (fOutFile == NULL ||sOutFile == NULL || fBiOutFile == NULL || sBiOutFile == NULL) { 548 psError(PS_ERR_UNKNOWN, true, "Can not create output files, so why continue!?"); 549 return 1; 550 } 551 552 psFits* fTruthFile = psFitsAlloc("verified/fOut.fits"); 553 psFits* sTruthFile = psFitsAlloc("verified/sOut.fits"); 554 psFits* fBiTruthFile = psFitsAlloc("verified/fBiOut.fits"); 555 psFits* sBiTruthFile = psFitsAlloc("verified/sBiOut.fits"); 556 if (fTruthFile == NULL ||sTruthFile == NULL || fBiTruthFile == NULL || sBiTruthFile == NULL) { 557 psError(PS_ERR_UNKNOWN, true, "Can not open truth files, so why continue!?"); 558 return 1; 559 } 560 561 char hduName[80]; 562 psRegion regionAll = psRegionSet(0,0,0,0); 552 563 for (psS32 rot=-180;rot<=180;rot+=45) { 553 564 psImage* oldOut = fOut; 554 565 psImage* oldBiOut = fBiOut; 555 566 snprintf(hduName, 80, "%+d", rot); 556 567 if (rot == 90) { 557 568 radianRot = M_PI_2; … … 578 589 sOut = psImageRotate(sOut,sImg,radianRot,-1.0,PS_INTERPOLATE_FLAT); 579 590 sBiOut = psImageRotate(sBiOut,sImg,radianRot,-1.0,PS_INTERPOLATE_BILINEAR); 580 if (! psImageWriteSection(fOut,0,0,0,NULL,index,"temp/fOut.fits") ) { 581 psError(PS_ERR_UNKNOWN, true,"Can not write to temp/fOut.fits, so why continue!?"); 591 592 if (! psFitsWriteImage(fOutFile, NULL, fOut, 1, hduName) ) { 593 psError(PS_ERR_UNKNOWN, true,"Can not write fOut."); 582 594 return 20; 583 595 } 584 if (! ps ImageWriteSection(sOut,0,0,0,NULL,index,"temp/sOut.fits") ) {585 psError(PS_ERR_UNKNOWN, true,"Can not write to temp/sOut.fits, so why continue!?");596 if (! psFitsWriteImage(sOutFile, NULL, sOut, 1, hduName) ) { 597 psError(PS_ERR_UNKNOWN, true,"Can not write sOut."); 586 598 return 21; 587 599 } 588 if (! ps ImageWriteSection(fBiOut,0,0,0,NULL,index,"temp/fBiOut.fits") ) {589 psError(PS_ERR_UNKNOWN, true,"Can not write to temp/fBiOut.fits, so why continue!?");600 if (! psFitsWriteImage(fBiOutFile, NULL, fBiOut, 1, hduName) ) { 601 psError(PS_ERR_UNKNOWN, true,"Can not write fBiOut.fits."); 590 602 return 40; 591 603 } 592 if (! ps ImageWriteSection(sBiOut,0,0,0,NULL,index,"temp/sBiOut.fits") ) {593 psError(PS_ERR_UNKNOWN, true,"Can not write to temp/sBiOut.fits, so why continue!?");604 if (! psFitsWriteImage(sBiOutFile, NULL, sBiOut, 1, hduName) ) { 605 psError(PS_ERR_UNKNOWN, true,"Can not write sBiOut.fits."); 594 606 return 41; 595 607 } 596 608 597 609 // now, let's compare this with the verified file 598 fTruth = psImageReadSection(fTruth,0,0,0,0,0,NULL,index,"temp/fOut.fits"); 599 sTruth = psImageReadSection(sTruth,0,0,0,0,0,NULL,index,"temp/sOut.fits"); 600 fBiTruth = psImageReadSection(fBiTruth,0,0,0,0,0,NULL,index,"temp/fBiOut.fits"); 601 sBiTruth = psImageReadSection(sBiTruth,0,0,0,0,0,NULL,index,"temp/sBiOut.fits"); 610 psFitsMoveExtNum(fTruthFile, index, false); 611 psFitsMoveExtNum(sTruthFile, index, false); 612 psFitsMoveExtNum(fBiTruthFile, index, false); 613 psFitsMoveExtNum(sBiTruthFile, index, false); 614 fTruth = psFitsReadImage(fTruth, fTruthFile, regionAll, 0); 615 sTruth = psFitsReadImage(sTruth, sTruthFile, regionAll, 0); 616 fBiTruth = psFitsReadImage(fBiTruth, fBiTruthFile, regionAll, 0); 617 sBiTruth = psFitsReadImage(sBiTruth, sBiTruthFile, regionAll, 0); 602 618 if (fTruth == NULL) { 603 619 psError(PS_ERR_UNKNOWN, true,"verified psF32 image failed to be read (%d deg. rotation)", … … 743 759 psFree(fBiOut); 744 760 761 psFree(fOutFile); 762 psFree(sOutFile); 763 psFree(fBiOutFile); 764 psFree(sBiOutFile); 765 766 psFree(fTruthFile); 767 psFree(sTruthFile); 768 psFree(fBiTruthFile); 769 psFree(sBiTruthFile); 770 745 771 return 0; 746 772 }
Note:
See TracChangeset
for help on using the changeset viewer.
