LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Classes | Typedefs | Functions | Variables
lsst::afw::image::detail Namespace Reference

Classes

struct  basic_tag
 Base image tag. More...
 
struct  Image_tag
 tag for an Image More...
 
struct  image_traits
 traits class for image categories More...
 
struct  Mask_tag
 tag for a Mask More...
 
struct  MaskedImage_tag
 A traits class for MaskedImage. More...
 
struct  MaskedImagePixel_tag
 A class used to identify classes that represent MaskedImage pixels. More...
 
class  MaskDict
 

Typedefs

typedef std::map< std::string,
int > 
MaskPlaneDict
 

Functions

int stripCalibKeywords (boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
 
int stripFilterKeywords (boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
 
boost::shared_ptr
< lsst::daf::base::PropertyList
createTrivialWcsAsPropertySet (std::string const &wcsName, int const x0=0, int const y0=0)
 
geom::Point2I getImageXY0FromMetadata (std::string const &wcsName, lsst::daf::base::PropertySet *metadata)
 
int stripWcsKeywords (boost::shared_ptr< lsst::daf::base::PropertySet > const &metadata, boost::shared_ptr< Wcs const > const &wcs)
 

Variables

std::string const wcsNameForXY0 = "A"
 
std::string const fitsFile_RE = "\\.fits(\\.[fg]z)?$"
 
std::string const compressedFileNoMEF_RE = "(\\.gz)$"
 be written as MEFs More...
 

Typedef Documentation

typedef std::map<std::string, int> lsst::afw::image::detail::MaskPlaneDict

Definition at line 65 of file Mask.h.

Function Documentation

lsst::daf::base::PropertyList::Ptr lsst::afw::image::detail::createTrivialWcsAsPropertySet ( std::string const &  wcsName,
int const  x0,
int const  y0 
)

Define a trivial WCS that maps the lower left corner (LLC) pixel of an image to a given value

Parameters
wcsNameName of desired WCS
x0Column coordinate of LLC pixel
y0Row coordinate of LLC pixel

Definition at line 1228 of file Wcs.cc.

1231  {
1233 
1234  wcsMetaData->set("CRVAL1" + wcsName, x0, "Column pixel of Reference Pixel");
1235  wcsMetaData->set("CRVAL2" + wcsName, y0, "Row pixel of Reference Pixel");
1236  wcsMetaData->set("CRPIX1" + wcsName, 1, "Column Pixel Coordinate of Reference");
1237  wcsMetaData->set("CRPIX2" + wcsName, 1, "Row Pixel Coordinate of Reference");
1238  wcsMetaData->set("CTYPE1" + wcsName, "LINEAR", "Type of projection");
1239  wcsMetaData->set("CTYPE2" + wcsName, "LINEAR", "Type of projection");
1240  wcsMetaData->set("CUNIT1" + wcsName, "PIXEL", "Column unit");
1241  wcsMetaData->set("CUNIT2" + wcsName, "PIXEL", "Row unit");
1242 
1243  return wcsMetaData;
1244 }
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
boost::shared_ptr< PropertyList > Ptr
Definition: PropertyList.h:84
afwGeom::Point2I lsst::afw::image::detail::getImageXY0FromMetadata ( std::string const &  wcsName,
lsst::daf::base::PropertySet metadata 
)

Return a Point2I(x0, y0) given a PropertySet containing a suitable WCS (e.g. "A")

The WCS must have CRPIX[12] == 1 and CRVAL[12] must be present. If this is true, the WCS cards are removed from the metadata

Parameters
wcsNamethe WCS to search (E.g. "A")
metadatathe metadata, maybe containing the WCS

Definition at line 1251 of file Wcs.cc.

1253  {
1254 
1255  int x0 = 0; // Our value of X0
1256  int y0 = 0; // Our value of Y0
1257 
1258  try {
1259  //
1260  // Only use WCS if CRPIX[12] == 1 and CRVAL[12] is present
1261  //
1262  if (metadata->getAsDouble("CRPIX1" + wcsName) == 1 &&
1263  metadata->getAsDouble("CRPIX2" + wcsName) == 1) {
1264 
1265  x0 = metadata->getAsInt("CRVAL1" + wcsName);
1266  y0 = metadata->getAsInt("CRVAL2" + wcsName);
1267  //
1268  // OK, we've got it. Remove it from the header
1269  //
1270  metadata->remove("CRVAL1" + wcsName);
1271  metadata->remove("CRVAL2" + wcsName);
1272  metadata->remove("CRPIX1" + wcsName);
1273  metadata->remove("CRPIX2" + wcsName);
1274  metadata->remove("CTYPE1" + wcsName);
1275  metadata->remove("CTYPE1" + wcsName);
1276  metadata->remove("CUNIT1" + wcsName);
1277  metadata->remove("CUNIT2" + wcsName);
1278  }
1279  } catch(lsst::pex::exceptions::NotFoundError &) {
1280  ; // OK, not present
1281  }
1282 
1283  return afwGeom::Point2I(x0, y0);
1284 }
virtual void remove(std::string const &name)
Definition: PropertySet.cc:754
Point< int, 2 > Point2I
Definition: Point.h:274
int getAsInt(std::string const &name) const
Definition: PropertySet.cc:333
double getAsDouble(std::string const &name) const
Definition: PropertySet.cc:406
int lsst::afw::image::detail::stripCalibKeywords ( boost::shared_ptr< lsst::daf::base::PropertySet metadata)

Remove Calib-related keywords from the metadata

Returns
Number of keywords stripped
Parameters
metadataMetadata to be stripped

Definition at line 159 of file Calib.cc.

161 {
162  int nstripped = 0;
163 
164  std::string key = "TIME-MID";
165  if (metadata->exists(key)) {
166  metadata->remove(key);
167  nstripped++;
168  }
169 
170  key = "EXPTIME";
171  if (metadata->exists(key)) {
172  metadata->remove(key);
173  nstripped++;
174  }
175 
176  key = "FLUXMAG0";
177  if (metadata->exists(key)) {
178  metadata->remove(key);
179  nstripped++;
180  }
181 
182  key = "FLUXMAG0ERR";
183  if (metadata->exists(key)) {
184  metadata->remove(key);
185  nstripped++;
186  }
187 
188  return nstripped;
189 }
int lsst::afw::image::detail::stripFilterKeywords ( boost::shared_ptr< lsst::daf::base::PropertySet metadata)

Remove Filter-related keywords from the metadata

Returns
Number of keywords stripped
Parameters
metadataMetadata to be stripped

Definition at line 167 of file Filter.cc.

169 {
170  int nstripped = 0;
171 
172  std::string key = "FILTER";
173  if (metadata->exists(key)) {
174  metadata->remove(key);
175  nstripped++;
176  }
177 
178  return nstripped;
179 }
int lsst::afw::image::detail::stripWcsKeywords ( boost::shared_ptr< lsst::daf::base::PropertySet > const &  metadata,
boost::shared_ptr< Wcs const > const &  wcs 
)

Strip keywords from the input metadata that are related to the generated Wcs

It isn't entirely obvious that this is enough — e.g. if the input metadata has deprecated WCS keywords such as CDELT[12] they won't be stripped. Well, actually we catch CDELT[12], LTV[12], and PC00[12]00[12] but there may be others

Parameters
metadataMetadata to be stripped
wcsA Wcs with (implied) keywords

Definition at line 1294 of file Wcs.cc.

1297 {
1298  PTR(lsst::daf::base::PropertySet) wcsMetadata = wcs->getFitsMetadata();
1299  std::vector<std::string> paramNames = wcsMetadata->paramNames();
1300  paramNames.push_back("CDELT1");
1301  paramNames.push_back("CDELT2");
1302  paramNames.push_back("LTV1");
1303  paramNames.push_back("LTV2");
1304  paramNames.push_back("PC001001");
1305  paramNames.push_back("PC001002");
1306  paramNames.push_back("PC002001");
1307  paramNames.push_back("PC002002");
1308  for (std::vector<std::string>::const_iterator ptr = paramNames.begin(); ptr != paramNames.end(); ++ptr) {
1309  metadata->remove(*ptr);
1310  }
1311 
1312  return 0; // would be ncard if remove returned a status
1313 }
#define PTR(...)
Definition: base.h:41
Class for storing generic metadata.
Definition: PropertySet.h:82

Variable Documentation

std::string const lsst::afw::image::detail::compressedFileNoMEF_RE = "(\\.gz)$"

be written as MEFs

regexp to identify when MaskedImages should

Definition at line 59 of file MaskedImage.h.

std::string const lsst::afw::image::detail::fitsFile_RE = "\\.fits(\\.[fg]z)?$"

Definition at line 57 of file MaskedImage.h.

std::string const lsst::afw::image::detail::wcsNameForXY0 = "A"

Definition at line 82 of file Image.h.