Changeset 6778
- Timestamp:
- Apr 4, 2006, 3:49:41 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 6 edited
-
src/imageops/psImageGeomManip.c (modified) (1 diff)
-
src/imageops/psImagePixelExtract.c (modified) (4 diffs)
-
src/imageops/psImageStats.c (modified) (4 diffs)
-
src/mathtypes/psImage.c (modified) (3 diffs)
-
test/imageops/tst_psImagePixelExtract.c (modified) (2 diffs)
-
test/imageops/tst_psImageStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageGeomManip.c
r6750 r6778 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-04-0 1 02:43:57$12 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-04-05 01:49:40 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/imageops/psImagePixelExtract.c
r6770 r6778 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-04-0 4 22:04:45$10 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-04-05 01:49:40 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 333 333 return NULL; 334 334 } 335 /* 336 if (col1 < 1) { 337 col1 += input->numCols; 338 } 339 340 if (row1 < 1) { 341 row1 += input->numRows; 342 } 343 344 if ( col0 < 0 || 345 row0 < 0 || 346 col1 > input->numCols || 347 row1 > input->numRows || 348 col0 >= col1 || 349 row0 >= row1) { 350 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 351 PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID, 352 col0, col1, row0, row1, 353 input->numCols, input->numRows); 354 psFree(out); 355 return NULL; 356 } 357 */ 335 358 336 //Make sure x0 of region is inside image. If so, set col0 to corresponding index number. 359 337 if (col0 >= input->col0 && col0 < (input->col0 + input->numCols) ) { … … 709 687 return NULL; 710 688 } 711 /*712 //Make sure x1 of region is valid. If negative, index from tail (if valid).713 if (col1 < 0) {714 col1 += input->numCols;715 if (col1 < 0) {716 psError(PS_ERR_BAD_PARAMETER_VALUE, true,717 "Specified psRegion parameter, x1=%f=%f, is out of range [%d,%d].\n",718 region.x1, col1+input->col0, input->col0, input->col0+input->numCols);719 psFree(out);720 return NULL;721 }722 } else if (col1 >= input->col0 && col1 < (input->col0 + input->numCols) ) {723 col1 -= input->col0;724 } else {725 psError(PS_ERR_BAD_PARAMETER_VALUE, true,726 "Specified psRegion parameter, x1=%f=%f, is out of range [%d,%d].\n",727 region.x1, col1, input->col0, input->col0+input->numCols);728 psFree(out);729 return NULL;730 }731 //Make sure y1 of region is valid. If negative, index from tail (if valid).732 if (row1 < 0) {733 row1 += input->numRows;734 if (row1 < 0) {735 psError(PS_ERR_BAD_PARAMETER_VALUE, true,736 "Specified psRegion parameter, y1=%f=%f, is out of range [%d,%d].\n",737 region.y1, row1+input->row0, input->row0, input->row0+input->numRows);738 psFree(out);739 return NULL;740 }741 } else if (row1 >= input->row0 && row1 < (input->row0 + input->numRows) ) {742 row1 -= input->row0;743 } else {744 psError(PS_ERR_BAD_PARAMETER_VALUE, true,745 "Specified psRegion parameter, y1=%f=%f, is out of range [%d,%d].\n",746 region.y1, row1, input->row0, input->row0+input->numRows);747 psFree(out);748 return NULL;749 }750 */751 /* //Now make sure that the region makes sense.752 if (col0 > col1 || row0 > row1) {753 if (col0 > col1) {754 psError(PS_ERR_BAD_PARAMETER_VALUE, true,755 "Invalid psRegion specified. x0=%f=%f is greater than x1=%f=%f.\n",756 region.x0, col0, region.x1, col1);757 } else {758 psError(PS_ERR_BAD_PARAMETER_VALUE, true,759 "Invalid psRegion specified. y0=%f=%f is greater than y1=%f=%f.\n",760 region.y0, row0, region.y1, row1);761 }762 psFree(out);763 return NULL;764 } else if (col0 == col1 && row0 == row1) {765 psError(PS_ERR_BAD_PARAMETER_VALUE, true,766 "Invalid psRegion specified. Region contains only 1 pixel.\n");767 psFree(out);768 return NULL;769 }770 */771 689 if (col1 < 0 || row1 < 0 || col0 < 0 || row0 < 0 || col0 >= numCols || col1 >= numCols || 772 690 row0 >= numRows || row1 >= numRows) { … … 778 696 float endCol = col1; 779 697 float endRow = row1; 780 /*781 float startCol = region.x0;782 float startRow = region.y0;783 float endCol = region.x1;784 float endRow = region.y1;785 if (startCol < 0 || startCol >= numCols ||786 startRow < 0 || startRow >= numRows ||787 endCol < 0 || endCol >= numCols ||788 endRow < 0 || endRow >= numRows) {789 psError(PS_ERR_BAD_PARAMETER_VALUE, true,790 PS_ERRORTEXT_psImage_LINE_NOT_IN_IMAGE,791 startCol,startRow,endCol,endRow,792 numCols-1,numRows-1);793 psFree(out);794 return NULL;795 }796 */797 698 798 699 if (mode < PS_INTERPOLATE_FLAT ) { -
trunk/psLib/src/imageops/psImageStats.c
r6750 r6778 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.9 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-04-0 1 02:43:57$11 * @version $Revision: 1.92 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-04-05 01:49:40 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 657 657 } 658 658 region = psRegionForImage(mask, region); 659 659 660 660 if (region.x0 == region.x1 || region.y0 == region.y1) { 661 661 psError(PS_ERR_BAD_PARAMETER_SIZE, true, … … 670 670 PS_ASSERT_INT_POSITIVE(mask->numRows, -1); 671 671 672 /* x0 = (int)(roundf(region.x0));673 x1 = (int)(roundf(region.x1));674 y0 = (int)(roundf(region.y0));675 y1 = (int)(roundf(region.y1));676 */677 672 int col0 = (int)(roundf(region.x0)); 678 673 int col1 = (int)(roundf(region.x1)); … … 753 748 return -1; 754 749 }/* else if (col0 == col1 && row0 == row1) { 755 psError(PS_ERR_BAD_PARAMETER_VALUE, true,756 "Invalid psRegion specified. Region contains only 1 pixel.\n");757 return -1;758 }759 */750 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 751 "Invalid psRegion specified. Region contains only 1 pixel.\n"); 752 return -1; 753 } 754 */ 760 755 x0 = col0; 761 756 x1 = col1; -
trunk/psLib/src/mathtypes/psImage.c
r6750 r6778 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.10 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-04-0 1 02:43:57$11 * @version $Revision: 1.101 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-04-05 01:49:41 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 703 703 } 704 704 705 bool p_psImagePrint (int fd, psImage *a, char *name) 705 bool p_psImagePrint (int fd, 706 psImage *a, 707 char *name) 706 708 { 707 709 write(fd,"matrix: ",8); … … 730 732 { 731 733 732 /* if (input == NULL) { 733 psError(PS_ERR_BAD_PARAMETER_NULL,true, 734 PS_ERRORTEXT_psImage_IMAGE_NULL); 734 PS_ASSERT_IMAGE_NON_NULL(input, unexposedValue); 735 /* if ( x < input->col0 || x >= (input->col0 + input->numCols) ) { 736 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 737 "x-input in psImagePixelInterpolate is outside of image region.\n"); 735 738 return unexposedValue; 736 739 } 740 if ( y < input->row0 || y >= (input->row0 + input->numRows) ) { 741 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 742 "y-input in psImagePixelInterpolate is outside of image region.\n"); 743 return unexposedValue; 744 } 745 x -= input->col0; 746 y -= input->row0; 737 747 */ 738 PS_ASSERT_IMAGE_NON_NULL(input, unexposedValue);739 if (input->row0 != 0 || input->col0 != 0) {740 x += input->col0;741 y += input->row0;742 }743 748 744 749 #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE) \ -
trunk/psLib/test/imageops/tst_psImagePixelExtract.c
r6770 r6778 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-04-0 4 22:04:46$8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-05 01:49:41 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 100 100 } \ 101 101 } \ 102 out = psImageSlice(out,positions,image,mask,1,psRegionSet(c/10,c/10+M,r/10,r/10+N),DIRECTION,stat); \ 102 image->col0 = 1; \ 103 image->row0 = 1; \ 104 out = psImageSlice(out,positions,image,mask,1, \ 105 psRegionSet(1+c/10,1+c/10+M,1+r/10,1+r/10+N),DIRECTION,stat); \ 103 106 \ 104 107 if (out->n != TRUTH_SIZE) { \ -
trunk/psLib/test/imageops/tst_psImageStats.c
r6750 r6778 634 634 } 635 635 636 //Test a subimage. 637 reg.y0 = 1; 638 reg.y1 = 5; 639 numPix2 = -1; 640 in2->row0 = 1; 641 numPix2 = psImageCountPixelMask(in2, reg, 1); 642 if (numPix2 != 2) { 643 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 644 "psImageCountPixelMask returned incorrect pixel count %ld (!=2)\n", numPix2); 645 return 11; 646 } 647 636 648 psFree(in); 637 649 psFree(in2);
Note:
See TracChangeset
for help on using the changeset viewer.
