IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2005, 4:29:44 PM (21 years ago)
Author:
desonia
Message:

removed psImageIO functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImageGeomManip.c

    r4069 r4128  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-06-01 20:37:39 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-06-07 02:29:44 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    536536    mkdir("temp",0777);
    537537    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");
    549539    psS32 index = 0;
    550540    psBool fail = false;
    551541    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);
    552563    for (psS32 rot=-180;rot<=180;rot+=45) {
    553564        psImage* oldOut = fOut;
    554565        psImage* oldBiOut = fBiOut;
    555 
     566        snprintf(hduName, 80, "%+d", rot);
    556567        if (rot == 90) {
    557568            radianRot = M_PI_2;
     
    578589        sOut = psImageRotate(sOut,sImg,radianRot,-1.0,PS_INTERPOLATE_FLAT);
    579590        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.");
    582594            return 20;
    583595        }
    584         if (! psImageWriteSection(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.");
    586598            return 21;
    587599        }
    588         if (! psImageWriteSection(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.");
    590602            return 40;
    591603        }
    592         if (! psImageWriteSection(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.");
    594606            return 41;
    595607        }
    596608
    597609        // 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);
    602618        if (fTruth == NULL) {
    603619            psError(PS_ERR_UNKNOWN, true,"verified psF32 image failed to be read (%d deg. rotation)",
     
    743759    psFree(fBiOut);
    744760
     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
    745771    return 0;
    746772}
Note: See TracChangeset for help on using the changeset viewer.