IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25864


Ignore:
Timestamp:
Oct 16, 2009, 5:05:44 PM (17 years ago)
Author:
Paul Price
Message:

Fix problem translating images.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/psLib/src/math/psMatrix.c

    r25862 r25864  
    103103static void vectorPStoGSL(gsl_vector *out, const psVector *in)
    104104{
     105    psAssert(out->size == in->n, "Sizes don't match!");
     106
    105107    long n = in->n;                     // Size of input
    106108    switch (in->type.type) {
     
    122124static void vectorGSLtoPS(psVector *out, const gsl_vector *in)
    123125{
     126    psAssert(in->size == out->n, "Sizes don't match!");
     127
    124128    long n = out->n;                    // Size of output
    125129    switch (out->type.type) {
     
    142146static void matrixPStoGSL(gsl_matrix *out, const psImage *in)
    143147{
     148    psAssert(out->size1 == in->numRows && out->size2 == in->numCols, "Sizes don't match!");
     149
    144150    int numCols = in->numCols, numRows = in->numRows; // Size of matrix
    145151    switch (in->type.type) {
     
    152158        break;
    153159      case PS_TYPE_F64:
    154         if (in->parent) {
     160        if (in->parent|| out->tda != out->size1) {
    155161            for (int y = 0, i = 0; y < numRows; y++, i += numCols) {
    156162                memcpy(&out->data[i], in->data.F64[y], numCols * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    157163            }
    158164        } else {
    159             memcpy(out->data, in->data.F64, numCols * numRows * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     165            memcpy(out->data, in->p_rawDataBuffer, numCols * numRows * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    160166        }
    161167        break;
     
    167173
    168174/** Static function to copy GSL matrix data to a psF32 or psF64 image */
    169 static void matrixGSLtoPS(psImage *out, gsl_matrix *in)
    170 {
     175static void matrixGSLtoPS(psImage *out, const gsl_matrix *in)
     176{
     177    psAssert(in->size1 == out->numRows && in->size2 == out->numCols, "Sizes don't match!");
     178
    171179    int numCols = out->numCols, numRows = out->numRows; // Size of matrix
    172180    switch (out->type.type) {
     
    179187        break;
    180188      case PS_TYPE_F64:
    181         if (out->parent) {
     189        if (out->parent || in->tda != in->size1) {
    182190            for (int y = 0, i = 0; y < numRows; y++, i += numCols) {
    183191                memcpy(out->data.F64[y], &in->data[i], numCols * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    184192            }
    185193        } else {
    186             memcpy(out->data.F64, in->data, numCols * numRows * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     194            memcpy(out->p_rawDataBuffer, in->data, numCols * numRows * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    187195        }
    188196        break;
Note: See TracChangeset for help on using the changeset viewer.