Changeset 19384 for trunk/psLib/src/fits/psFitsImage.c
- Timestamp:
- Sep 4, 2008, 10:08:33 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/fits/psFitsImage.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fits/psFitsImage.c
r19383 r19384 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $10 * @date $Date: 2008-09-05 0 7:51:09$9 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2008-09-05 08:08:33 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 892 892 bool psFitsWriteImageCube(psFits *fits, psMetadata *header, const psArray *input, const char *extname) 893 893 { 894 return psFitsWriteImageCubeWithMask(fits, header, input, NULL, 0, extname); 895 } 896 897 bool psFitsWriteImageCubeWithMask(psFits *fits, psMetadata *header, const psArray *input, 898 const psArray *masks, psMaskType maskVal, const char *extname) 899 { 894 900 PS_ASSERT_FITS_NON_NULL(fits, false); 895 901 PS_ASSERT_FITS_WRITABLE(fits, false); 896 902 PS_ASSERT_ARRAY_NON_NULL(input, false); 903 if (masks) { 904 PS_ASSERT_ARRAY_NON_NULL(masks, false); 905 PS_ASSERT_ARRAYS_SIZE_EQUAL(masks, input, false); 906 } 897 907 898 908 if (input->n == 0) { … … 903 913 if (input->n == 1) { 904 914 // The problem reduces to one already solved 905 return psFitsWriteImage(fits, header, input->data[0], 1, extname); 915 return psFitsWriteImageWithMask(fits, header, input->data[0], 916 masks ? masks->data[0] : NULL, maskVal, 1, extname); 906 917 } 907 918 … … 930 941 psMetadataAddS32(headerCopy, PS_LIST_HEAD, "NAXIS3", PS_META_REPLACE, "Number of image planes", 931 942 input->n); 932 if (! update) {943 if (!update) { 933 944 psError(PS_ERR_UNKNOWN, false, _("Failed to add metadata item, %s."), 934 945 "NAXIS, NAXIS1, NAXIS2, NAXIS3"); … … 940 951 // The first is an psFitsImageWrite to create the extension. 941 952 // The next are psFitsImageUpdate to write into the extension. 942 if (! psFitsWriteImage(fits, headerCopy, input->data[0], input->n, extname)) { 953 if (!psFitsWriteImageWithMask(fits, headerCopy, input->data[0], 954 masks ? masks->data[0] : NULL, maskVal, input->n, extname)) { 943 955 psError(PS_ERR_UNKNOWN, false, _("Could not write image plane %d."), 0); 944 956 psFree(headerCopy); … … 948 960 949 961 for (int i = 1; i < input->n; i++) { 950 if (! psFitsUpdateImage(fits, input->data[i], 0, 0, i)) { 962 if (!psFitsUpdateImageWithMask(fits, input->data[i], 963 masks ? masks->data[i] : NULL, maskVal, 0, 0, i)) { 951 964 psError(PS_ERR_UNKNOWN, false, _("Could not write image plane %d."), i); 952 965 return false; … … 958 971 959 972 bool psFitsUpdateImageCube(psFits *fits, const psArray *input, int x0, int y0) 973 { 974 return psFitsUpdateImageCubeWithMask(fits, input, NULL, 0, x0, y0); 975 } 976 977 bool psFitsUpdateImageCubeWithMask(psFits *fits, const psArray *input, 978 const psArray *masks, psMaskType maskVal, int x0, int y0) 960 979 { 961 980 PS_ASSERT_FITS_NON_NULL(fits, false); … … 969 988 970 989 for (int i = 0; i < input->n; i++) { 971 if (! psFitsUpdateImage(fits, input->data[i], x0, y0, i)) { 990 if (!psFitsUpdateImageWithMask(fits, input->data[i], 991 masks ? masks->data[i] : NULL, maskVal, x0, y0, i)) { 972 992 psError(PS_ERR_UNKNOWN, false, _("Could not update image plane %d."), i); 973 993 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
