IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1840


Ignore:
Timestamp:
Sep 21, 2004, 12:30:19 PM (22 years ago)
Author:
desonia
Message:

Changed the image code to the new psErrorMsg error handling specification.

Location:
trunk/psLib
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/psLib.kdevses

    r1807 r1840  
    22<!DOCTYPE KDevPrjSession>
    33<KDevPrjSession>
    4  <DocsAndViews NumberOfDocuments="0" />
     4 <DocsAndViews NumberOfDocuments="6" >
     5  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/psErrorCodes.dat" >
     6   <View0 line="14" Type="???" >
     7    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="749" Left="1" MinMaxMode="0" />
     8   </View0>
     9  </Doc0>
     10  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageErrors.dat" >
     11   <View0 line="35" Type="???" >
     12    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="747" Left="1" MinMaxMode="0" />
     13   </View0>
     14  </Doc1>
     15  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageIO.c" >
     16   <View0 line="374" Type="???" >
     17    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="749" Left="1" MinMaxMode="0" />
     18   </View0>
     19  </Doc2>
     20  <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageFFT.c" >
     21   <View0 line="0" Type="???" >
     22    <AdditionalSettings Top="2" Width="1214" Attach="1" Height="747" Left="2" MinMaxMode="0" />
     23   </View0>
     24  </Doc3>
     25  <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageFFT.h" >
     26   <View0 line="0" Type="???" >
     27    <AdditionalSettings Top="2" Width="1214" Attach="1" Height="745" Left="2" MinMaxMode="0" />
     28   </View0>
     29  </Doc4>
     30  <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageErrors.h" >
     31   <View0 line="64" Type="???" >
     32    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="749" Left="1" MinMaxMode="0" />
     33   </View0>
     34  </Doc5>
     35 </DocsAndViews>
    536 <pluginList>
    637  <kdevbookmarks>
     
    1041     <mark line="652" />
    1142     <mark line="593" />
     43    </bookmark>
     44    <bookmark url="/home/desonia/psLib/src/collections/psBitSet.c" >
     45     <mark line="194" />
    1246    </bookmark>
    1347   </bookmarks>
  • trunk/psLib/src/fft/psImageFFT.c

    r1625 r1840  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-08-25 21:10:09 $
     7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-09-21 22:30:19 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psImageExtraction.h"
    2323
     24#include "psImageErrors.h"
     25
    2426#define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2527
     
    4244
    4345    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
    44         psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
     46        char* typeStr;
     47        PS_TYPE_NAME(typeStr,type);
     48        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     49                   PS_ERR_BAD_PARAMETER_TYPE, true,
     50                   PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED,
     51                   typeStr);
    4552        psFree(out);
    4653        return NULL;
     
    4855
    4956    if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
    50         psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
     57        char* typeStr;
     58        PS_TYPE_NAME(typeStr,type);
     59        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     60                   PS_ERR_BAD_PARAMETER_TYPE, true,
     61                   PS_ERRORTEXT_psImageFFT_REVERSE_NOT_COMPLEX,
     62                   typeStr);
    5163        psFree(out);
    5264        return NULL;
     
    5567
    5668    if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
    57         psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
     69        char* typeStr;
     70        PS_TYPE_NAME(typeStr,type);
     71        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     72                   PS_ERR_BAD_PARAMETER_TYPE, true,
     73                   PS_ERRORTEXT_psImageFFT_FORWARD_NOT_REAL,
     74                   typeStr);
    5875        psFree(out);
    5976        return NULL;
     
    6986    numCols = in->numCols;
    7087
     88    // n.b. FFTW can perform a in-place transform at the same or faster than out-of-place.
    7189    out = psImageCopy(out, in, PS_TYPE_C32);
    72 
    7390    plan = fftwf_plan_dft_2d(numCols, numRows,
    7491                             (fftwf_complex *) out->data.C32[0],
    7592                             (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
    7693
    77     /* check if a plan exists now */
     94    /* check if a plan exists now -- if not, it is a real problem */
    7895    if (plan == NULL) {
    79         psError(__func__, "Failed to create FFTW plan.");
     96        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     97                   PS_ERR_BAD_PARAMETER_TYPE, true,
     98                   PS_ERRORTEXT_psImageFFT_FFTW_PLAN_NULL);
    8099        psFree(out);
    81100        return NULL;
     
    106125    numRows = in->numRows;
    107126
    108     /* if not a complex number, this is logically just a copy */
    109     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    110         // Warn user, as this is probably not expected
    111         psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
    112                  "Just an image copy was performed.");
     127    /* if not a complex number, this is logically just a copy then */
     128    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
    113129        return psImageCopy(out, in, type);
    114130    }
     
    141157        }
    142158    } else {
    143         psError(__func__, "Can not extract real component from given image type (%d).", type);
     159        char* typeStr;
     160        PS_TYPE_NAME(typeStr,type);
     161        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReal",
     162                   PS_ERR_BAD_PARAMETER_TYPE, true,
     163                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     164                   typeStr);
     165
    144166        psFree(out);
    145167        return NULL;
     
    164186    numRows = in->numRows;
    165187
    166     /* if not a complex number, this is logically just zeroed image of same size */
    167     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    168         // Warn user, as this is probably not expected
    169         psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
    170                  "A zero image was returned.");
     188    /* if not a complex image type, this is logically just zeroed image of same size */
     189    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
    171190        out = psImageRecycle(out, numCols, numRows, type);
    172191        memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
     
    201220        }
    202221    } else {
    203         psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
     222        char* typeStr;
     223        PS_TYPE_NAME(typeStr,type);
     224        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageImaginary",
     225                   PS_ERR_BAD_PARAMETER_TYPE, true,
     226                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     227                   typeStr);
    204228        psFree(out);
    205229        return NULL;
     
    225249
    226250    if (imag->type.type != type) {
    227         psError(__func__, "The inputs to psImageComplex must be the same type.");
     251        char* typeStrReal;
     252        char* typeStrImag;
     253        PS_TYPE_NAME(typeStrReal,type);
     254        PS_TYPE_NAME(typeStrImag,imag->type.type);
     255        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
     256                   PS_ERR_BAD_PARAMETER_TYPE, true,
     257                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_TYPE_MISMATCH,
     258                   typeStrReal,typeStrImag);
    228259        psFree(out);
    229260        return NULL;
     
    231262
    232263    if (imag->numCols != numCols || imag->numRows != numRows) {
    233         psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
    234         psFree(out);
    235         return NULL;
    236     }
    237 
    238     if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    239         psError(__func__, "The inputs to psImageComplex can not be complex.");
    240         psFree(out);
    241         return NULL;
    242     }
    243 
    244     if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    245         psError(__func__, "The input type to psImageComplex must be a floating point.");
     264        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
     265                   PS_ERR_BAD_PARAMETER_VALUE, true,
     266                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_SIZE_MISMATCH,
     267                   numCols, numRows, imag->numCols, imag->numRows);
    246268        psFree(out);
    247269        return NULL;
     
    280302        }
    281303    } else {
    282         psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
    283         psFree(out);
    284         return NULL;
    285     }
     304        char* typeStr;
     305        PS_TYPE_NAME(typeStr,type);
     306        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
     307                   PS_ERR_BAD_PARAMETER_TYPE, true,
     308                   PS_ERRORTEXT_psImageFFT_NONREAL_NOTSUPPORTED,
     309                   typeStr);
     310        psFree(out);
     311        return NULL;
     312    }
     313
    286314
    287315    return out;
     
    303331    numRows = in->numRows;
    304332
    305     /* if not a complex number, this is logically just a image copy */
    306     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    307         // Warn user, as this is probably not expected
    308         psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
    309                  "Image copy was performed instead.");
     333    /* if not a complex image, this is logically just a image copy */
     334    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
    310335        return psImageCopy(out, in, type);
    311336    }
     
    338363        }
    339364    } else {
    340         psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
     365        char* typeStr;
     366        PS_TYPE_NAME(typeStr,type);
     367        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConjugate",
     368                   PS_ERR_BAD_PARAMETER_TYPE, true,
     369                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
     370                   typeStr);
    341371        psFree(out);
    342372        return NULL;
     
    362392    numRows = in->numRows;
    363393    numElementsSquared = numCols * numCols * numRows * numRows;
    364 
    365     /* if not a complex number, this is not implemented */
    366     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    367         psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
    368         psFree(out);
    369         return NULL;
    370     }
    371394
    372395    if (type == PS_TYPE_C32) {
     
    405428        }
    406429    } else {
    407         psError(__func__, "Can not power spectrum for given image type (%d).", type);
    408         psFree(out);
    409         return NULL;
    410     }
    411 
    412     return out;
    413 
    414 }
     430        char* typeStr;
     431        PS_TYPE_NAME(typeStr,type);
     432        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePowerSpectrum",
     433                   PS_ERR_BAD_PARAMETER_TYPE, true,
     434                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
     435                   typeStr);
     436        psFree(out);
     437        return NULL;
     438    }
     439
     440    return out;
     441
     442}
  • trunk/psLib/src/image/psImage.c

    r1818 r1840  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-16 18:51:31 $
     12 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-21 22:30:19 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    224224    }
    225225
    226     #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                             \
     226    #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                     \
    227227case PS_TYPE_##TYPE:                                                 \
    228228    switch (mode) {                                                  \
     
    237237    default:                                                         \
    238238        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",    \
    239                    PS_ERR_BAD_PARAMETER_VALUE,true,                     \
    240                    PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,     \
    241                    mode);                                               \
    242     }                                                                    \
     239                   PS_ERR_BAD_PARAMETER_VALUE,true,                  \
     240                   PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,  \
     241                   mode);                                            \
     242    }                                                                \
    243243    break
    244244
     
    256256        PSIMAGE_PIXEL_INTERPOLATE_CASE(C32);
    257257        PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);
    258     default:
    259         psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
    260                    PS_ERR_BAD_PARAMETER_TYPE,true,
    261                    PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
    262                    input->type.type);
     258    default: {
     259            char* typeStr;
     260            PS_TYPE_NAME(typeStr,input->type.type);
     261            psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
     262                       PS_ERR_BAD_PARAMETER_TYPE,true,
     263                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     264                       typeStr);
     265        }
    263266    }
    264267
  • trunk/psLib/src/image/psImageConvolve.c

    r1653 r1840  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-08-28 01:18:28 $
     7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-09-21 22:30:19 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1616#include "psLogMsg.h"
    1717#include "psError.h"
     18
     19#include "psImageErrors.h"
    1820
    1921static void freeKernel(psKernel* ptr);
     
    7678}
    7779
    78 psKernel *psKernelGenerate(const psVector *xShifts, const psVector *yShifts)
     80psKernel* psKernelGenerate(const psVector* xShifts, const psVector* yShifts)
    7981{
    8082    int x = 0;
     
    9193    // got non-NULL vectors?
    9294    if (xShifts == NULL || yShifts == NULL) {
    93         psError(__func__,"Shift vectors can not be NULL.");
     95        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
     96                   PS_ERR_BAD_PARAMETER_NULL, true,
     97                   PS_ERRORTEXT_psImageConvolve_SHIFT_NULL);
    9498        return NULL;
    9599    }
    96100
     101    // types match?
    97102    if (xShifts->type.type != yShifts->type.type) {
    98         psError(__func__,"Shift vectors can not be different data types.");
     103        char* typeXStr;
     104        char* typeYStr;
     105        PS_TYPE_NAME(typeXStr,xShifts->type.type);
     106        PS_TYPE_NAME(typeYStr,yShifts->type.type);
     107        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
     108                   PS_ERR_BAD_PARAMETER_TYPE, true,
     109                   PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH,
     110                   typeXStr, typeYStr);
    99111        return NULL;
    100112    }
     
    158170        KERNEL_GENERATE_CASE(C32);
    159171        KERNEL_GENERATE_CASE(C64);
    160     default:
    161         psError(__func__,"Shift vector datatype not supported.");
     172
     173    default: {
     174            char* typeStr;
     175            PS_TYPE_NAME(typeStr,xShifts->type.type);
     176            psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
     177                       PS_ERR_BAD_PARAMETER_TYPE, true,
     178                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     179                       typeStr);
     180        }
    162181    }
    163182
  • trunk/psLib/src/image/psImageErrors.dat

    r1818 r1840  
    1111psImage_NOT_AN_IMAGE                   The input psImage must have a PS_DIMEN_IMAGE dimension type.
    1212psImage_IMAGE_NULL                     Can not operate on a NULL psImage.
    13 psImage_IMAGE_TYPE_UNSUPPORTED         Specified psImage type (%d) is not supported.
     13psImage_IMAGE_TYPE_UNSUPPORTED         Specified psImage type (%s) is not supported.
    1414psImage_INTERPOLATE_METHOD_INVALID     Specified interpolation method (%d) is not supported.
     15psImage_SUBSET_RANGE_INVALID           Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d].
     16psImage_SUBSECTION_NULL                Specified subsection string can not be NULL.
     17psImage_SUBSECTION_INVALID             Specified subsection string, '%s', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'.
     18psImage_NOT_PARENT                     Specified psImage can not be a child of another psImage.
     19psImage_INPLACE_NOTSUPPORTED           Specified input and output psImage can not reference the same psImage.
     20psImage_SUBSET_ZERO_SIZE               Specified subset, [%d:%d,%d:%d], contains no pixel data.
     21psImage_IMAGE_MASK_SIZE                Input psImage mask size, %dx%d, does not match psImage input size, %dx%d.
     22psImage_IMAGE_MASK_TYPE                Input psImage mask type, %s, is not the supported mask datatype of %s.
     23psImage_BAD_STAT                       Specified statistic option, %d, is not valid.  Must specify one and only one statistic type.
     24psImage_NO_STAT_OPTIONS                Specified statistic option did not indicate any operation to perform.
     25psImage_STAT_NULL                      Specified statistic can not be NULL.
     26psImage_SLICE_DIRECTION_INVALID        Specified slice direction, %d, is invalid.
     27psImage_PARAMETER_OUTOF_TYPERANGE      Specified %s value, %g, is outside of psImage type's range (%s: %g to %g).
     28#
     29psImageFFT_IMAGE_TYPE_UNSUPPORTED      Input psImage type (%s) is not supported. Valid image types are psF32 and psC32.
     30psImageFFT_REVERSE_NOT_COMPLEX         Input psImage (%s) is not complex.  Reverse FFT operation requires a complex psImage input.
     31psImageFFT_FORWARD_NOT_REAL            Input psImage (%s) is not real.  Forward FFT operation requires a real psImage input.
     32psImageFFT_FFTW_PLAN_NULL              Could not create a valid FFT plan to perform the transform.
     33psImageFFT_REAL_IMAG_TYPE_MISMATCH     Real psImage type (%s) and imaginary psImage type (%s) must be the same.
     34psImageFFT_REAL_IMAG_SIZE_MISMATCH     Real psImage size (%dx%d) and imaginary psImage size (%dx%d) must be the same.
     35psImageFFT_NONREAL_NOTSUPPORTED        Input psImage type, %s, is required to be either psF32 or psF64.
     36psImageFFT_NONCOMPLEX_NOTSUPPORTED     Input psImage type, %s, is required to be either psC32 or psC64.
     37#
     38psImageIO_FILENAME_NULL                Specified filename can not be NULL.
     39psImageIO_FILENAME_INVALID             Could not open file,'%s'.\nCFITSIO Error: %s
     40psImageIO_EXTNAME_INVALID              Could not find HDU with extension name '%s' in file %s.\nCFITSIO Error: %s
     41psImageIO_EXTNUM_INVALID               Could not find HDU #%d in file %s.\nCFITSIO Error: %s
     42psImageIO_DATATYPE_UNKNOWN             Could not determine image data type for file %s.\nCFITSIO Error: %s
     43psImageIO_IMAGE_DIM_UNKNOWN            Could not determine image dimensions for file %s.\nCFITSIO Error: %s
     44psImageIO_IMAGE_SIZE_UNKNOWN           Could not determine image size for file %s.\nCFITSIO Error: %s
     45psImageIO_IMAGE_DIMENSION_UNSUPPORTED  Image number of dimensions, %d, is not valid.  Only two or three dimensions supported for FITS I/O.
     46psImageIO_FITS_TYPE_UNSUPPORTED        FITS image type, BITPIX=%d, in file %s is not supported.
     47psImageIO_READ_FAILED                  Reading from FITS file %s failed.\nCFITSIO Error: %s
     48psImageIO_TYPE_UNSUPPORTED             Input psImage type, %s, is not supported.
     49psImageIO_WRITE_EXTNUM_INVALID         Specified extension number, %d, must not exceed number of HDUs, %d, by more than one.
     50psImageIO_FILENAME_CREATE_FAILED       Could not create file,'%s'.\nCFITSIO Error: %s
     51psImageIO_CREATE_EXTENSION_FAILED      Could not create EXTNAME keyword for file,'%s'.\nCFITSIO Error: %s
     52psImageIO_CREATE_HDU_FAILED            Could not create HDU for writing psImage in file,'%s'.\nCFITSIO Error: %s
     53psImageIO_WRITE_FAILED                 Could not write psImage data to file,'%s'.\nCFITSIO Error: %s
     54#
     55psImageManip_MAXMIN                    Specified min value, %g, can not be greater than the specified max value, %g.
     56psImageManip_MAXMIN_REAL               Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g.
     57psImageManip_MAXMIN_IMAG               Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g.
     58psImageManip_OPERATION_NULL            Operation can not be NULL.
     59psImageManip_OVERLAY_TYPE_MISMATCH     Input overlay psImage type, %s, must match input psImage type, %s.
     60psImageManip_CLIP_VALUE_INVALID        Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]. 
     61psImageManip_OVERLAY_OPERATOR_INVALID  Specified operation, '%s', is not supported.
     62psImageManip_SCALE_NOT_POSITIVE        Specified scale value, %d, must be a positive value.
     63psImageManip_INTERPOLATION_MODE_UNSUPPORTED Specified interpolation mode, %d, is unsupported.
     64psImageConvolve_SHIFT_NULL                Specified shift vectors can not be NULL.
     65psImageConvolve_SHIFT_TYPE_MISMATCH    The X-shift vector type, %s, does not match the Y-shift vector type, %s.  Types must match.
  • trunk/psLib/src/image/psImageErrors.h

    r1818 r1840  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-16 18:51:31 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-21 22:30:19 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333#define PS_ERRORTEXT_psImage_NOT_AN_IMAGE "The input psImage must have a PS_DIMEN_IMAGE dimension type."
    3434#define PS_ERRORTEXT_psImage_IMAGE_NULL "Can not operate on a NULL psImage."
    35 #define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type (%d) is not supported."
     35#define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type (%s) is not supported."
    3636#define PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID "Specified interpolation method (%d) is not supported."
     37#define PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID "Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d]."
     38#define PS_ERRORTEXT_psImage_SUBSECTION_NULL "Specified subsection string can not be NULL."
     39#define PS_ERRORTEXT_psImage_SUBSECTION_INVALID "Specified subsection string, '%s', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'."
     40#define PS_ERRORTEXT_psImage_NOT_PARENT "Specified psImage can not be a child of another psImage."
     41#define PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED "Specified input and output psImage can not reference the same psImage."
     42#define PS_ERRORTEXT_psImage_SUBSET_ZERO_SIZE "Specified subset, [%d:%d,%d:%d], contains no pixel data."
     43#define PS_ERRORTEXT_psImage_IMAGE_MASK_SIZE "Input psImage mask size, %dx%d, does not match psImage input size, %dx%d."
     44#define PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE "Input psImage mask type, %s, is not the supported mask datatype of %s."
     45#define PS_ERRORTEXT_psImage_BAD_STAT "Specified statistic option, %d, is not valid.  Must specify one and only one statistic type."
     46#define PS_ERRORTEXT_psImage_NO_STAT_OPTIONS "Specified statistic option did not indicate any operation to perform."
     47#define PS_ERRORTEXT_psImage_STAT_NULL "Specified statistic can not be NULL."
     48#define PS_ERRORTEXT_psImage_SLICE_DIRECTION_INVALID "Specified slice direction, %d, is invalid."
     49#define PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE "Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."
     50#define PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED "Input psImage type (%s) is not supported. Valid image types are psF32 and psC32."
     51#define PS_ERRORTEXT_psImageFFT_REVERSE_NOT_COMPLEX "Input psImage (%s) is not complex.  Reverse FFT operation requires a complex psImage input."
     52#define PS_ERRORTEXT_psImageFFT_FORWARD_NOT_REAL "Input psImage (%s) is not real.  Forward FFT operation requires a real psImage input."
     53#define PS_ERRORTEXT_psImageFFT_FFTW_PLAN_NULL "Could not create a valid FFT plan to perform the transform."
     54#define PS_ERRORTEXT_psImageFFT_REAL_IMAG_TYPE_MISMATCH "Real psImage type (%s) and imaginary psImage type (%s) must be the same."
     55#define PS_ERRORTEXT_psImageFFT_REAL_IMAG_SIZE_MISMATCH "Real psImage size (%dx%d) and imaginary psImage size (%dx%d) must be the same."
     56#define PS_ERRORTEXT_psImageFFT_NONREAL_NOTSUPPORTED "Input psImage type, %s, is required to be either psF32 or psF64."
     57#define PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED "Input psImage type, %s, is required to be either psC32 or psC64."
     58#define PS_ERRORTEXT_psImageIO_FILENAME_NULL "Specified filename can not be NULL."
     59#define PS_ERRORTEXT_psImageIO_FILENAME_INVALID "Could not open file,'%s'.\nCFITSIO Error: %s"
     60#define PS_ERRORTEXT_psImageIO_EXTNAME_INVALID "Could not find HDU with extension name '%s' in file %s.\nCFITSIO Error: %s"
     61#define PS_ERRORTEXT_psImageIO_EXTNUM_INVALID "Could not find HDU #%d in file %s.\nCFITSIO Error: %s"
     62#define PS_ERRORTEXT_psImageIO_DATATYPE_UNKNOWN "Could not determine image data type for file %s.\nCFITSIO Error: %s"
     63#define PS_ERRORTEXT_psImageIO_IMAGE_DIM_UNKNOWN "Could not determine image dimensions for file %s.\nCFITSIO Error: %s"
     64#define PS_ERRORTEXT_psImageIO_IMAGE_SIZE_UNKNOWN "Could not determine image size for file %s.\nCFITSIO Error: %s"
     65#define PS_ERRORTEXT_psImageIO_IMAGE_DIMENSION_UNSUPPORTED "Image number of dimensions, %d, is not valid.  Only two or three dimensions supported for FITS I/O."
     66#define PS_ERRORTEXT_psImageIO_FITS_TYPE_UNSUPPORTED "FITS image type, BITPIX=%d, in file %s is not supported."
     67#define PS_ERRORTEXT_psImageIO_READ_FAILED "Reading from FITS file %s failed.\nCFITSIO Error: %s"
     68#define PS_ERRORTEXT_psImageIO_TYPE_UNSUPPORTED "Input psImage type, %s, is not supported."
     69#define PS_ERRORTEXT_psImageIO_WRITE_EXTNUM_INVALID "Specified extension number, %d, must not exceed number of HDUs, %d, by more than one."
     70#define PS_ERRORTEXT_psImageIO_FILENAME_CREATE_FAILED "Could not create file,'%s'.\nCFITSIO Error: %s"
     71#define PS_ERRORTEXT_psImageIO_CREATE_EXTENSION_FAILED "Could not create EXTNAME keyword for file,'%s'.\nCFITSIO Error: %s"
     72#define PS_ERRORTEXT_psImageIO_CREATE_HDU_FAILED "Could not create HDU for writing psImage in file,'%s'.\nCFITSIO Error: %s"
     73#define PS_ERRORTEXT_psImageIO_WRITE_FAILED "Could not write psImage data to file,'%s'.\nCFITSIO Error: %s"
     74#define PS_ERRORTEXT_psImageManip_MAXMIN "Specified min value, %g, can not be greater than the specified max value, %g."
     75#define PS_ERRORTEXT_psImageManip_MAXMIN_REAL "Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g."
     76#define PS_ERRORTEXT_psImageManip_MAXMIN_IMAG "Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g."
     77#define PS_ERRORTEXT_psImageManip_OPERATION_NULL "Operation can not be NULL."
     78#define PS_ERRORTEXT_psImageManip_OVERLAY_TYPE_MISMATCH "Input overlay psImage type, %s, must match input psImage type, %s."
     79#define PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID "Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g].  "
     80#define PS_ERRORTEXT_psImageManip_OVERLAY_OPERATOR_INVALID "Specified operation, '%s', is not supported."
     81#define PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE "Specified scale value, %d, must be a positive value."
     82#define PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED "Specified interpolation mode, %d, is unsupported."
     83#define PS_ERRORTEXT_psImageConvolve_SHIFT_NULL "Specified shift vectors can not be NULL."
     84#define PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH "The X-shift vector type, %s, does not match the Y-shift vector type, %s.  Types must match."
    3785//~End
    3886
  • trunk/psLib/src/image/psImageExtraction.c

    r1613 r1840  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-25 00:04:01 $
     12*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-09-21 22:30:19 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psImageExtraction.h"
    2323#include "psError.h"
     24
     25#include "psImageErrors.h"
    2426
    2527psImage* psImageSubset(psImage* image,
     
    3436
    3537    if (image == NULL || image->data.V == NULL) {
    36         psError(__func__, "Can not subset image because input image or its pixel buffer is NULL.");
     38        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
     39                   PS_ERR_BAD_PARAMETER_NULL, true,
     40                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    3741        return NULL;
    3842    }
    3943
    4044    if (image->type.dimen != PS_DIMEN_IMAGE) {
    41         psError(__func__, "Can not subset image because input image is not an image.");
     45        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
     46                   PS_ERR_BAD_PARAMETER_TYPE, true,
     47                   PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
    4248        return NULL;
    4349    }
    4450
    4551    if (numCols < 1 || numRows < 1) {
    46         psError(__func__,
    47                 "Can not subset image because number of rows or columns are zero (%dx%d).", numCols, numRows);
    48         return NULL;
    49     }
    50 
    51     if (col0 >= image->numCols || row0 >= image->numRows) {
    52         psError(__func__,
    53                 "Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.", col0, row0);
    54         return NULL;
    55     }
    56 
    57     /* validate subimage size */
    58     if (col0 + numCols >= image->numCols || row0 + numRows >= image->numRows) {
    59         psError(__func__,
    60                 "Can not subset image outside of image boundaries (size=%dx%d, "
    61                 "subset=[%d:%d,%d:%d]).",
    62                 image->numCols, image->numRows, col0, col0 + numCols, row0, row0 + numRows);
     52        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
     53                   PS_ERR_BAD_PARAMETER_VALUE, true,
     54                   PS_ERRORTEXT_psImage_AREA_NEGATIVE,
     55                   numCols,numRows);
     56        return NULL;
     57    }
     58
     59    if ( col0 >= image->numCols ||
     60            row0 >= image->numRows ||
     61            col0 + numCols >= image->numCols ||
     62            row0 + numRows >= image->numRows ) {
     63        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
     64                   PS_ERR_BAD_PARAMETER_VALUE, true,
     65                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
     66                   col0, col0 + numCols, row0, row0 + numRows,
     67                   image->numCols, image->numRows);
    6368        return NULL;
    6469    }
     
    104109    // section should be of the form '[x1:x2,y1:y2]'
    105110    if (section == NULL) {
    106         psError(__func__,"The subsection string input can not be NULL.");
     111        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubsection",
     112                   PS_ERR_BAD_PARAMETER_NULL, true,
     113                   PS_ERRORTEXT_psImage_SUBSECTION_NULL);
    107114        return NULL;
    108115    }
    109116
    110117    if (sscanf(section,"[%d:%d,%d:%d]",&x1,&x2,&y1,&y2) < 4) {
    111         psError(__func__,"The subsection string (%s) can not be parsed.  "
    112                 "Needs to be of the form '[x1:x2,y1:y2]'",
    113                 section);
     118        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubsection",
     119                   PS_ERR_BAD_PARAMETER_NULL, true,
     120                   PS_ERRORTEXT_psImage_SUBSECTION_INVALID,
     121                   section);
    114122        return NULL;
    115123    }
     
    120128{
    121129    if (image == NULL || image->data.V == NULL) {
    122         psError(__func__, "Can not subset image because input image or its "
    123                 "pixel buffer is NULL.");
     130        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim",
     131                   PS_ERR_BAD_PARAMETER_NULL, true,
     132                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    124133        return NULL;
    125134    }
    126135
    127136    if (image->parent != NULL) {
    128         psError(__func__, "Can not perform a trim on a child image.");
     137        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim",
     138                   PS_ERR_BAD_PARAMETER_NULL, true,
     139                   PS_ERRORTEXT_psImage_NOT_PARENT);
    129140        return NULL;
    130141    }
     
    134145            y0 >= image->numRows || y1 >= image->numRows ||
    135146            x0 > x1 || y0 > y1 ) {
    136         psError(__func__, "Can not subset image because specified region "
    137                 "[%d:%d,%d:%d] is not valid for image of size %dx%d.",
    138                 x0,x1,y0,y1,image->numCols,image->numRows);
     147        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim",
     148                   PS_ERR_BAD_PARAMETER_VALUE, true,
     149                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
     150                   x0, x1, y0, y1,
     151                   image->numCols, image->numRows);
    139152        return NULL;
    140153    }
     
    179192
    180193    if (input == NULL || input->data.V == NULL) {
    181         psError(__func__, "Can not copy image because input image or its pixel buffer is NULL.");
     194        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
     195                   PS_ERR_BAD_PARAMETER_NULL, true,
     196                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    182197        psFree(output);
    183198        return NULL;
     
    185200
    186201    if (input == output) {
    187         psError(__func__,
    188                 "Can not copy image because given input and output "
    189                 "parameter reference the same psImage struct.");
     202        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
     203                   PS_ERR_BAD_PARAMETER_NULL, true,
     204                   PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED);
    190205        psFree(output);
    191206        return NULL;
     
    193208
    194209    if (input->type.dimen != PS_DIMEN_IMAGE) {
    195         psError(__func__, "Can not copy image because input image is not actually an image.");
     210        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
     211                   PS_ERR_BAD_PARAMETER_TYPE, true,
     212                   PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
    196213        psFree(output);
    197214        return NULL;
     
    205222
    206223    if (inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR) {
    207         psError(__func__, "Can not copy image to/from a void* matrix");
     224        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
     225                   PS_ERR_BAD_PARAMETER_TYPE, true,
     226                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     227                   PS_TYPE_PTR_NAME);
    208228        psFree(output);
    209229        return NULL;
     
    220240        return output;
    221241    }
     242
    222243    #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
    223244        ps##INTYPE *in; \
     
    232253    }
    233254
    234     #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) \
    235     switch (inDatatype) { \
    236     case PS_TYPE_S8: \
    237         PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
    238         break; \
    239     case PS_TYPE_S16: \
    240         PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
    241         break; \
    242     case PS_TYPE_S32: \
    243         PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
    244         break; \
    245     case PS_TYPE_S64: \
    246         PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
    247         break; \
    248     case PS_TYPE_U8: \
    249         PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
    250         break; \
    251     case PS_TYPE_U16: \
    252         PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
    253         break; \
    254     case PS_TYPE_U32: \
    255         PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
    256         break; \
    257     case PS_TYPE_U64: \
    258         PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
    259         break; \
    260     case PS_TYPE_F32: \
    261         PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
    262         break; \
    263     case PS_TYPE_F64: \
    264         PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
    265         break; \
    266     case PS_TYPE_C32: \
    267         PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
    268         break; \
    269     case PS_TYPE_C64: \
    270         PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
    271         break; \
    272     default: \
    273         break; \
     255    #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) { \
     256        switch (inDatatype) { \
     257        case PS_TYPE_S8: \
     258            PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
     259            break; \
     260        case PS_TYPE_S16: \
     261            PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
     262            break; \
     263        case PS_TYPE_S32: \
     264            PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
     265            break; \
     266        case PS_TYPE_S64: \
     267            PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
     268            break; \
     269        case PS_TYPE_U8: \
     270            PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
     271            break; \
     272        case PS_TYPE_U16: \
     273            PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
     274            break; \
     275        case PS_TYPE_U32: \
     276            PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
     277            break; \
     278        case PS_TYPE_U64: \
     279            PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
     280            break; \
     281        case PS_TYPE_F32: \
     282            PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
     283            break; \
     284        case PS_TYPE_F64: \
     285            PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
     286            break; \
     287        case PS_TYPE_C32: \
     288            PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
     289            break; \
     290        case PS_TYPE_C64: \
     291            PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
     292            break; \
     293        default: \
     294            break; \
     295        } \
    274296    }
    275297
     
    311333        PSIMAGE_COPY_CASE(output, C64);
    312334        break;
    313     default:
    314         break;
     335    default: {
     336            char* typeStr;
     337            PS_TYPE_NAME(typeStr,type);
     338            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
     339                       PS_ERR_BAD_PARAMETER_TYPE, true,
     340                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     341                       typeStr);
     342            psFree(output);
     343
     344            break;
     345        }
    315346    }
    316347    return output;
     
    338369
    339370    if (in == NULL || in->data.V == NULL) {
    340         psError(__func__, "Input image can not be NULL.");
     371        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     372                   PS_ERR_BAD_PARAMETER_NULL, true,
     373                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    341374        psFree(out);
    342375        return NULL;
    343376    }
    344377
    345     if (numRows == 0 || numCols == 0) {
    346         psError(__func__, "The specified region contains no data (%dx%d)", numCols, numRows);
     378    if (numRows < 1 || numCols < 1) {
     379        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     380                   PS_ERR_BAD_PARAMETER_NULL, true,
     381                   PS_ERRORTEXT_psImage_SUBSET_ZERO_SIZE,
     382                   col,col+numCols,row,row+numRows);
    347383        psFree(out);
    348384        return NULL;
     
    374410    if (mask != NULL) {
    375411        if (inRows != mask->numRows || inCols != mask->numCols) {
    376             psError(__func__,
    377                     "The mask and image dimensions did not match (%dx%d vs %dx%d)",
    378                     mask->numCols, mask->numRows, in->numCols, in->numRows);
     412            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     413                       PS_ERR_BAD_PARAMETER_VALUE, true,
     414                       PS_ERRORTEXT_psImage_IMAGE_MASK_SIZE,
     415                       mask->numCols,mask->numRows,
     416                       inCols, inRows);
    379417            psFree(out);
    380418        }
    381419        if (mask->type.type != PS_TYPE_MASK) {
    382             psError(__func__, "The mask datatype (%d) must be %s.", mask->type.type, PS_TYPE_MASK_NAME);
     420            char* typeStr;
     421            PS_TYPE_NAME(typeStr,mask->type.type);
     422            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     423                       PS_ERR_BAD_PARAMETER_TYPE, true,
     424                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
     425                       typeStr, PS_TYPE_MASK_NAME);
    383426            psFree(out);
    384427        }
    385428    }
    386429
    387     if (row >= inRows || col >= inCols || col + numCols > in->numCols || row + numRows > in->numRows) {
    388         psError(__func__,
    389                 "The specified image region (%d,%d to %d,%d) is outside of image area (0,0 to %d,%d).",
    390                 col, row, col + numCols - 1, row + numRows - 1, in->numCols - 1, in->numRows - 1);
     430    if (row >= inRows || col >= inCols || col + numCols > inCols || row + numRows > inRows) {
     431        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     432                   PS_ERR_BAD_PARAMETER_VALUE, true,
     433                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
     434                   col, row, col+numCols, row+numRows,
     435                   inCols, inRows);
    391436        psFree(out);
    392437        return NULL;
    393438    }
     439
     440    if (stats == NULL) {
     441        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     442                   PS_ERR_BAD_PARAMETER_NULL, true,
     443                   PS_ERRORTEXT_psImage_STAT_NULL);
     444        psFree(out);
     445        return NULL;
     446    }
     447
    394448    // verify that the stats struct specifies a
    395449    // single stats operation
    396     if (stats == NULL || p_psGetStatValue(stats, &statVal) == false) {
    397         psError(__func__, "The stat options didn't specify a single supported statistic type.");
     450    if (p_psGetStatValue(stats, &statVal) == false) {
     451        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     452                   PS_ERR_BAD_PARAMETER_VALUE, false,
     453                   PS_ERRORTEXT_psImage_BAD_STAT);
    398454        psFree(out);
    399455        return NULL;
     
    410466        psU32* outPosition = NULL;
    411467
    412         // recycle output to make a proper
    413         // sized/type output structure
    414         // n.b. type is double as that is the
    415         // type given for all stats in
     468        // recycle output to make a proper sized/type output structure
     469        // n.b. type is double as that is the type given for all stats is
    416470        // psStats.
    417471        out = psVectorRecycle(out, numCols, PS_TYPE_F64);
     
    474528            PSIMAGE_CUT_VERTICAL(C32);
    475529            PSIMAGE_CUT_VERTICAL(C64);
    476         default:
    477             psError(__func__, "Unsupported datatype (%d)", type);
    478             psFree(out);
    479             out = NULL;
     530        default: {
     531                char* typeStr;
     532                PS_TYPE_NAME(typeStr,type);
     533                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     534                           PS_ERR_BAD_PARAMETER_TYPE, true,
     535                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     536                           typeStr);
     537                psFree(out);
     538                out = NULL;
     539            }
    480540        }
    481541        psFree(imgVec);
    482542        psFree(maskVec);
    483     } else if (direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG) {        // Cut
    484         //
    485         //
    486         //
    487         //
    488         //
    489         //
    490         //
    491         //
    492         //
    493         // in
    494         // Y
    495         // direction
     543    } else if (direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG) {
     544        // Cut in Y direction
    496545        psVector* imgVec = NULL;
    497546        psVector* maskVec = NULL;
     
    509558            maskVec->n = maskVec->nalloc = numCols;
    510559        }
    511         // recycle output to make a proper
    512         // sized/type output structure
    513         // n.b. type is double as that is the
    514         // type given for all stats in
     560        // recycle output to make a proper sized/type output structure
     561        // n.b. type is double as that is the type given for all stats in
    515562        // psStats.
    516563        out = psVectorRecycle(out, numRows, PS_TYPE_F64);
     
    535582            }
    536583            myStats = psVectorStats(myStats, imgVec, maskVec, maskVal);
    537             (void)p_psGetStatValue(myStats, &statVal);  // we
    538             // know
    539             // it
    540             // works
    541             // cause we tested it
    542             // above
     584            (void)p_psGetStatValue(myStats, &statVal);  // we know it works cause we tested it above
    543585            *outData = statVal;
    544586            if (outPosition != NULL) {
     
    551593        psFree(imgVec);
    552594        psFree(maskVec);
    553     } else {                               // don't
    554         // know
    555         // what
    556         // the
    557         // direction
    558         // flag
    559         // is
    560         psError(__func__, "Invalid direction flag (%d)", direction);
     595    } else { // don't know what the direction flag is
     596        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
     597                   PS_ERR_BAD_PARAMETER_VALUE, true,
     598                   PS_ERRORTEXT_psImage_SLICE_DIRECTION_INVALID,
     599                   direction);
    561600        psFree(out);
    562601        out = NULL;
  • trunk/psLib/src/image/psImageFFT.c

    r1625 r1840  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-08-25 21:10:09 $
     7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-09-21 22:30:19 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psImageExtraction.h"
    2323
     24#include "psImageErrors.h"
     25
    2426#define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2527
     
    4244
    4345    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
    44         psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
     46        char* typeStr;
     47        PS_TYPE_NAME(typeStr,type);
     48        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     49                   PS_ERR_BAD_PARAMETER_TYPE, true,
     50                   PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED,
     51                   typeStr);
    4552        psFree(out);
    4653        return NULL;
     
    4855
    4956    if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
    50         psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
     57        char* typeStr;
     58        PS_TYPE_NAME(typeStr,type);
     59        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     60                   PS_ERR_BAD_PARAMETER_TYPE, true,
     61                   PS_ERRORTEXT_psImageFFT_REVERSE_NOT_COMPLEX,
     62                   typeStr);
    5163        psFree(out);
    5264        return NULL;
     
    5567
    5668    if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
    57         psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
     69        char* typeStr;
     70        PS_TYPE_NAME(typeStr,type);
     71        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     72                   PS_ERR_BAD_PARAMETER_TYPE, true,
     73                   PS_ERRORTEXT_psImageFFT_FORWARD_NOT_REAL,
     74                   typeStr);
    5875        psFree(out);
    5976        return NULL;
     
    6986    numCols = in->numCols;
    7087
     88    // n.b. FFTW can perform a in-place transform at the same or faster than out-of-place.
    7189    out = psImageCopy(out, in, PS_TYPE_C32);
    72 
    7390    plan = fftwf_plan_dft_2d(numCols, numRows,
    7491                             (fftwf_complex *) out->data.C32[0],
    7592                             (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
    7693
    77     /* check if a plan exists now */
     94    /* check if a plan exists now -- if not, it is a real problem */
    7895    if (plan == NULL) {
    79         psError(__func__, "Failed to create FFTW plan.");
     96        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
     97                   PS_ERR_BAD_PARAMETER_TYPE, true,
     98                   PS_ERRORTEXT_psImageFFT_FFTW_PLAN_NULL);
    8099        psFree(out);
    81100        return NULL;
     
    106125    numRows = in->numRows;
    107126
    108     /* if not a complex number, this is logically just a copy */
    109     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    110         // Warn user, as this is probably not expected
    111         psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
    112                  "Just an image copy was performed.");
     127    /* if not a complex number, this is logically just a copy then */
     128    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
    113129        return psImageCopy(out, in, type);
    114130    }
     
    141157        }
    142158    } else {
    143         psError(__func__, "Can not extract real component from given image type (%d).", type);
     159        char* typeStr;
     160        PS_TYPE_NAME(typeStr,type);
     161        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReal",
     162                   PS_ERR_BAD_PARAMETER_TYPE, true,
     163                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     164                   typeStr);
     165
    144166        psFree(out);
    145167        return NULL;
     
    164186    numRows = in->numRows;
    165187
    166     /* if not a complex number, this is logically just zeroed image of same size */
    167     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    168         // Warn user, as this is probably not expected
    169         psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
    170                  "A zero image was returned.");
     188    /* if not a complex image type, this is logically just zeroed image of same size */
     189    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
    171190        out = psImageRecycle(out, numCols, numRows, type);
    172191        memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
     
    201220        }
    202221    } else {
    203         psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
     222        char* typeStr;
     223        PS_TYPE_NAME(typeStr,type);
     224        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageImaginary",
     225                   PS_ERR_BAD_PARAMETER_TYPE, true,
     226                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     227                   typeStr);
    204228        psFree(out);
    205229        return NULL;
     
    225249
    226250    if (imag->type.type != type) {
    227         psError(__func__, "The inputs to psImageComplex must be the same type.");
     251        char* typeStrReal;
     252        char* typeStrImag;
     253        PS_TYPE_NAME(typeStrReal,type);
     254        PS_TYPE_NAME(typeStrImag,imag->type.type);
     255        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
     256                   PS_ERR_BAD_PARAMETER_TYPE, true,
     257                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_TYPE_MISMATCH,
     258                   typeStrReal,typeStrImag);
    228259        psFree(out);
    229260        return NULL;
     
    231262
    232263    if (imag->numCols != numCols || imag->numRows != numRows) {
    233         psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
    234         psFree(out);
    235         return NULL;
    236     }
    237 
    238     if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    239         psError(__func__, "The inputs to psImageComplex can not be complex.");
    240         psFree(out);
    241         return NULL;
    242     }
    243 
    244     if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    245         psError(__func__, "The input type to psImageComplex must be a floating point.");
     264        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
     265                   PS_ERR_BAD_PARAMETER_VALUE, true,
     266                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_SIZE_MISMATCH,
     267                   numCols, numRows, imag->numCols, imag->numRows);
    246268        psFree(out);
    247269        return NULL;
     
    280302        }
    281303    } else {
    282         psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
    283         psFree(out);
    284         return NULL;
    285     }
     304        char* typeStr;
     305        PS_TYPE_NAME(typeStr,type);
     306        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
     307                   PS_ERR_BAD_PARAMETER_TYPE, true,
     308                   PS_ERRORTEXT_psImageFFT_NONREAL_NOTSUPPORTED,
     309                   typeStr);
     310        psFree(out);
     311        return NULL;
     312    }
     313
    286314
    287315    return out;
     
    303331    numRows = in->numRows;
    304332
    305     /* if not a complex number, this is logically just a image copy */
    306     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    307         // Warn user, as this is probably not expected
    308         psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
    309                  "Image copy was performed instead.");
     333    /* if not a complex image, this is logically just a image copy */
     334    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
    310335        return psImageCopy(out, in, type);
    311336    }
     
    338363        }
    339364    } else {
    340         psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
     365        char* typeStr;
     366        PS_TYPE_NAME(typeStr,type);
     367        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConjugate",
     368                   PS_ERR_BAD_PARAMETER_TYPE, true,
     369                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
     370                   typeStr);
    341371        psFree(out);
    342372        return NULL;
     
    362392    numRows = in->numRows;
    363393    numElementsSquared = numCols * numCols * numRows * numRows;
    364 
    365     /* if not a complex number, this is not implemented */
    366     if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
    367         psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
    368         psFree(out);
    369         return NULL;
    370     }
    371394
    372395    if (type == PS_TYPE_C32) {
     
    405428        }
    406429    } else {
    407         psError(__func__, "Can not power spectrum for given image type (%d).", type);
    408         psFree(out);
    409         return NULL;
    410     }
    411 
    412     return out;
    413 
    414 }
     430        char* typeStr;
     431        PS_TYPE_NAME(typeStr,type);
     432        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePowerSpectrum",
     433                   PS_ERR_BAD_PARAMETER_TYPE, true,
     434                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
     435                   typeStr);
     436        psFree(out);
     437        return NULL;
     438    }
     439
     440    return out;
     441
     442}
  • trunk/psLib/src/image/psImageIO.c

    r1440 r1840  
    1 
    21/** @file  psImageIO.c
    32 *
     
    87 *  @author Robert DeSonia, MHPCC
    98 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-08-09 23:34:58 $
     9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-21 22:30:19 $
    1211 *
    1312 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2221#include "psMemory.h"
    2322
     23#include "psImageErrors.h"
     24
    2425psImage* psImageReadSection(psImage* output,
    2526                            int col,
    2627                            int row,
    27                             int numCols, int numRows, int z, char *extname, int extnum, char *filename)
     28                            int numCols,
     29                            int numRows,
     30                            int z,
     31                            char *extname,
     32                            int extnum,
     33                            char *filename)
    2834{
    2935    fitsfile *fptr = NULL;      /* Pointer to the FITS file */
     
    4248
    4349    if (filename == NULL) {
    44         psError(__func__, "Must specify filename; it can not be NULL.");
     50        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     51                   PS_ERR_BAD_PARAMETER_NULL, true,
     52                   PS_ERRORTEXT_psImageIO_FILENAME_NULL);
    4553        psFree(output);
    4654        return NULL;
     
    5159    if (fptr == NULL || status != 0) {
    5260        fits_get_errstatus(status, fitsErr);
    53         psError(__func__, "Could not open file '%s'. (%s)", filename, fitsErr);
     61        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     62                   PS_ERR_BAD_PARAMETER_VALUE, true,
     63                   PS_ERRORTEXT_psImageIO_FILENAME_INVALID,
     64                   filename, fitsErr);
    5465        psFree(output);
    5566        return NULL;
     
    6273            status = 0;
    6374            (void)fits_close_file(fptr, &status);
    64             psError(__func__, "Could not index to '%s' HDU for file %s. (%s)", extname, filename, fitsErr);
     75            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     76                       PS_ERR_LOCATION_INVALID, true,
     77                       PS_ERRORTEXT_psImageIO_EXTNAME_INVALID,
     78                       extname, filename, fitsErr);
    6579            psFree(output);
    6680            return NULL;
     
    7185            status = 0;
    7286            (void)fits_close_file(fptr, &status);
    73             psError(__func__, "Could not index to HDU #%d for file %s. (%s)", extnum, filename, fitsErr);
     87            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     88                       PS_ERR_LOCATION_INVALID, true,
     89                       PS_ERRORTEXT_psImageIO_EXTNUM_INVALID,
     90                       extnum, filename, fitsErr);
    7491            psFree(output);
    7592            return NULL;
     
    8299        status = 0;
    83100        (void)fits_close_file(fptr, &status);
    84         psError("Could not determine image data type of '%s'. (%s)", filename, fitsErr);
     101        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     102                   PS_ERR_IO, true,
     103                   PS_ERRORTEXT_psImageIO_DATATYPE_UNKNOWN,
     104                   filename, fitsErr);
    85105        psFree(output);
    86106        return NULL;
     
    92112        status = 0;
    93113        (void)fits_close_file(fptr, &status);
    94         psError("Could not determine dimensions of '%s'. (%s)", filename, fitsErr);
     114        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     115                   PS_ERR_IO, true,
     116                   PS_ERRORTEXT_psImageIO_IMAGE_DIM_UNKNOWN,
     117                   filename, fitsErr);
    95118        psFree(output);
    96119        return NULL;
     
    101124        status = 0;
    102125        (void)fits_close_file(fptr, &status);
    103         psError("Dimensions of '%s' are not supported (NAXIS=%i).", filename, nAxis);
     126        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     127                   PS_ERR_IO, true,
     128                   PS_ERRORTEXT_psImageIO_IMAGE_DIMENSION_UNSUPPORTED,
     129                   nAxis);
    104130        psFree(output);
    105131        return NULL;
     
    111137        status = 0;
    112138        (void)fits_close_file(fptr, &status);
    113         psError("Could not determine image size of '%s'. (%s)", filename, fitsErr);
     139        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     140                   PS_ERR_IO, true,
     141                   PS_ERRORTEXT_psImageIO_IMAGE_SIZE_UNKNOWN,
     142                   filename, fitsErr);
    114143        psFree(output);
    115144        return NULL;
     
    134163    increment[1] = 1;
    135164    increment[2] = 1;
    136 
    137     // turn off the BSCALE/BZERO processing in
    138     // CFITSIO
    139     // (void)fits_set_bscale(fptr,
    140     // 1.0,0.0,&status);
    141165
    142166    switch (bitPix) {
     
    178202        break;
    179203    default:
    180         psError(__func__, "Unsupported bitpix value (%d) in FITS file %s.", bitPix, filename);
     204        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     205                   PS_ERR_IO, true,
     206                   PS_ERRORTEXT_psImageIO_FITS_TYPE_UNSUPPORTED,
     207                   bitPix, filename);
    181208        psFree(output);
    182209        return NULL;
    183210    }
    184211    output = psImageRecycle(output, numCols, numRows, datatype);
    185     if (fits_read_subset
    186             (fptr, fitsDatatype, firstPixel,
    187              lastPixel, increment, NULL, output->data.V[0], &anynull, &status) != 0) {
     212    if (fits_read_subset(fptr, fitsDatatype, firstPixel, lastPixel, increment,
     213                         NULL, output->data.V[0], &anynull, &status) != 0) {
    188214        psFree(output);
    189215        (void)fits_get_errstatus(status, fitsErr);
    190216        status = 0;
    191217        (void)fits_close_file(fptr, &status);
    192         psError(__func__, "Failed to read image [%s]", filename, fitsErr);
     218        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
     219                   PS_ERR_IO, true,
     220                   PS_ERRORTEXT_psImageIO_READ_FAILED,
     221                   filename, fitsErr);
    193222        return NULL;
    194223    }
     
    199228}
    200229
    201 bool psImageWriteSection(psImage* input, int col0, int row0, int z, char *extname, int extnum,
     230bool psImageWriteSection(psImage* input,
     231                         int col0,
     232                         int row0,
     233                         int z,
     234                         char *extname,
     235                         int extnum,
    202236                         char *filename)
    203237{
     
    220254    /* need a valid image to write */
    221255    if (input == NULL) {
    222         psError(__func__, "Can not write %s.  Input psImage is NULL.", filename);
     256        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     257                   PS_ERR_BAD_PARAMETER_NULL, true,
     258                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    223259        return false;
    224260    }
     
    263299        datatype = TDOUBLE;
    264300        break;
    265     default:
    266         psError(__func__,
    267                 "psImage datatype (%d) not supported.  File %s not written.", input->type.type, filename);
    268         return false;
     301    default: {
     302            char* typeStr;
     303            PS_TYPE_NAME(typeStr,input->type.type);
     304            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     305                       PS_ERR_BAD_PARAMETER_TYPE, true,
     306                       PS_ERRORTEXT_psImageIO_TYPE_UNSUPPORTED,
     307                       typeStr);
     308            return false;
     309        }
    269310    }
    270311
     
    275316        if (fptr == NULL || status != 0) {
    276317            fits_get_errstatus(status, fitsErr);
    277             psError(__func__, "Could not open file '%s'. FITS error:%s", filename, fitsErr);
     318            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     319                       PS_ERR_BAD_PARAMETER_VALUE, true,
     320                       PS_ERRORTEXT_psImageIO_FILENAME_INVALID,
     321                       filename, fitsErr);
    278322            return false;
    279323        }
     
    285329                status = 0;
    286330                (void)fits_close_file(fptr, &status);
    287                 psError(__func__,
    288                         "Could not index to '%s' HDU for file %s. (%s)", extname, filename, fitsErr);
     331                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     332                           PS_ERR_LOCATION_INVALID, true,
     333                           PS_ERRORTEXT_psImageIO_EXTNAME_INVALID,
     334                           extname, filename, fitsErr);
    289335                return false;
    290336            }
     
    296342                status = 0;
    297343                (void)fits_close_file(fptr, &status);
    298                 psError(__func__,
    299                         "extnum (%d) must not exceed number of HDUs (%d) by more than one.", extnum, numHDUs);
     344                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     345                           PS_ERR_LOCATION_INVALID, true,
     346                           PS_ERRORTEXT_psImageIO_WRITE_EXTNUM_INVALID,
     347                           extnum, numHDUs);
    300348                return false;
    301349            } else if (numHDUs == extnum) {
     
    305353                status = 0;
    306354                (void)fits_close_file(fptr, &status);
    307                 psError(__func__, "Could not index to HDU #%d for file %s. (%s)", extnum, filename, fitsErr);
     355                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     356                           PS_ERR_LOCATION_INVALID, true,
     357                           PS_ERRORTEXT_psImageIO_EXTNUM_INVALID,
     358                           extnum, filename, fitsErr);
    308359                return false;
    309360            }
     
    318369        if (fptr == NULL || status != 0) {
    319370            fits_get_errstatus(status, fitsErr);
    320             psError(__func__, "Could not create file '%s'. (%s)", filename, fitsErr);
     371            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     372                       PS_ERR_IO, true,
     373                       PS_ERRORTEXT_psImageIO_FILENAME_CREATE_FAILED,
     374                       filename, fitsErr);
    321375            return false;
    322376        }
     
    333387            status = 0;
    334388            (void)fits_close_file(fptr, &status);
    335             psError(__func__, "Could not create image HDU in FITS file '%s'. %s", filename, fitsErr);
     389            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     390                       PS_ERR_IO, true,
     391                       PS_ERRORTEXT_psImageIO_CREATE_HDU_FAILED,
     392                       filename, fitsErr);
    336393            return false;
    337394        }
     
    347404                status = 0;
    348405                (void)fits_close_file(fptr, &status);
    349                 psError(__func__,
    350                         "Could not create EXTNAME keyword in FITS file '%s'. (%s)", filename, fitsErr);
     406                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     407                           PS_ERR_IO, true,
     408                           PS_ERRORTEXT_psImageIO_CREATE_EXTENSION_FAILED,
     409                           filename, fitsErr);
    351410                return false;
    352411            }
     
    366425        status = 0;
    367426        (void)fits_close_file(fptr, &status);
    368         psError(__func__, "Could not write image data to '%s'. (%s)", filename, fitsErr);
     427        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
     428                   PS_ERR_IO, true,
     429                   PS_ERRORTEXT_psImageIO_WRITE_FAILED,
     430                   filename, fitsErr);
    369431        return false;
    370432    }
  • trunk/psLib/src/image/psImageManip.c

    r1827 r1840  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-17 23:57:41 $
     12 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-21 22:30:19 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psMemory.h"
    2727#include "psImageExtraction.h"
     28
     29#include "psImageErrors.h"
    2830
    2931int psImageClip(psImage* input,
     
    4244
    4345    if (max < min) {
    44         psError(__func__, "psImageClip can not be invoked with max < min.");
     46        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip",
     47                   PS_ERR_BAD_PARAMETER_VALUE, true,
     48                   PS_ERRORTEXT_psImageManip_MAXMIN,
     49                   (double)min,(double)max);
    4550        return 0;
    4651    }
     
    5156    switch (input->type.type) {
    5257
    53         #define psImageClipCase(type,typename) \
     58        #define psImageClipCase(type) \
    5459    case PS_TYPE_##type: { \
    5560            if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \
    56                 psError(__func__, "Specified vmin (%g) is outside of image's " \
    57                         typename " pixel range (%g to %g)", \
    58                         vmin,(psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
     61                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
     62                           PS_ERR_BAD_PARAMETER_VALUE, true, \
     63                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
     64                           "vmin",vmin, PS_TYPE_##type##_NAME, \
     65                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    5966            } \
    6067            if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \
    61                 psError(__func__, "Specified vmax (%g) is outside of image's " \
    62                         typename " pixel range (%g to %g)", \
    63                         vmax,(psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
     68                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
     69                           PS_ERR_BAD_PARAMETER_VALUE, true, \
     70                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
     71                           "vmax",vmax, PS_TYPE_##type##_NAME, \
     72                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    6473            } \
    6574            for (unsigned int row = 0;row<numRows;row++) { \
     
    7887        break;
    7988
    80         #define psImageClipCaseComplex(type,typename,absfcn)\
     89        #define psImageClipCaseComplex(type,absfcn)\
    8190    case PS_TYPE_##type: { \
    8291            if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \
    83                 psError(__func__, "Specified vmin (%g) is outside of image's " \
    84                         typename " pixel range", \
    85                         vmin); \
     92                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
     93                           PS_ERR_BAD_PARAMETER_VALUE, true, \
     94                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
     95                           "vmin",vmin, PS_TYPE_##type##_NAME, \
     96                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    8697            } \
    8798            if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \
    88                 psError(__func__, "Specified vmax (%g) is outside of image's " \
    89                         typename " pixel range", \
    90                         vmax); \
     99                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
     100                           PS_ERR_BAD_PARAMETER_VALUE, true, \
     101                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
     102                           "vmax",vmax, PS_TYPE_##type##_NAME, \
     103                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    91104            } \
    92105            for (unsigned int row = 0;row<numRows;row++) { \
     
    105118        break;
    106119
    107         psImageClipCase(S8, "psS8")
    108         psImageClipCase(S16, "psS16")
    109         psImageClipCase(S32, "psS32")
    110         psImageClipCase(S64, "psS64")
    111         psImageClipCase(U8, "psU8")
    112         psImageClipCase(U16, "psU16")
    113         psImageClipCase(U32, "psU32")
    114         psImageClipCase(U64, "psU64")
    115         psImageClipCase(F32, "psF32")
    116         psImageClipCase(F64, "psF64")
    117         psImageClipCaseComplex(C32, "psC32", cabsf)
    118         psImageClipCaseComplex(C64, "psC64", cabs)
    119 
    120     default:
    121         psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
     120        psImageClipCase(S8)
     121        psImageClipCase(S16)
     122        psImageClipCase(S32)
     123        psImageClipCase(S64)
     124        psImageClipCase(U8)
     125        psImageClipCase(U16)
     126        psImageClipCase(U32)
     127        psImageClipCase(U64)
     128        psImageClipCase(F32)
     129        psImageClipCase(F64)
     130        psImageClipCaseComplex(C32, cabsf)
     131        psImageClipCaseComplex(C64, cabs)
     132
     133    default: {
     134            char* typeStr;
     135            PS_TYPE_NAME(typeStr,input->type.type);
     136            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip",
     137                       PS_ERR_BAD_PARAMETER_TYPE, true,
     138                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     139                       typeStr);
     140        }
    122141    }
    123142
     
    158177        psImageClipNaNCase(C64)
    159178
    160     default:
    161         psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
     179    default: {
     180            char* typeStr;
     181            PS_TYPE_NAME(typeStr,input->type.type);
     182            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipNaN",
     183                       PS_ERR_BAD_PARAMETER_TYPE, true,
     184                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     185                       typeStr);
     186        }
    162187    }
    163188
     
    180205
    181206    if (image == NULL || overlay == NULL) {
    182         psError(__func__, "one of the input images was NULL.");
     207        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
     208                   PS_ERR_BAD_PARAMETER_NULL, true,
     209                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    183210        return 1;
    184211    }
    185212
    186213    if (op == NULL) {
    187         psError(__func__, "Operation can not be NULL.");
     214        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
     215                   PS_ERR_BAD_PARAMETER_NULL, true,
     216                   PS_ERRORTEXT_psImageManip_OPERATION_NULL);
    188217        return 1;
    189218    }
     
    192221
    193222    if (type != overlay->type.type) {
    194         psError(__func__, "Image and overlay datatypes must match. (%d vs %d)", type, overlay->type.type);
     223        char* typeStr;
     224        char* typeStrOverlay;
     225        PS_TYPE_NAME(typeStr,type);
     226        PS_TYPE_NAME(typeStrOverlay,overlay->type.type);
     227        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
     228                   PS_ERR_BAD_PARAMETER_TYPE, true,
     229                   PS_ERRORTEXT_psImageManip_OVERLAY_TYPE_MISMATCH,
     230                   typeStrOverlay, typeStr);
    195231        return 2;
    196232    }
     
    200236    overlayNumRows = overlay->numRows;
    201237    overlayNumCols = overlay->numCols;
    202 
    203     /* check row0/col0 to see if it is within the image size */
    204     if (row0 < 0 || col0 < 0 || row0 >= imageNumRows || col0 >= imageNumCols) {
    205         psError(__func__,
    206                 "Overlay origin of (%d,%d) is outside of the image dimensions (%d x %d).",
    207                 col0, row0, imageNumCols, imageNumRows);
    208         return 3;
    209     }
    210 
    211     /* check if overlay is totally withing input image */
    212238    imageRowLimit = row0 + overlayNumRows;
    213239    imageColLimit = col0 + overlayNumCols;
    214     if (imageRowLimit > imageNumRows || imageColLimit > imageNumCols) {
    215         psError(__func__,
    216                 "Overlay image (%d,%d -> %d,%d) is partially outside"
    217                 " of the input image (%d x %d).",
    218                 col0, row0, col0 + overlayNumCols - 1, row0 + overlayNumRows - 1, imageNumCols, imageNumRows);
    219         return 4;
     240
     241    /* check to see if overlay is within the input image */
     242    if ( row0 < 0 ||
     243            col0 < 0 ||
     244            imageRowLimit > imageNumRows ||
     245            imageColLimit > imageNumCols) {
     246
     247        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
     248                   PS_ERR_BAD_PARAMETER_VALUE, true,
     249                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
     250                   col0, imageColLimit, row0, imageRowLimit,
     251                   imageNumCols, imageNumRows);
     252        return 3;
    220253    }
    221254
     
    245278                    break; \
    246279                default: \
    247                     psError(__func__,"Unknown operation %s",op); \
     280                    psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection", \
     281                               PS_ERR_BAD_PARAMETER_VALUE, true, \
     282                               PS_ERRORTEXT_psImageManip_OVERLAY_OPERATOR_INVALID, \
     283                               op); \
    248284                    return 5; \
    249285                } \
     
    265301        psImageOverlayCase(C64);
    266302
    267     default:
    268         psError(__func__, "Can not operate on type %d.", type);
     303    default: {
     304            char* typeStr;
     305            PS_TYPE_NAME(typeStr,type);
     306            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
     307                       PS_ERR_BAD_PARAMETER_TYPE, true,
     308                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     309                       typeStr);
     310        }
    269311    }
    270312
     
    287329
    288330    if (input == NULL) {
    289         psError(__func__, "Can not perform clip on NULL image");
     331        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
     332                   PS_ERR_BAD_PARAMETER_NULL, true,
     333                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    290334        return 0;
    291335    }
    292336
    293337    if (realMax < realMin) {
    294         psError(__func__,
    295                 "psImageClipComplexRegion can not be invoked with " "max < min in the real image space.");
     338        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
     339                   PS_ERR_BAD_PARAMETER_VALUE, true,
     340                   PS_ERRORTEXT_psImageManip_MAXMIN_REAL,
     341                   (double)realMin, (double)realMax);
    296342        return 0;
    297343    }
    298344    if (imagMax < imagMin) {
    299         psError(__func__,
    300                 "psImageClipComplexRegion can not be invoked with "
    301                 "max < min in the imaginary image space.");
     345        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
     346                   PS_ERR_BAD_PARAMETER_VALUE, true,
     347                   PS_ERRORTEXT_psImageManip_MAXMIN_IMAG,
     348                   (double)imagMin, (double)imagMax);
    302349        return 0;
    303350    }
     
    306353    numCols = input->numCols;
    307354
    308     #define psImageClipComplexRegionCase(type,typename,realfcn,imagfcn) \
     355    #define psImageClipComplexRegionCase(type,realfcn,imagfcn) \
    309356case PS_TYPE_##type: { \
    310357        if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \
    311358                realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \
    312             psError(__func__, "Specified vmin (%g%+gi) is outside of image's " \
    313                     typename " pixel range", \
    314                     creal(vmin),cimag(vmin)); \
     359            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion", \
     360                       PS_ERR_BAD_PARAMETER_VALUE, true, \
     361                       PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
     362                       "vmin", creal(vmin), cimag(vmin), \
     363                       PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \
    315364            break; \
    316365        } \
    317366        if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \
    318367                realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \
    319             psError(__func__, "Specified vmax (%g%+gi) is outside of image's " \
    320                     typename " pixel range", \
    321                     creal(vmax),cimag(vmax)); \
     368            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion", \
     369                       PS_ERR_BAD_PARAMETER_VALUE, true, \
     370                       PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
     371                       "vmax", creal(vmax), cimag(vmax), \
     372                       PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \
    322373            break; \
    323374        } \
     
    339390    switch (input->type.type) {
    340391
    341         psImageClipComplexRegionCase(C32, "psC32", crealf, cimagf)
    342         psImageClipComplexRegionCase(C64, "psC64", creal, cimag)
    343 
    344     default:
    345         psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
     392        psImageClipComplexRegionCase(C32, crealf, cimagf)
     393        psImageClipComplexRegionCase(C64, creal, cimag)
     394
     395    default: {
     396            char* typeStr;
     397            PS_TYPE_NAME(typeStr,input->type.type);
     398            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
     399                       PS_ERR_BAD_PARAMETER_TYPE, true,
     400                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     401                       typeStr);
     402        }
    346403    }
    347404
     
    367424
    368425    if (in == NULL) {
    369         psError(__func__, "Input image is NULL.");
     426        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
     427                   PS_ERR_BAD_PARAMETER_NULL, true,
     428                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    370429        psFree(out);
    371430        return NULL;
     
    373432
    374433    if (scale < 1) {
    375         psError(__func__, "The scale must be positive.");
     434        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
     435                   PS_ERR_BAD_PARAMETER_VALUE, true,
     436                   PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE,
     437                   scale);
    376438        psFree(out);
    377439        return NULL;
     
    379441
    380442    if (stats == NULL) {
    381         psError(__func__, "The stats input can not be NULL.");
     443        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
     444                   PS_ERR_BAD_PARAMETER_NULL, true,
     445                   PS_ERRORTEXT_psImage_STAT_NULL);
    382446        psFree(out);
    383447        return NULL;
     
    385449
    386450    if (p_psGetStatValue(stats, &statVal) == false) {
    387         psError(__func__, "The stat options didn't specify a single supported statistic type.");
     451        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
     452                   PS_ERR_BAD_PARAMETER_VALUE, true,
     453                   PS_ERRORTEXT_psImage_BAD_STAT,
     454                   stats->options);
    388455        psFree(out);
    389456        return NULL;
     
    394461    if (mask != NULL) {
    395462        if (mask->type.type != PS_TYPE_MASK) {
    396             psError(__func__, "The mask datatype must be %s (%d).",
    397                     PS_TYPE_MASK_NAME,
    398                     mask->type.type);
     463            char* typeStr;
     464            PS_TYPE_NAME(typeStr,mask->type.type);
     465            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
     466                       PS_ERR_BAD_PARAMETER_TYPE, true,
     467                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
     468                       typeStr, PS_TYPE_MASK_NAME);
    399469            psFree(out);
    400470            psFree(vec);
     
    462532        PS_IMAGE_REBIN_CASE(C32);
    463533        PS_IMAGE_REBIN_CASE(C64);
    464     default:
    465         psError(__func__, "Input image type not supported.");
    466         psFree(out);
    467         out = NULL;
     534
     535    default: {
     536            char* typeStr;
     537            PS_TYPE_NAME(typeStr,in->type.type);
     538            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
     539                       PS_ERR_BAD_PARAMETER_TYPE, true,
     540                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     541                       typeStr);
     542            psFree(out);
     543            out = NULL;
     544        }
    468545    }
    469546
     
    484561
    485562    if (in == NULL) {
    486         psError(__func__, "Input image can not be NULL.");
     563        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
     564                   PS_ERR_BAD_PARAMETER_NULL, true,
     565                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    487566        psFree(out);
    488567        return NULL;
     
    520599        PSIMAGE_RESAMPLE_CASE(C32)
    521600        PSIMAGE_RESAMPLE_CASE(C64)
    522     default:
    523         psError(__func__, "Unsupported type (%d)", in->type.type);
    524         psFree(out);
    525         return NULL;
     601    default: {
     602            char* typeStr;
     603            PS_TYPE_NAME(typeStr,in->type.type);
     604            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
     605                       PS_ERR_BAD_PARAMETER_TYPE, true,
     606                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     607                       typeStr);
     608            psFree(out);
     609            out = NULL;
     610        }
    526611    }
    527612
     
    539624
    540625    if (in == NULL) {
    541         psError(__func__, "Input image can not be NULL.");
     626        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRoll",
     627                   PS_ERR_BAD_PARAMETER_NULL, true,
     628                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    542629        psFree(out);
    543630        return NULL;
     
    570657            inRowNumber -= outRows;
    571658        }
    572         psU8* inRow = in->data.U8[inRowNumber]; // to
    573 
    574         // allow
    575 
    576         // byte
    577         // arithmetic,
    578 
    579         // but for all types
     659        psU8* inRow = in->data.U8[inRowNumber]; // use byte arithmetic for all types
    580660        psU8* outRow = out->data.U8[row];
    581661
     
    594674{
    595675    if (in == NULL) {
    596         psError(__func__, "The input image was NULL.");
     676        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
     677                   PS_ERR_BAD_PARAMETER_NULL, true,
     678                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    597679        psFree(out);
    598680        return NULL;
     
    635717            PSIMAGE_ROTATE_LEFT_90(C32);
    636718            PSIMAGE_ROTATE_LEFT_90(C64);
    637         default:
    638             psError(__func__, "Unsupported type (%d)", type);
    639             psFree(out);
    640             return NULL;
     719        default: {
     720                char* typeStr;
     721                PS_TYPE_NAME(typeStr,type);
     722                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
     723                           PS_ERR_BAD_PARAMETER_TYPE, true,
     724                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     725                           typeStr);
     726                psFree(out);
     727                return NULL;
     728            }
    641729        }
    642730    } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
     
    675763            PSIMAGE_ROTATE_180_CASE(C32);
    676764            PSIMAGE_ROTATE_180_CASE(C64);
    677         default:
    678             psError(__func__, "Unsupported type (%d)", type);
    679             psFree(out);
    680             return NULL;
     765
     766        default: {
     767                char* typeStr;
     768                PS_TYPE_NAME(typeStr,type);
     769                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
     770                           PS_ERR_BAD_PARAMETER_TYPE, true,
     771                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     772                           typeStr);
     773                psFree(out);
     774                return NULL;
     775            }
    681776        }
    682777    } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
     
    714809            PSIMAGE_ROTATE_RIGHT_90(C32);
    715810            PSIMAGE_ROTATE_RIGHT_90(C64);
    716         default:
    717             psError(__func__, "Unsupported type (%d)", type);
    718             psFree(out);
    719             return NULL;
     811
     812        default: {
     813                char* typeStr;
     814                PS_TYPE_NAME(typeStr,type);
     815                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
     816                           PS_ERR_BAD_PARAMETER_TYPE, true,
     817                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     818                           typeStr);
     819                psFree(out);
     820                return NULL;
     821            }
    720822        }
    721823    } else if (fabsf(angle) < FLT_EPSILON) {
     
    731833        double sinT = sinf(t);
    732834
    733         // calculate the corners of the rotated
    734         // image so we know the proper
    735         // output image size.
    736         // x' = x cos(t) + y sin(t); i.e, x' =
    737         // (x-centerX)*cosT +
    738         // (y-centerY)*sinT;
    739         // y' = y cos(t) - x sin(t); i.e. y' =
    740         // (y-centerY)*cosT -
    741         // (x-centerX)*sinT;
     835        // calculate the corners of the rotated image so we know the proper output image size.
     836        // x' = x cos(t) + y sin(t); i.e, x' = (x-centerX)*cosT + (y-centerY)*sinT;
     837        // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
    742838
    743839        int outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
     
    748844        out = psImageRecycle(out, outCols, outRows, type);
    749845
    750         /* optimized public domain rotation routine by Karl Lager float cosT,sinT; cosT = cos(t); sinT =
    751          * sin(t); for (y = min_y; y <= max_y; y++) { x' = min_x * cosT + y * sinT + x1'; y' = y * cosT -
    752          * min_x * sinT + y1'; for (x = min_x; x <= max_x; x++) { if (x', y') * * * * * * * * is in the
    753          * bounds of the bitmap, get pixel(x', y') and plot the pixel to (x, y) on screen. x' += cosT; y' -=
    754          * sinT; } } */
    755 
    756         // precalculate some figures that are
    757         // used within loop
     846        /* optimized public domain rotation routine by Karl Lager
     847         *
     848         * float cosT,sinT;
     849         * cosT = cos(t);
     850         * sinT = sin(t);
     851         * for (y = min_y; y <= max_y; y++) {
     852         *     x' = min_x * cosT + y * sinT + x1';
     853         *     y' = y * cosT - min_x * sinT + y1';
     854         *     for (x = min_x; x <= max_x; x++) {
     855         *         if (x', y') is in the bounds of the bitmap, get pixel
     856         *            (x', y') and plot the pixel to (x, y) on screen.
     857         *         x' += cosT;
     858         *         y' -= sinT;
     859         *     }
     860         * }
     861         */
     862
     863        // precalculate some figures that are used within loop
    758864        float minXTimesCosTPlusCenterX = minX * cosT + centerX;
    759865        float CenterYMinusminXTimesSinT = centerY - minX * sinT;
    760866
    761867        #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \
    762             if (creal(unexposedValue) < PS_MIN_##TYPE || creal(unexposedValue) > PS_MAX_##TYPE || \
    763                     cimag(unexposedValue) < PS_MIN_##TYPE || cimag(unexposedValue) > PS_MAX_##TYPE) { \
    764                 psError(__func__,"The given unexposedValue (%g%+g) is outside of the " \
    765                         "image type's range (%g->%g).", \
    766                         creal(unexposedValue),cimag(unexposedValue), \
    767                         (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
     868            if (creal(unexposedValue) < PS_MIN_##TYPE || \
     869                    creal(unexposedValue) > PS_MAX_##TYPE || \
     870                    cimag(unexposedValue) < PS_MIN_##TYPE || \
     871                    cimag(unexposedValue) > PS_MAX_##TYPE) { \
     872                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate", \
     873                           PS_ERR_BAD_PARAMETER_VALUE, true, \
     874                           PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
     875                           "unexposedValue", \
     876                           creal(unexposedValue),cimag(unexposedValue), \
     877                           PS_TYPE_##TYPE##_NAME,  \
     878                           (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
    768879                psFree(out); \
    769880                out = NULL; \
     
    824935            PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \
    825936            break; \
    826         default: \
    827             psError(__func__,"Image type (%d) not supported",type); \
    828             psFree(out); \
    829             out = NULL; \
     937        default: { \
     938                char* typeStr; \
     939                PS_TYPE_NAME(typeStr,type); \
     940                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate", \
     941                           PS_ERR_BAD_PARAMETER_TYPE, true, \
     942                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED, \
     943                           typeStr); \
     944                psFree(out); \
     945                out = NULL; \
     946            } \
    830947        } \
    831948        break;
     
    835952            PSIMAGE_ROTATE_ARBITRARY_CASE(BILINEAR);
    836953        default:
    837             psError(__func__, "Unsupported interpolation mode (%d)", mode);
     954            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
     955                       PS_ERR_BAD_PARAMETER_VALUE, true,
     956                       PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
     957                       mode);
    838958            psFree(out);
    839959            out = NULL;
     
    857977
    858978    if (in == NULL) {
    859         psError(__func__, "Input image can not be NULL.");
     979        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageShift",
     980                   PS_ERR_BAD_PARAMETER_NULL, true,
     981                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    860982        psFree(out);
    861983        return NULL;
     
    871993    #define PSIMAGE_SHIFT_CASE(MODE,TYPE) \
    872994case PS_TYPE_##TYPE: \
    873     if (creal(unexposedValue) < PS_MIN_##TYPE || creal(unexposedValue) > PS_MAX_##TYPE || \
    874             cimag(unexposedValue) < PS_MIN_##TYPE || cimag(unexposedValue) > PS_MAX_##TYPE) { \
    875         psError(__func__,"The given unexposedValue (%g%+g) is outside of the " \
    876                 "image type's range (%g->%g).", \
    877                 creal(unexposedValue), cimag(unexposedValue), \
    878                 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
     995    if (creal(unexposedValue) < PS_MIN_##TYPE || \
     996            creal(unexposedValue) > PS_MAX_##TYPE || \
     997            cimag(unexposedValue) < PS_MIN_##TYPE || \
     998            cimag(unexposedValue) > PS_MAX_##TYPE) { \
     999        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageShift", \
     1000                   PS_ERR_BAD_PARAMETER_VALUE, true, \
     1001                   PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
     1002                   "unexposedValue", \
     1003                   creal(unexposedValue),cimag(unexposedValue), \
     1004                   PS_TYPE_##TYPE##_NAME,  \
     1005                   (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
    8791006        psFree(out); \
    8801007        out = NULL; \
     
    8851012        float y = dy+(float)row; \
    8861013        for (int col=0;col<outCols;col++) { \
    887             outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE(in,dx+(float)col,y,unexposedValue); \
     1014            outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \
     1015                          in,dx+(float)col,y,unexposedValue); \
    8881016        } \
    8891017    } \
     
    9051033        PSIMAGE_SHIFT_CASE(MODE,C32); \
    9061034        PSIMAGE_SHIFT_CASE(MODE,C64); \
    907     default: \
    908         psError(__func__, "Image type (%d) not supported.", type); \
    909         psFree(out); \
    910         out = NULL; \
     1035        \
     1036    default: { \
     1037            char* typeStr; \
     1038            PS_TYPE_NAME(typeStr,type); \
     1039            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate", \
     1040                       PS_ERR_BAD_PARAMETER_TYPE, true, \
     1041                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED, \
     1042                       typeStr); \
     1043            psFree(out); \
     1044            out = NULL; \
     1045        } \
    9111046    } \
    9121047    break;
     
    9171052        PSIMAGE_SHIFT_ARBITRARY_CASE(BILINEAR);
    9181053    default:
    919         psError(__func__, "Unsupported interpolation mode (%d)", mode);
     1054        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageShift",
     1055                   PS_ERR_BAD_PARAMETER_VALUE, true,
     1056                   PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
     1057                   mode);
    9201058        psFree(out);
    9211059        out = NULL;
  • trunk/psLib/src/image/psImageStats.c

    r1719 r1840  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-09-08 06:02:47 $
     12*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-09-21 22:30:19 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "psImageStats.h"
    3333
     34#include "psImageErrors.h"
     35
    3436/// This routine must determine the various statistics for the image.
    3537
     
    4345
    4446    if (stats == NULL) {
    45         psError(__func__, "The input psStats struct can not be NULL.");
     47        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     48                   PS_ERR_BAD_PARAMETER_NULL, true,
     49                   PS_ERRORTEXT_psImage_STAT_NULL);
    4650        return NULL;
    4751    }
    4852
    4953    if (in == NULL) {
    50         psError(__func__, "The input image can not be NULL.");
     54        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     55                   PS_ERR_BAD_PARAMETER_NULL, true,
     56                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    5157        return NULL;
    5258    }
    5359
    5460    if (stats->options == 0) {
    55         psError(__func__, "No statistic option/operation was specified.");
     61        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     62                   PS_ERR_BAD_PARAMETER_VALUE, true,
     63                   PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);
    5664        return stats;
    5765    }
     
    6270    junkData->nalloc = in->numRows * in->numCols;
    6371    junkData->n = junkData->nalloc;
    64     junkData->data.V = in->data.V[0];      // since
    65     // psImage
    66     // data
    67     // is
    68     // contiguous...
     72    junkData->data.V = in->data.V[0];      // since psImage data is contiguous...
    6973
    7074    if (mask != NULL) {
    7175        if (mask->type.type != PS_TYPE_MASK) {
    72             psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
     76            char* typeStr;
     77            PS_TYPE_NAME(typeStr,mask->type.type);
     78            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     79                       PS_ERR_BAD_PARAMETER_TYPE, true,
     80                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
     81                       typeStr, PS_TYPE_MASK_NAME);
    7382            psFree(junkData);
    7483            return NULL;
     
    109118    junkData->nalloc = in->numRows * in->numCols;
    110119    junkData->n = junkData->nalloc;
    111     junkData->data.V = in->data.V[0];      // since
    112     // psImage
    113     // data
    114     // is
    115     // contiguous...
     120    junkData->data.V = in->data.V[0];  // since psImage data is contiguous...
    116121
    117122    if (mask != NULL) {
    118123        if (mask->type.type != PS_TYPE_MASK) {
    119             psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
     124            char* typeStr;
     125            PS_TYPE_NAME(typeStr,mask->type.type);
     126            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageHistogram",
     127                       PS_ERR_BAD_PARAMETER_TYPE, true,
     128                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
     129                       typeStr, PS_TYPE_MASK_NAME);
     130            psFree(out);
    120131            psFree(junkData);
    121132            return NULL;
    122133        }
    123         // stuff the mask data into a psVector
    124         // struct.
     134        // stuff the mask data into a psVector struct.
    125135        junkMask = psAlloc(sizeof(psVector));
    126136        junkMask->type = mask->type;
  • trunk/psLib/src/imageops/psImageConvolve.c

    r1653 r1840  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-08-28 01:18:28 $
     7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-09-21 22:30:19 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1616#include "psLogMsg.h"
    1717#include "psError.h"
     18
     19#include "psImageErrors.h"
    1820
    1921static void freeKernel(psKernel* ptr);
     
    7678}
    7779
    78 psKernel *psKernelGenerate(const psVector *xShifts, const psVector *yShifts)
     80psKernel* psKernelGenerate(const psVector* xShifts, const psVector* yShifts)
    7981{
    8082    int x = 0;
     
    9193    // got non-NULL vectors?
    9294    if (xShifts == NULL || yShifts == NULL) {
    93         psError(__func__,"Shift vectors can not be NULL.");
     95        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
     96                   PS_ERR_BAD_PARAMETER_NULL, true,
     97                   PS_ERRORTEXT_psImageConvolve_SHIFT_NULL);
    9498        return NULL;
    9599    }
    96100
     101    // types match?
    97102    if (xShifts->type.type != yShifts->type.type) {
    98         psError(__func__,"Shift vectors can not be different data types.");
     103        char* typeXStr;
     104        char* typeYStr;
     105        PS_TYPE_NAME(typeXStr,xShifts->type.type);
     106        PS_TYPE_NAME(typeYStr,yShifts->type.type);
     107        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
     108                   PS_ERR_BAD_PARAMETER_TYPE, true,
     109                   PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH,
     110                   typeXStr, typeYStr);
    99111        return NULL;
    100112    }
     
    158170        KERNEL_GENERATE_CASE(C32);
    159171        KERNEL_GENERATE_CASE(C64);
    160     default:
    161         psError(__func__,"Shift vector datatype not supported.");
     172
     173    default: {
     174            char* typeStr;
     175            PS_TYPE_NAME(typeStr,xShifts->type.type);
     176            psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
     177                       PS_ERR_BAD_PARAMETER_TYPE, true,
     178                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     179                       typeStr);
     180        }
    162181    }
    163182
  • trunk/psLib/src/imageops/psImageStats.c

    r1719 r1840  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-09-08 06:02:47 $
     12*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-09-21 22:30:19 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "psImageStats.h"
    3333
     34#include "psImageErrors.h"
     35
    3436/// This routine must determine the various statistics for the image.
    3537
     
    4345
    4446    if (stats == NULL) {
    45         psError(__func__, "The input psStats struct can not be NULL.");
     47        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     48                   PS_ERR_BAD_PARAMETER_NULL, true,
     49                   PS_ERRORTEXT_psImage_STAT_NULL);
    4650        return NULL;
    4751    }
    4852
    4953    if (in == NULL) {
    50         psError(__func__, "The input image can not be NULL.");
     54        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     55                   PS_ERR_BAD_PARAMETER_NULL, true,
     56                   PS_ERRORTEXT_psImage_IMAGE_NULL);
    5157        return NULL;
    5258    }
    5359
    5460    if (stats->options == 0) {
    55         psError(__func__, "No statistic option/operation was specified.");
     61        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     62                   PS_ERR_BAD_PARAMETER_VALUE, true,
     63                   PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);
    5664        return stats;
    5765    }
     
    6270    junkData->nalloc = in->numRows * in->numCols;
    6371    junkData->n = junkData->nalloc;
    64     junkData->data.V = in->data.V[0];      // since
    65     // psImage
    66     // data
    67     // is
    68     // contiguous...
     72    junkData->data.V = in->data.V[0];      // since psImage data is contiguous...
    6973
    7074    if (mask != NULL) {
    7175        if (mask->type.type != PS_TYPE_MASK) {
    72             psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
     76            char* typeStr;
     77            PS_TYPE_NAME(typeStr,mask->type.type);
     78            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
     79                       PS_ERR_BAD_PARAMETER_TYPE, true,
     80                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
     81                       typeStr, PS_TYPE_MASK_NAME);
    7382            psFree(junkData);
    7483            return NULL;
     
    109118    junkData->nalloc = in->numRows * in->numCols;
    110119    junkData->n = junkData->nalloc;
    111     junkData->data.V = in->data.V[0];      // since
    112     // psImage
    113     // data
    114     // is
    115     // contiguous...
     120    junkData->data.V = in->data.V[0];  // since psImage data is contiguous...
    116121
    117122    if (mask != NULL) {
    118123        if (mask->type.type != PS_TYPE_MASK) {
    119             psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
     124            char* typeStr;
     125            PS_TYPE_NAME(typeStr,mask->type.type);
     126            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageHistogram",
     127                       PS_ERR_BAD_PARAMETER_TYPE, true,
     128                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
     129                       typeStr, PS_TYPE_MASK_NAME);
     130            psFree(out);
    120131            psFree(junkData);
    121132            return NULL;
    122133        }
    123         // stuff the mask data into a psVector
    124         // struct.
     134        // stuff the mask data into a psVector struct.
    125135        junkMask = psAlloc(sizeof(psVector));
    126136        junkMask->type = mask->type;
  • trunk/psLib/src/mathtypes/psImage.c

    r1818 r1840  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-16 18:51:31 $
     12 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-21 22:30:19 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    224224    }
    225225
    226     #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                             \
     226    #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                     \
    227227case PS_TYPE_##TYPE:                                                 \
    228228    switch (mode) {                                                  \
     
    237237    default:                                                         \
    238238        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",    \
    239                    PS_ERR_BAD_PARAMETER_VALUE,true,                     \
    240                    PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,     \
    241                    mode);                                               \
    242     }                                                                    \
     239                   PS_ERR_BAD_PARAMETER_VALUE,true,                  \
     240                   PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,  \
     241                   mode);                                            \
     242    }                                                                \
    243243    break
    244244
     
    256256        PSIMAGE_PIXEL_INTERPOLATE_CASE(C32);
    257257        PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);
    258     default:
    259         psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
    260                    PS_ERR_BAD_PARAMETER_TYPE,true,
    261                    PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
    262                    input->type.type);
     258    default: {
     259            char* typeStr;
     260            PS_TYPE_NAME(typeStr,input->type.type);
     261            psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
     262                       PS_ERR_BAD_PARAMETER_TYPE,true,
     263                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     264                       typeStr);
     265        }
    263266    }
    264267
  • trunk/psLib/src/sys/psMemory.c

    r1826 r1840  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-09-17 19:23:24 $
     10*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-09-21 22:30:19 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/src/sys/psType.h

    r1448 r1840  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-10 01:55:34 $
     13*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-09-21 22:30:19 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    103103#define PS_MAX_C64       DBL_MAX       /**< maximum valid real or imaginary psC32 value */
    104104
     105#define PS_TYPE_S8_NAME  "psS8"
     106#define PS_TYPE_S16_NAME "psS16"
     107#define PS_TYPE_S32_NAME "psS32"
     108#define PS_TYPE_S64_NAME "psS64"
     109#define PS_TYPE_U8_NAME  "psU8"
     110#define PS_TYPE_U16_NAME "psU16"
     111#define PS_TYPE_U32_NAME "psU32"
     112#define PS_TYPE_U64_NAME "psU64"
     113#define PS_TYPE_F32_NAME "psF32"
     114#define PS_TYPE_F64_NAME "psF64"
     115#define PS_TYPE_C32_NAME "psC32"
     116#define PS_TYPE_C64_NAME "psC64"
     117#define PS_TYPE_PTR_NAME "psPTR"
     118
     119#define PS_TYPE_NAME(value,type) \
     120switch(type) { \
     121case PS_TYPE_S8: \
     122    value = PS_TYPE_S8_NAME; \
     123    break; \
     124case PS_TYPE_S16: \
     125    value = PS_TYPE_S16_NAME; \
     126    break; \
     127case PS_TYPE_S32: \
     128    value = PS_TYPE_S32_NAME; \
     129    break; \
     130case PS_TYPE_S64: \
     131    value = PS_TYPE_S64_NAME; \
     132    break; \
     133case PS_TYPE_U8: \
     134    value = PS_TYPE_U8_NAME; \
     135    break; \
     136case PS_TYPE_U16: \
     137    value = PS_TYPE_U16_NAME; \
     138    break; \
     139case PS_TYPE_U32: \
     140    value = PS_TYPE_U32_NAME; \
     141    break; \
     142case PS_TYPE_U64: \
     143    value = PS_TYPE_U64_NAME; \
     144    break; \
     145case PS_TYPE_F32: \
     146    value = PS_TYPE_F32_NAME; \
     147    break; \
     148case PS_TYPE_F64: \
     149    value = PS_TYPE_F64_NAME; \
     150    break; \
     151case PS_TYPE_C32: \
     152    value = PS_TYPE_C32_NAME; \
     153    break; \
     154case PS_TYPE_C64: \
     155    value = PS_TYPE_C64_NAME; \
     156    break; \
     157case PS_TYPE_PTR: \
     158    value = PS_TYPE_PTR_NAME; \
     159    break; \
     160default: \
     161    value = "unknown"; \
     162};
     163
    105164/// Macro to get the bad pixel reason code (stored as part of mask value)
    106165#define PS_BADPIXEL_BITMASK 0x0f
  • trunk/psLib/src/sysUtils/psMemory.c

    r1826 r1840  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-09-17 19:23:24 $
     10*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-09-21 22:30:19 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/src/sysUtils/psType.h

    r1448 r1840  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-08-10 01:55:34 $
     13*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-09-21 22:30:19 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    103103#define PS_MAX_C64       DBL_MAX       /**< maximum valid real or imaginary psC32 value */
    104104
     105#define PS_TYPE_S8_NAME  "psS8"
     106#define PS_TYPE_S16_NAME "psS16"
     107#define PS_TYPE_S32_NAME "psS32"
     108#define PS_TYPE_S64_NAME "psS64"
     109#define PS_TYPE_U8_NAME  "psU8"
     110#define PS_TYPE_U16_NAME "psU16"
     111#define PS_TYPE_U32_NAME "psU32"
     112#define PS_TYPE_U64_NAME "psU64"
     113#define PS_TYPE_F32_NAME "psF32"
     114#define PS_TYPE_F64_NAME "psF64"
     115#define PS_TYPE_C32_NAME "psC32"
     116#define PS_TYPE_C64_NAME "psC64"
     117#define PS_TYPE_PTR_NAME "psPTR"
     118
     119#define PS_TYPE_NAME(value,type) \
     120switch(type) { \
     121case PS_TYPE_S8: \
     122    value = PS_TYPE_S8_NAME; \
     123    break; \
     124case PS_TYPE_S16: \
     125    value = PS_TYPE_S16_NAME; \
     126    break; \
     127case PS_TYPE_S32: \
     128    value = PS_TYPE_S32_NAME; \
     129    break; \
     130case PS_TYPE_S64: \
     131    value = PS_TYPE_S64_NAME; \
     132    break; \
     133case PS_TYPE_U8: \
     134    value = PS_TYPE_U8_NAME; \
     135    break; \
     136case PS_TYPE_U16: \
     137    value = PS_TYPE_U16_NAME; \
     138    break; \
     139case PS_TYPE_U32: \
     140    value = PS_TYPE_U32_NAME; \
     141    break; \
     142case PS_TYPE_U64: \
     143    value = PS_TYPE_U64_NAME; \
     144    break; \
     145case PS_TYPE_F32: \
     146    value = PS_TYPE_F32_NAME; \
     147    break; \
     148case PS_TYPE_F64: \
     149    value = PS_TYPE_F64_NAME; \
     150    break; \
     151case PS_TYPE_C32: \
     152    value = PS_TYPE_C32_NAME; \
     153    break; \
     154case PS_TYPE_C64: \
     155    value = PS_TYPE_C64_NAME; \
     156    break; \
     157case PS_TYPE_PTR: \
     158    value = PS_TYPE_PTR_NAME; \
     159    break; \
     160default: \
     161    value = "unknown"; \
     162};
     163
    105164/// Macro to get the bad pixel reason code (stored as part of mask value)
    106165#define PS_BADPIXEL_BITMASK 0x0f
  • trunk/psLib/test/dataManip/Makefile

    r1830 r1840  
    33##  Makefile:   test/sysUtils
    44##
    5 ##  $Revision: 1.41 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-09-18 01:50:24 $
     5##  $Revision: 1.42 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-09-21 22:30:19 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626tst_psFunc04 \
    2727tst_psFunc05 \
    28 tst_psFunc06 \
    2928tst_psHist00 \
    3029tst_psHist01 \
  • trunk/psLib/test/image/verified/tst_psImage.stderr

    r1761 r1840  
    1111<DATE><TIME>|<HOST>|I|testImageAlloc
    1212    Following should be an error.
    13 <DATE><TIME>|<HOST>|E|psImageAlloc
    14     Invalid value for number of rows or columns (numRows=0, numCols=0).
     13<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     14    Specified number of rows (0) or columns (0) is invalid.
    1515<DATE><TIME>|<HOST>|I|testImageAlloc
    1616    Testing psImage with type 102h
    1717<DATE><TIME>|<HOST>|I|testImageAlloc
    1818    Following should be an error.
    19 <DATE><TIME>|<HOST>|E|psImageAlloc
    20     Invalid value for number of rows or columns (numRows=0, numCols=0).
     19<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     20    Specified number of rows (0) or columns (0) is invalid.
    2121<DATE><TIME>|<HOST>|I|testImageAlloc
    2222    Testing psImage with type 104h
    2323<DATE><TIME>|<HOST>|I|testImageAlloc
    2424    Following should be an error.
    25 <DATE><TIME>|<HOST>|E|psImageAlloc
    26     Invalid value for number of rows or columns (numRows=0, numCols=0).
     25<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     26    Specified number of rows (0) or columns (0) is invalid.
    2727<DATE><TIME>|<HOST>|I|testImageAlloc
    2828    Testing psImage with type 108h
    2929<DATE><TIME>|<HOST>|I|testImageAlloc
    3030    Following should be an error.
    31 <DATE><TIME>|<HOST>|E|psImageAlloc
    32     Invalid value for number of rows or columns (numRows=0, numCols=0).
     31<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     32    Specified number of rows (0) or columns (0) is invalid.
    3333<DATE><TIME>|<HOST>|I|testImageAlloc
    3434    Testing psImage with type 301h
    3535<DATE><TIME>|<HOST>|I|testImageAlloc
    3636    Following should be an error.
    37 <DATE><TIME>|<HOST>|E|psImageAlloc
    38     Invalid value for number of rows or columns (numRows=0, numCols=0).
     37<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     38    Specified number of rows (0) or columns (0) is invalid.
    3939<DATE><TIME>|<HOST>|I|testImageAlloc
    4040    Testing psImage with type 302h
    4141<DATE><TIME>|<HOST>|I|testImageAlloc
    4242    Following should be an error.
    43 <DATE><TIME>|<HOST>|E|psImageAlloc
    44     Invalid value for number of rows or columns (numRows=0, numCols=0).
     43<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     44    Specified number of rows (0) or columns (0) is invalid.
    4545<DATE><TIME>|<HOST>|I|testImageAlloc
    4646    Testing psImage with type 304h
    4747<DATE><TIME>|<HOST>|I|testImageAlloc
    4848    Following should be an error.
    49 <DATE><TIME>|<HOST>|E|psImageAlloc
    50     Invalid value for number of rows or columns (numRows=0, numCols=0).
     49<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     50    Specified number of rows (0) or columns (0) is invalid.
    5151<DATE><TIME>|<HOST>|I|testImageAlloc
    5252    Testing psImage with type 308h
    5353<DATE><TIME>|<HOST>|I|testImageAlloc
    5454    Following should be an error.
    55 <DATE><TIME>|<HOST>|E|psImageAlloc
    56     Invalid value for number of rows or columns (numRows=0, numCols=0).
     55<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     56    Specified number of rows (0) or columns (0) is invalid.
    5757<DATE><TIME>|<HOST>|I|testImageAlloc
    5858    Testing psImage with type 404h
    5959<DATE><TIME>|<HOST>|I|testImageAlloc
    6060    Following should be an error.
    61 <DATE><TIME>|<HOST>|E|psImageAlloc
    62     Invalid value for number of rows or columns (numRows=0, numCols=0).
     61<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     62    Specified number of rows (0) or columns (0) is invalid.
    6363<DATE><TIME>|<HOST>|I|testImageAlloc
    6464    Testing psImage with type 408h
    6565<DATE><TIME>|<HOST>|I|testImageAlloc
    6666    Following should be an error.
    67 <DATE><TIME>|<HOST>|E|psImageAlloc
    68     Invalid value for number of rows or columns (numRows=0, numCols=0).
     67<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     68    Specified number of rows (0) or columns (0) is invalid.
    6969<DATE><TIME>|<HOST>|I|testImageAlloc
    7070    Testing psImage with type 808h
    7171<DATE><TIME>|<HOST>|I|testImageAlloc
    7272    Following should be an error.
    73 <DATE><TIME>|<HOST>|E|psImageAlloc
    74     Invalid value for number of rows or columns (numRows=0, numCols=0).
     73<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     74    Specified number of rows (0) or columns (0) is invalid.
    7575<DATE><TIME>|<HOST>|I|testImageAlloc
    7676    Testing psImage with type 810h
    7777<DATE><TIME>|<HOST>|I|testImageAlloc
    7878    Following should be an error.
    79 <DATE><TIME>|<HOST>|E|psImageAlloc
    80     Invalid value for number of rows or columns (numRows=0, numCols=0).
     79<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     80    Specified number of rows (0) or columns (0) is invalid.
    8181<DATE><TIME>|<HOST>|I|testImageAlloc
    8282    Testing psImage with type 0h
    8383<DATE><TIME>|<HOST>|I|testImageAlloc
    8484    Following should be an error.
    85 <DATE><TIME>|<HOST>|E|psImageAlloc
    86     Invalid value for number of rows or columns (numRows=0, numCols=0).
     85<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
     86    Specified number of rows (0) or columns (0) is invalid.
    8787
    8888---> TESTPOINT PASSED (psImage{psImageAlloc} | tst_psImage.c)
     
    114114<DATE><TIME>|<HOST>|I|testImageSubset
    115115    An error should follow...
    116 <DATE><TIME>|<HOST>|E|psImageSubset
    117     Can not subset image because input image or its pixel buffer is NULL.
     116<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     117    Can not operate on a NULL psImage.
    118118<DATE><TIME>|<HOST>|I|testImageSubset
    119119    Verify the returned psImage structure pointer is null and program  execution doesn't stop, if the input parameters nrow and/or ncol are zero. Also verify input psImage structure is not modified.
    120120<DATE><TIME>|<HOST>|I|testImageSubset
    121121    An error should follow...
    122 <DATE><TIME>|<HOST>|E|psImageSubset
    123     Can not subset image because number of rows or columns are zero (64x0).
     122<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     123    Specified number of rows (64) or columns (0) is invalid.
    124124<DATE><TIME>|<HOST>|I|testImageSubset
    125125    An error should follow...
    126 <DATE><TIME>|<HOST>|E|psImageSubset
    127     Can not subset image because number of rows or columns are zero (0x128).
     126<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     127    Specified number of rows (0) or columns (128) is invalid.
    128128<DATE><TIME>|<HOST>|I|testImageSubset
    129129    Verify the returned psImage structure pointer is null and program execution doesn't stop, if the input parameters row0 and col0 are not within the range of values of psImage structure image.
    130130<DATE><TIME>|<HOST>|I|testImageSubset
    131131    An error should follow...
    132 <DATE><TIME>|<HOST>|E|psImageSubset
    133     Can not subset image because col0,row0 (128,0) is not a valid pixel location.
     132<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     133    Specified subset range, [128:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    134134<DATE><TIME>|<HOST>|I|testImageSubset
    135135    An error should follow...
    136 <DATE><TIME>|<HOST>|E|psImageSubset
    137     Can not subset image because col0,row0 (0,256) is not a valid pixel location.
     136<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     137    Specified subset range, [0:<LINENO>,256:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    138138<DATE><TIME>|<HOST>|I|testImageSubset
    139139    An error should follow...
    140 <DATE><TIME>|<HOST>|E|psImageSubset
    141     Can not subset image because col0,row0 (-1,0) is not a valid pixel location.
     140<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     141    Specified subset range, [-1:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    142142<DATE><TIME>|<HOST>|I|testImageSubset
    143143    An error should follow...
    144 <DATE><TIME>|<HOST>|E|psImageSubset
    145     Can not subset image because col0,row0 (0,-1) is not a valid pixel location.
     144<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     145    Specified subset range, [0:<LINENO>,-1:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    146146<DATE><TIME>|<HOST>|I|testImageSubset
    147147    Verify the returned psImage structure pointer is null and program execution doesn't stop if the input parameters nrow, ncol, row0 and col0 specify a range of data not within the input psImage structure image.  Also verify the input psImage structure is not modified.
    148148<DATE><TIME>|<HOST>|I|testImageSubset
    149149    An error should follow...
    150 <DATE><TIME>|<HOST>|E|psImageSubset
    151     Can not subset image outside of image boundaries (size=128x256, subset=[64:<LINENO>,0:<LINENO>]).
     150<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     151    Specified subset range, [64:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    152152<DATE><TIME>|<HOST>|I|testImageSubset
    153153    An error should follow...
    154 <DATE><TIME>|<HOST>|E|psImageSubset
    155     Can not subset image outside of image boundaries (size=128x256, subset=[0:<LINENO>,128:<LINENO>]).
     154<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     155    Specified subset range, [0:<LINENO>,128:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    156156<DATE><TIME>|<HOST>|I|testImageSubset
    157157    An error should follow...
    158 <DATE><TIME>|<HOST>|E|psImageSubset
    159     Can not subset image outside of image boundaries (size=128x256, subset=[64:<LINENO>,128:<LINENO>]).
     158<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
     159    Specified subset range, [64:<LINENO>,128:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    160160<DATE><TIME>|<HOST>|I|testImageSubset
    161161    psImageFreeChildren shall deallocate any children images of a psImage structure
     
    187187<DATE><TIME>|<HOST>|I|testImageCopy
    188188    An error should follow...
    189 <DATE><TIME>|<HOST>|E|psImageCopy
    190     Can not copy image because input image or its pixel buffer is NULL.
     189<DATE><TIME>|<HOST>|E|psLib.image.psImageCopy
     190    Can not operate on a NULL psImage.
    191191
    192192---> TESTPOINT PASSED (psImage{psImageCopy} | tst_psImage.c)
  • trunk/psLib/test/image/verified/tst_psImageExtraction.stderr

    r1761 r1840  
    77<DATE><TIME>|<HOST>|I|testImageSlice
    88    Following should be an error.
    9 <DATE><TIME>|<HOST>|E|psImageSlice
    10     Input image can not be NULL.
     9<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     10    Can not operate on a NULL psImage.
    1111<DATE><TIME>|<HOST>|I|testImageSlice
    1212    Following should be an error.
    13 <DATE><TIME>|<HOST>|E|psImageSlice
    14     The stat options didn't specify a single supported statistic type.
     13<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     14    Specified statistic can not be NULL.
    1515<DATE><TIME>|<HOST>|I|testImageSlice
    1616    Following should be an error.
    17 <DATE><TIME>|<HOST>|E|psImageSlice
    18     Invalid direction flag (5)
     17<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     18    Specified slice direction, 5, is invalid.
    1919<DATE><TIME>|<HOST>|I|testImageSlice
    2020    Following should be an error.
    21 <DATE><TIME>|<HOST>|E|psImageSlice
    22     The specified region contains no data (0x0)
     21<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     22    Specified subset, [200:<LINENO>,100:<LINENO>], contains no pixel data.
    2323<DATE><TIME>|<HOST>|I|testImageSlice
    2424    Following should be an error.
    25 <DATE><TIME>|<HOST>|E|psImageSlice
    26     The specified image region (2001,100 to 2001,100) is outside of image area (0,0 to 1999,999).
     25<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     26    Specified subset range, [2001:<LINENO>,2002:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    2727<DATE><TIME>|<HOST>|I|testImageSlice
    2828    Following should be an error.
    29 <DATE><TIME>|<HOST>|E|psImageSlice
    30     The specified image region (200,1001 to 200,1001) is outside of image area (0,0 to 1999,999).
     29<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     30    Specified subset range, [200:<LINENO>,201:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    3131<DATE><TIME>|<HOST>|I|testImageSlice
    3232    Following should be an error.
    33 <DATE><TIME>|<HOST>|E|psImageSlice
    34     The specified image region (200,100 to 2199,100) is outside of image area (0,0 to 1999,999).
     33<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     34    Specified subset range, [200:<LINENO>,2200:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    3535<DATE><TIME>|<HOST>|I|testImageSlice
    3636    Following should be an error.
    37 <DATE><TIME>|<HOST>|E|psImageSlice
    38     The specified image region (200,100 to 200,1099) is outside of image area (0,0 to 1999,999).
     37<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     38    Specified subset range, [200:<LINENO>,201:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    3939<DATE><TIME>|<HOST>|I|testImageSlice
    4040    Following should be an error.
    41 <DATE><TIME>|<HOST>|E|psImageSlice
    42     The stat options didn't specify a single supported statistic type.
     41<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
     42    Specified statistic option, 1, is not valid.  Must specify one and only one statistic type.
    4343
    4444---> TESTPOINT PASSED (psImage{psImageSlice} | tst_psImageExtraction.c)
  • trunk/psLib/test/image/verified/tst_psImageFFT.stderr

    r1761 r1840  
    2525<DATE><TIME>|<HOST>|I|testImageComplex
    2626    Following should be an error (type mismatch).
    27 <DATE><TIME>|<HOST>|E|psImageComplex
    28     The inputs to psImageComplex must be the same type.
     27<DATE><TIME>|<HOST>|E|psLib.image.psImageComplex
     28    Real psImage type (psF32) and imaginary psImage type (psF64) must be the same.
    2929<DATE><TIME>|<HOST>|I|testImageComplex
    3030    Following should be an error (size mismatch).
    31 <DATE><TIME>|<HOST>|E|psImageComplex
    32     The inputs to psImageComplex must be the same dimensions.
     31<DATE><TIME>|<HOST>|E|psLib.image.psImageComplex
     32    Real psImage size (128x64) and imaginary psImage size (64x64) must be the same.
    3333
    3434---> TESTPOINT PASSED (psFFT{psImageComplex} | tst_psImageFFT.c)
  • trunk/psLib/test/image/verified/tst_psImageManip.stderr

    r1761 r1840  
    2929<DATE><TIME>|<HOST>|I|testImageClip
    3030    Following should be an error (max<min)
    31 <DATE><TIME>|<HOST>|E|psImageClip
    32     psImageClip can not be invoked with max < min.
     31<DATE><TIME>|<HOST>|E|psLib.image.psImageClip
     32    Specified min value, 256, can not be greater than the specified max value, 128.
    3333
    3434---> TESTPOINT PASSED (psImage{psImageClip} | tst_psImageManip.c)
     
    5959<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    6060    Following should be an error:
    61 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    62     Can not perform clip on NULL image
    63 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    64     Following should be an error:
    65 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    66     psImageClipComplexRegion can not be invoked with max < min in the real image space.
    67 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    68     Following should be an error:
    69 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    70     psImageClipComplexRegion can not be invoked with max < min in the imaginary image space.
    71 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    72     Following should be an error:
    73 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    74     psImageClipComplexRegion can not be invoked with max < min in the real image space.
    75 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    76     Following should be an error:
    77 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    78     Specified vmin (-6.80565e+38+0i) is outside of image's psC32 pixel range
    79 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    80     Following should be an error:
    81 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    82     Specified vmin (6.80565e+38+0i) is outside of image's psC32 pixel range
    83 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    84     Following should be an error:
    85 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    86     Specified vmin (-0-6.80565e+38i) is outside of image's psC32 pixel range
    87 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    88     Following should be an error:
    89 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    90     Specified vmin (0+6.80565e+38i) is outside of image's psC32 pixel range
    91 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    92     Following should be an error:
    93 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    94     Specified vmax (-6.80565e+38+0i) is outside of image's psC32 pixel range
    95 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    96     Following should be an error:
    97 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    98     Specified vmax (6.80565e+38+0i) is outside of image's psC32 pixel range
    99 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    100     Following should be an error:
    101 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    102     Specified vmax (-0-6.80565e+38i) is outside of image's psC32 pixel range
    103 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
    104     Following should be an error:
    105 <DATE><TIME>|<HOST>|E|psImageClipComplexRegion
    106     Specified vmax (0+6.80565e+38i) is outside of image's psC32 pixel range
     61<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     62    Can not operate on a NULL psImage.
     63<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     64    Following should be an error:
     65<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     66    Specified real-portion of min value, 10, can not be greater than the real-portion of max value, 5.
     67<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     68    Following should be an error:
     69<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     70    Specified imaginary-portion of min value, 10, can not be greater than the imaginary-portion of max value, 5.
     71<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     72    Following should be an error:
     73<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     74    Specified real-portion of min value, 10, can not be greater than the real-portion of max value, 5.
     75<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     76    Following should be an error:
     77<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     78    Specified vmin value, -6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     79<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     80    Following should be an error:
     81<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     82    Specified vmin value, 6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     83<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     84    Following should be an error:
     85<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     86    Specified vmin value, -0-6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     87<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     88    Following should be an error:
     89<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     90    Specified vmin value, 0+6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     91<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     92    Following should be an error:
     93<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     94    Specified vmax value, -6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     95<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     96    Following should be an error:
     97<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     98    Specified vmax value, 6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     99<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     100    Following should be an error:
     101<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     102    Specified vmax value, -0-6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
     103<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     104    Following should be an error:
     105<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
     106    Specified vmax value, 0+6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38]. 
    107107
    108108---> TESTPOINT PASSED (psImage{psImageClipComplexRegion} | tst_psImageManip.c)
     
    116116<DATE><TIME>|<HOST>|I|testImageOverlay
    117117    Following should error as overlay isn't within image boundaries
    118 <DATE><TIME>|<HOST>|E|psImageOverlaySection
    119     Overlay image (32,64 -> 159,319) is partially outside of the input image (128 x 256).
     118<DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
     119    Specified subset range, [32:<LINENO>,64:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
    120120<DATE><TIME>|<HOST>|I|testImageOverlay
    121121    Following should error as overlay is NULL
    122 <DATE><TIME>|<HOST>|E|psImageOverlaySection
    123     one of the input images was NULL.
     122<DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
     123    Can not operate on a NULL psImage.
    124124<DATE><TIME>|<HOST>|I|testImageOverlay
    125125    Following should error as image input is NULL
    126 <DATE><TIME>|<HOST>|E|psImageOverlaySection
    127     one of the input images was NULL.
     126<DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
     127    Can not operate on a NULL psImage.
    128128
    129129---> TESTPOINT PASSED (psImage{psImageOverlay} | tst_psImageManip.c)
     
    135135\**********************************************************************************/
    136136
    137 <DATE><TIME>|<HOST>|E|psImageRebin
    138     Input image is NULL.
    139 <DATE><TIME>|<HOST>|I|testImageRebin
    140     Following should be an error.
    141 <DATE><TIME>|<HOST>|E|psImageRebin
    142     The scale must be positive.
    143 <DATE><TIME>|<HOST>|I|testImageRebin
    144     Following should be an error.
    145 <DATE><TIME>|<HOST>|E|psImageRebin
    146     The stats input can not be NULL.
    147 <DATE><TIME>|<HOST>|I|testImageRebin
    148     Following should be an error.
    149 <DATE><TIME>|<HOST>|E|psImageRebin
    150     The stat options didn't specify a single supported statistic type.
    151 <DATE><TIME>|<HOST>|I|testImageRebin
    152     Following should be an error.
    153 <DATE><TIME>|<HOST>|E|psImageRebin
    154     The stat options didn't specify a single supported statistic type.
    155 <DATE><TIME>|<HOST>|I|testImageRebin
    156     Following should be an error.
    157 <DATE><TIME>|<HOST>|E|psImageRebin
    158     The stat options didn't specify a single supported statistic type.
     137<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
     138    Can not operate on a NULL psImage.
     139<DATE><TIME>|<HOST>|I|testImageRebin
     140    Following should be an error.
     141<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
     142    Specified scale value, 0, must be a positive value.
     143<DATE><TIME>|<HOST>|I|testImageRebin
     144    Following should be an error.
     145<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
     146    Specified statistic can not be NULL.
     147<DATE><TIME>|<HOST>|I|testImageRebin
     148    Following should be an error.
     149<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
     150    Specified statistic option, 0, is not valid.  Must specify one and only one statistic type.
     151<DATE><TIME>|<HOST>|I|testImageRebin
     152    Following should be an error.
     153<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
     154    Specified statistic option, 8192, is not valid.  Must specify one and only one statistic type.
     155<DATE><TIME>|<HOST>|I|testImageRebin
     156    Following should be an error.
     157<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
     158    Specified statistic option, 2049, is not valid.  Must specify one and only one statistic type.
    159159
    160160---> TESTPOINT PASSED (psImage{psImageRebin} | tst_psImageManip.c)
     
    168168<DATE><TIME>|<HOST>|I|testImageRoll
    169169    Following should generate an error.
    170 <DATE><TIME>|<HOST>|E|psImageRoll
    171     Input image can not be NULL.
     170<DATE><TIME>|<HOST>|E|psLib.image.psImageRoll
     171    Can not operate on a NULL psImage.
    172172
    173173---> TESTPOINT PASSED (psImage{psImageRoll} | tst_psImageManip.c)
     
    181181<DATE><TIME>|<HOST>|I|testImageRotate
    182182    Following should be an error
    183 <DATE><TIME>|<HOST>|E|psImageRotate
    184     The input image was NULL.
     183<DATE><TIME>|<HOST>|E|psLib.image.psImageRotate
     184    Can not operate on a NULL psImage.
    185185
    186186---> TESTPOINT PASSED (psImage{psImageRotate} | tst_psImageManip.c)
     
    228228<DATE><TIME>|<HOST>|I|testImageShift
    229229    Following should be an error...
    230 <DATE><TIME>|<HOST>|E|psImageShift
    231     Input image can not be NULL.
     230<DATE><TIME>|<HOST>|E|psLib.image.psImageShift
     231    Can not operate on a NULL psImage.
    232232
    233233---> TESTPOINT PASSED (psImage{psImageShift} | tst_psImageManip.c)
  • trunk/psLib/test/image/verified/tst_psImageStats01.stderr

    r1761 r1840  
    1 <DATE><TIME>|<HOST>|E|psImageStats
    2     The input image can not be NULL.
    3 <DATE><TIME>|<HOST>|E|psImageStats
    4     The input psStats struct can not be NULL.
    5 <DATE><TIME>|<HOST>|E|psImageStats
    6     No statistic option/operation was specified.
     1<DATE><TIME>|<HOST>|E|psLib.image.psImageStats
     2    Can not operate on a NULL psImage.
     3<DATE><TIME>|<HOST>|E|psLib.image.psImageStats
     4    Specified statistic can not be NULL.
     5<DATE><TIME>|<HOST>|E|psLib.image.psImageStats
     6    Specified statistic option did not indicate any operation to perform.
Note: See TracChangeset for help on using the changeset viewer.