IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3786


Ignore:
Timestamp:
Apr 28, 2005, 4:25:10 PM (21 years ago)
Author:
desonia
Message:

Bug #382 -- added some simple functions for tracing.

Location:
trunk/psLib/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psVector.c

    r3740 r3786  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-04-21 21:21:01 $
     11*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-04-29 02:25:09 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    526526    }
    527527}
     528
     529bool p_psVectorPrint (FILE *f, psVector *a, char *name)
     530{
     531
     532    fprintf (f, "vector: %s\n", name);
     533
     534    for (int i = 0; i < a[0].n; i++) {
     535        fprintf (f, "%f\n", p_psVectorGetElementF64(a, i));
     536    }
     537    fprintf (f, "\n");
     538    return (true);
     539}
  • trunk/psLib/src/collections/psVector.h

    r3737 r3786  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-04-21 21:18:23 $
     13 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-04-29 02:25:09 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1919#ifndef PS_VECTOR_H
    2020#define PS_VECTOR_H
     21
     22#include<stdio.h>
    2123
    2224#include "psType.h"
     
    162164);
    163165
     166/** Print a vector to a stream
     167 *
     168 *  @return psBool          TRUE is successful, otherwise FALSE.
     169 */
     170bool p_psVectorPrint (
     171    FILE *f,                           ///< output stream
     172    psVector *a,                       ///< vector to print
     173    char *name                         ///< name of vector (for title)
     174);
    164175
    165176/// @}
  • trunk/psLib/src/image/psImage.c

    r3702 r3786  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-15 00:12:08 $
     11 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-04-29 02:25:10 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    589589
    590590    return unexposedValue;
     591}
     592
     593psF64 p_psImageGetElementF64(psImage* image,
     594                             int col,
     595                             int row)
     596{
     597    if (image == NULL) {
     598        return NAN;
     599    }
     600    if (col < 0 || col >= image->numCols) {
     601        return NAN;
     602    }
     603    if (row < 0 || row >= image->numRows) {
     604        return NAN;
     605    }
     606
     607    switch (image->type.type) {
     608    case PS_TYPE_U8:
     609        return image->data.U8[row][col];
     610        break;
     611    case PS_TYPE_U16:
     612        return image->data.U16[row][col];
     613        break;
     614    case PS_TYPE_U32:
     615        return image->data.U32[row][col];
     616        break;
     617    case PS_TYPE_U64:
     618        return image->data.U64[row][col];
     619        break;
     620    case PS_TYPE_S8:
     621        return image->data.S8[row][col];
     622        break;
     623    case PS_TYPE_S16:
     624        return image->data.S16[row][col];
     625        break;
     626    case PS_TYPE_S32:
     627        return image->data.S32[row][col];
     628        break;
     629    case PS_TYPE_S64:
     630        return image->data.S64[row][col];
     631        break;
     632    case PS_TYPE_F32:
     633        return image->data.F32[row][col];
     634        break;
     635    case PS_TYPE_F64:
     636        return image->data.F64[row][col];
     637    default:
     638        return NAN;
     639    }
    591640}
    592641
  • trunk/psLib/src/image/psImage.h

    r3702 r3786  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-04-15 00:12:08 $
     13 *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-04-29 02:25:10 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    182182);
    183183
     184/** get an element of an image as a psF64.
     185 *
     186 *  @return psF64   pixel value at specified location
     187 */
     188psF64 p_psImageGetElementF64(
     189    psImage* image,                    ///< input image
     190    int col,                           ///< pixel column
     191    int row                            ///< pixel row
     192);
     193
    184194/** Interpolate image pixel value given floating point coordinates.
    185195 *
     
    225235PIXEL_INTERPOLATE_FCNS(BILINEAR)
    226236PIXEL_INTERPOLATE_FCNS(BILINEAR_VARIANCE)
    227 #endif
     237#endif // ! SWIG
    228238
    229239#undef PIXEL_INTERPOLATE_FCN_PROTOTYPE
     
    232242/// @}
    233243
    234 #endif
     244#endif // PS_IMAGE_H
  • trunk/psLib/src/image/psImageIO.c

    r3264 r3786  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-02-17 19:26:24 $
     9 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-04-29 02:25:10 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    419419    return true;
    420420}
     421
     422bool p_psImagePrint (FILE *f, psImage *a, char *name)
     423{
     424
     425    fprintf (f, "matrix: %s\n", name);
     426
     427    for (int j = 0; j < a[0].numRows; j++) {
     428        for (int i = 0; i < a[0].numCols; i++) {
     429            fprintf (f, "%f  ", p_psImageGetElementF64(a, i, j));
     430        }
     431        fprintf (f, "\n");
     432    }
     433    fprintf (f, "\n");
     434    return (true);
     435}
     436
  • trunk/psLib/src/image/psImageIO.h

    r3264 r3786  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-02-17 19:26:24 $
     12 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-04-29 02:25:10 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9292);
    9393
     94/** print image pixel values.
     95 *
     96 *  @return bool    TRUE is successful, otherwise FALSE.
     97 */
     98bool p_psImagePrint(
     99    FILE *f,                           ///< Destination stream
     100    psImage *a,                        ///< image to print
     101    char *name                         ///< name of the image (for title)
     102);
     103
    94104/// @}
    95105
    96 #endif
     106#endif // PS_IMAGEIO_H
  • trunk/psLib/src/mathtypes/psImage.c

    r3702 r3786  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-15 00:12:08 $
     11 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-04-29 02:25:10 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    589589
    590590    return unexposedValue;
     591}
     592
     593psF64 p_psImageGetElementF64(psImage* image,
     594                             int col,
     595                             int row)
     596{
     597    if (image == NULL) {
     598        return NAN;
     599    }
     600    if (col < 0 || col >= image->numCols) {
     601        return NAN;
     602    }
     603    if (row < 0 || row >= image->numRows) {
     604        return NAN;
     605    }
     606
     607    switch (image->type.type) {
     608    case PS_TYPE_U8:
     609        return image->data.U8[row][col];
     610        break;
     611    case PS_TYPE_U16:
     612        return image->data.U16[row][col];
     613        break;
     614    case PS_TYPE_U32:
     615        return image->data.U32[row][col];
     616        break;
     617    case PS_TYPE_U64:
     618        return image->data.U64[row][col];
     619        break;
     620    case PS_TYPE_S8:
     621        return image->data.S8[row][col];
     622        break;
     623    case PS_TYPE_S16:
     624        return image->data.S16[row][col];
     625        break;
     626    case PS_TYPE_S32:
     627        return image->data.S32[row][col];
     628        break;
     629    case PS_TYPE_S64:
     630        return image->data.S64[row][col];
     631        break;
     632    case PS_TYPE_F32:
     633        return image->data.F32[row][col];
     634        break;
     635    case PS_TYPE_F64:
     636        return image->data.F64[row][col];
     637    default:
     638        return NAN;
     639    }
    591640}
    592641
  • trunk/psLib/src/mathtypes/psImage.h

    r3702 r3786  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-04-15 00:12:08 $
     13 *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-04-29 02:25:10 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    182182);
    183183
     184/** get an element of an image as a psF64.
     185 *
     186 *  @return psF64   pixel value at specified location
     187 */
     188psF64 p_psImageGetElementF64(
     189    psImage* image,                    ///< input image
     190    int col,                           ///< pixel column
     191    int row                            ///< pixel row
     192);
     193
    184194/** Interpolate image pixel value given floating point coordinates.
    185195 *
     
    225235PIXEL_INTERPOLATE_FCNS(BILINEAR)
    226236PIXEL_INTERPOLATE_FCNS(BILINEAR_VARIANCE)
    227 #endif
     237#endif // ! SWIG
    228238
    229239#undef PIXEL_INTERPOLATE_FCN_PROTOTYPE
     
    232242/// @}
    233243
    234 #endif
     244#endif // PS_IMAGE_H
  • trunk/psLib/src/mathtypes/psVector.c

    r3740 r3786  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-04-21 21:21:01 $
     11*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-04-29 02:25:09 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    526526    }
    527527}
     528
     529bool p_psVectorPrint (FILE *f, psVector *a, char *name)
     530{
     531
     532    fprintf (f, "vector: %s\n", name);
     533
     534    for (int i = 0; i < a[0].n; i++) {
     535        fprintf (f, "%f\n", p_psVectorGetElementF64(a, i));
     536    }
     537    fprintf (f, "\n");
     538    return (true);
     539}
  • trunk/psLib/src/mathtypes/psVector.h

    r3737 r3786  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-04-21 21:18:23 $
     13 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-04-29 02:25:09 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1919#ifndef PS_VECTOR_H
    2020#define PS_VECTOR_H
     21
     22#include<stdio.h>
    2123
    2224#include "psType.h"
     
    162164);
    163165
     166/** Print a vector to a stream
     167 *
     168 *  @return psBool          TRUE is successful, otherwise FALSE.
     169 */
     170bool p_psVectorPrint (
     171    FILE *f,                           ///< output stream
     172    psVector *a,                       ///< vector to print
     173    char *name                         ///< name of vector (for title)
     174);
    164175
    165176/// @}
Note: See TracChangeset for help on using the changeset viewer.