Changeset 4201
- Timestamp:
- Jun 9, 2005, 1:41:57 PM (21 years ago)
- Location:
- trunk/psModules
- Files:
-
- 3 edited
-
src/pmObjects.c (modified) (36 diffs)
-
test (modified) (1 prop)
-
test/.cvsignore (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmObjects.c
r4168 r4201 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-06-09 00:59:53$7 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-06-09 23:41:56 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 } 56 56 57 static void p_psModelFree(psModel *tmp)57 static void modelFree(psModel *tmp) 58 58 { 59 59 psFree(tmp->params); … … 64 64 pmModelAlloc(): Allocate the psModel structure, along with its parameters, 65 65 and initialize the type member. Initialize the params to 0.0. 66 XXX EAM: changing params and dparams to psVector 66 XXX EAM: changing params and dparams to psVector 67 67 *****************************************************************************/ 68 68 psModel *pmModelAlloc(psModelType type) … … 107 107 } 108 108 109 psMemSetDeallocator(tmp, (psFreeFcn) p_psModelFree);109 psMemSetDeallocator(tmp, (psFreeFcn) modelFree); 110 110 return(tmp); 111 111 } … … 115 115 We might need to increase the reference counter and decrease it here. 116 116 *****************************************************************************/ 117 static void p_psSourceFree(psSource *tmp)117 static void sourceFree(psSource *tmp) 118 118 { 119 119 psFree(tmp->peak); … … 137 137 tmp->models = NULL; 138 138 tmp->type = 0; 139 psMemSetDeallocator(tmp, (psFreeFcn) p_psSourceFree);139 psMemSetDeallocator(tmp, (psFreeFcn) sourceFree); 140 140 141 141 return(tmp); … … 242 242 243 243 /****************************************************************************** 244 p_psGetRowVectorFromImage(): a private function which simply returns a244 getRowVectorFromImage(): a private function which simply returns a 245 245 psVector containing the specified row of data from the psImage. 246 246 247 247 XXX: Is there a better way to do this? 248 248 *****************************************************************************/ 249 psVector *p_psGetRowVectorFromImage(psImage *image,250 psU32 row)249 static psVector *getRowVectorFromImage(psImage *image, 250 psU32 row) 251 251 { 252 252 PS_ASSERT_IMAGE_NON_NULL(image, NULL); … … 261 261 262 262 /****************************************************************************** 263 MyListAddPeak(): A private function which allocates a psArray, if the list263 myListAddPeak(): A private function which allocates a psArray, if the list 264 264 argument is NULL, otherwise it adds the peak to that list. 265 XXX EAM : changed the output to psArray 266 XXX EAM : Switched row, col args 265 XXX EAM : changed the output to psArray 266 XXX EAM : Switched row, col args 267 267 XXX EAM : NOTE: this was changed in the call, so the new code is consistent 268 268 *****************************************************************************/ 269 psArray *MyListAddPeak(psArray *list,270 psS32 row,271 psS32 col,272 psF32 counts,273 psPeakType type)269 static psArray *myListAddPeak(psArray *list, 270 psS32 row, 271 psS32 col, 272 psF32 counts, 273 psPeakType type) 274 274 { 275 275 psPeak *tmpPeak = pmPeakAlloc(col, row, counts, type); … … 320 320 // 321 321 row = 0; 322 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);322 tmpRow = getRowVectorFromImage((psImage *) image, row); 323 323 psVector *row1 = pmFindVectorPeaks(tmpRow, threshold); 324 324 … … 334 334 335 335 if (image->data.F32[row][col] > threshold) { 336 list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);336 list = myListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE); 337 337 } 338 338 } … … 344 344 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 345 345 if (image->data.F32[row][col] > threshold) { 346 list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);346 list = myListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE); 347 347 } 348 348 } … … 353 353 (image->data.F32[row][col] >= image->data.F32[row+1][col-1])) { 354 354 if (image->data.F32[row][col] > threshold) { 355 list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);355 list = myListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE); 356 356 } 357 357 } … … 373 373 // 374 374 for (row = 1 ; row < (image->numRows - 1) ; row++) { 375 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);375 tmpRow = getRowVectorFromImage((psImage *) image, row); 376 376 row1 = pmFindVectorPeaks(tmpRow, threshold); 377 377 … … 389 389 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 390 390 myType = PM_PEAK_EDGE; 391 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);391 list = myListAddPeak(list, row, col, image->data.F32[row][col], myType); 392 392 } 393 393 } else if (col < (image->numCols - 1)) { … … 424 424 } 425 425 426 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);426 list = myListAddPeak(list, row, col, image->data.F32[row][col], myType); 427 427 } 428 428 } … … 436 436 (image->data.F32[row][col] >= image->data.F32[row+1][col])) { 437 437 myType = PM_PEAK_EDGE; 438 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);438 list = myListAddPeak(list, row, col, image->data.F32[row][col], myType); 439 439 } 440 440 } else { … … 449 449 // 450 450 row = image->numRows - 1; 451 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);451 tmpRow = getRowVectorFromImage((psImage *) image, row); 452 452 row1 = pmFindVectorPeaks(tmpRow, threshold); 453 453 for (psU32 i = 0 ; i < row1->n ; i++ ) { … … 458 458 (image->data.F32[row][col] > image->data.F32[row][col+1])) { 459 459 if (image->data.F32[row][col] > threshold) { 460 list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);460 list = myListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE); 461 461 } 462 462 } … … 468 468 (image->data.F32[row][col] >= image->data.F32[row][col+1])) { 469 469 if (image->data.F32[row][col] > threshold) { 470 list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);470 list = myListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE); 471 471 } 472 472 } … … 477 477 (image->data.F32[row][col] > image->data.F32[row][col-1])) { 478 478 if (image->data.F32[row][col] > threshold) { 479 list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);479 list = myListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE); 480 480 } 481 481 } … … 488 488 489 489 // XXX: Macro this. 490 bool IsItInThisRegion(const psRegion *valid,491 psS32 x,492 psS32 y)490 static bool isItInThisRegion(const psRegion *valid, 491 psS32 x, 492 psS32 y) 493 493 { 494 494 … … 529 529 if ((tmpPeak->counts > maxValue) || 530 530 ((valid != NULL) && 531 (true == IsItInThisRegion(valid, tmpPeak->x, tmpPeak->y)))) {531 (true == isItInThisRegion(valid, tmpPeak->x, tmpPeak->y)))) { 532 532 psListRemoveData(peaks, (psPtr) tmpPeak); 533 533 } … … 556 556 continue; 557 557 if (valid != NULL) { 558 if ( IsItInThisRegion(valid, tmpPeak->x, tmpPeak->y))558 if (isItInThisRegion(valid, tmpPeak->x, tmpPeak->y)) 559 559 continue; 560 560 } … … 740 740 741 741 /****************************************************************************** 742 bool CheckRadius(*peak, radius, x, y): private function which simply742 bool checkRadius(*peak, radius, x, y): private function which simply 743 743 determines if the (x, y) point is within the radius of the specified peak. 744 744 745 745 XXX: macro this for performance. 746 746 *****************************************************************************/ 747 bool CheckRadius(psPeak *peak,748 psF32 radius,749 psS32 x,750 psS32 y)747 static bool checkRadius(psPeak *peak, 748 psF32 radius, 749 psS32 x, 750 psS32 y) 751 751 { 752 752 if (PS_SQR(radius) >= (psF32) (PS_SQR(x - peak->x) + PS_SQR(y - peak->y))) { … … 758 758 759 759 /****************************************************************************** 760 bool CheckRadius2(): private function which simply determines if the (x, y)760 bool checkRadius2(): private function which simply determines if the (x, y) 761 761 point is within the radius of the specified peak. 762 762 … … 764 764 XXX: this is rather inefficient - at least compute and compare against radius^2 765 765 *****************************************************************************/ 766 bool CheckRadius2(psF32 xCenter,767 psF32 yCenter,768 psF32 radius,769 psF32 x,770 psF32 y)766 static bool checkRadius2(psF32 xCenter, 767 psF32 yCenter, 768 psF32 radius, 769 psF32 x, 770 psF32 y) 771 771 { 772 772 /// XXX EAM should compare with hypot (x,y) for speed … … 840 840 psS32 imgColCoord = col + source->pixels->col0; 841 841 psS32 imgRowCoord = row + source->pixels->row0; 842 if ( CheckRadius(source->peak,842 if (checkRadius(source->peak, 843 843 radius, 844 844 imgColCoord, … … 896 896 psS32 imgColCoord = col + source->pixels->col0; 897 897 psS32 imgRowCoord = row + source->pixels->row0; 898 if ( CheckRadius(source->peak,898 if (checkRadius(source->peak, 899 899 radius, 900 900 imgColCoord, … … 1276 1276 for (psS32 col = 0 ; col < source->mask->numCols; col++) { 1277 1277 1278 if ( CheckRadius2((psF32) radiusS32,1278 if (checkRadius2((psF32) radiusS32, 1279 1279 (psF32) radiusS32, 1280 1280 radius, … … 1567 1567 routine returns a psArray of coordinates that evaluate to the specified level. 1568 1568 1569 XXX: Probably should remove the "image" argument. 1569 XXX: Probably should remove the "image" argument. 1570 1570 XXX: What type should the output coordinate vectors consist of? col,row? 1571 1571 XXX: Why a pmArray output? … … 1668 1668 } 1669 1669 1670 psVector *p_pmMinLM_Gauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1671 psVector *p_pmMinLM_PsuedoGauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1672 psVector *p_pmMinLM_Wauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1673 psVector *p_pmMinLM_TwistGauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1674 psVector *p_pmMinLM_Sersic_Vec(psImage *deriv, psVector *params, psArray *x); 1675 psVector *p_pmMinLM_SersicCore_Vec(psImage *deriv, psVector *params, psArray *x); 1670 #if 0 1671 static psVector *minLM_Gauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1672 static psVector *minLM_PsuedoGauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1673 static psVector *minLM_Wauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1674 static psVector *minLM_TwistGauss2D_Vec(psImage *deriv, psVector *params, psArray *x); 1675 static psVector *minLM_Sersic_Vec(psImage *deriv, psVector *params, psArray *x); 1676 static psVector *minLM_SersicCore_Vec(psImage *deriv, psVector *params, psArray *x); 1677 #endif 1676 1678 1677 1679 // XXX EAM : these are better starting values, but should be available from metadata? … … 1683 1685 1684 1686 XXX: should there be a mask value? 1685 XXX: Probably should remove the "image" argument. 1687 XXX: Probably should remove the "image" argument. 1686 1688 *****************************************************************************/ 1687 1689 bool pmSourceFitModel(psSource *source, … … 1772 1774 } 1773 1775 1774 bool p_pmSourceAddOrSubModel(psImage *image,1775 psSource *src,1776 bool center,1777 psS32 flag)1776 static bool sourceAddOrSubModel(psImage *image, 1777 psSource *src, 1778 bool center, 1779 psS32 flag) 1778 1780 { 1779 1781 PS_ASSERT_PTR_NON_NULL(src, false); … … 1847 1849 bool center) 1848 1850 { 1849 return( p_pmSourceAddOrSubModel(image, src, center, 0));1851 return(sourceAddOrSubModel(image, src, center, 0)); 1850 1852 } 1851 1853 … … 1856 1858 bool center) 1857 1859 { 1858 return( p_pmSourceAddOrSubModel(image, src, center, 1));1860 return(sourceAddOrSubModel(image, src, center, 1)); 1859 1861 } 1860 1862 … … 1874 1876 1875 1877 the argument "x" contains a single "x,y" coordinate pair. The function computes the object 1876 model, based on the parameters in "params" at the x,y point specified by *x, and returns the value. 1877 The derivatives are also caculated and returned in the "deriv" argument. parameter error checking is 1878 model, based on the parameters in "params" at the x,y point specified by *x, and returns the value. 1879 The derivatives are also caculated and returned in the "deriv" argument. parameter error checking is 1878 1880 skipped because speed is most important. 1879 1881 **/ -
trunk/psModules/test
- Property svn:ignore
-
old new 11 11 tst_pmReadoutCombine 12 12 tst_pmSubtractSky 13 tst_pmImageSubtract
-
- Property svn:ignore
-
trunk/psModules/test/.cvsignore
r3633 r4201 11 11 tst_pmReadoutCombine 12 12 tst_pmSubtractSky 13 13 tst_pmImageSubtract
Note:
See TracChangeset
for help on using the changeset viewer.
