LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 1187 of file Wcs.cc.

1190  {
1192 
1193  wcsMetaData->set("CRVAL1" + wcsName, x0, "Column pixel of Reference Pixel");
1194  wcsMetaData->set("CRVAL2" + wcsName, y0, "Row pixel of Reference Pixel");
1195  wcsMetaData->set("CRPIX1" + wcsName, 1, "Column Pixel Coordinate of Reference");
1196  wcsMetaData->set("CRPIX2" + wcsName, 1, "Row Pixel Coordinate of Reference");
1197  wcsMetaData->set("CTYPE1" + wcsName, "LINEAR", "Type of projection");
1198  wcsMetaData->set("CTYPE2" + wcsName, "LINEAR", "Type of projection");
1199  wcsMetaData->set("CUNIT1" + wcsName, "PIXEL", "Column unit");
1200  wcsMetaData->set("CUNIT2" + wcsName, "PIXEL", "Row unit");
1201 
1202  return wcsMetaData;
1203 }
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
int const x0
Definition: saturated.cc:45
boost::shared_ptr< PropertyList > Ptr
Definition: PropertyList.h:84
int const y0
Definition: saturated.cc:45
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 1210 of file Wcs.cc.

1212  {
1213 
1214  int x0 = 0; // Our value of X0
1215  int y0 = 0; // Our value of Y0
1216 
1217  try {
1218  //
1219  // Only use WCS if CRPIX[12] == 1 and CRVAL[12] is present
1220  //
1221  if (metadata->getAsDouble("CRPIX1" + wcsName) == 1 &&
1222  metadata->getAsDouble("CRPIX2" + wcsName) == 1) {
1223 
1224  x0 = metadata->getAsInt("CRVAL1" + wcsName);
1225  y0 = metadata->getAsInt("CRVAL2" + wcsName);
1226  //
1227  // OK, we've got it. Remove it from the header
1228  //
1229  metadata->remove("CRVAL1" + wcsName);
1230  metadata->remove("CRVAL2" + wcsName);
1231  metadata->remove("CRPIX1" + wcsName);
1232  metadata->remove("CRPIX2" + wcsName);
1233  metadata->remove("CTYPE1" + wcsName);
1234  metadata->remove("CTYPE1" + wcsName);
1235  metadata->remove("CUNIT1" + wcsName);
1236  metadata->remove("CUNIT2" + wcsName);
1237  }
1238  } catch(lsst::pex::exceptions::NotFoundError &) {
1239  ; // OK, not present
1240  }
1241 
1242  return afwGeom::Point2I(x0, y0);
1243 }
virtual void remove(std::string const &name)
Definition: PropertySet.cc:754
Point< int, 2 > Point2I
Definition: Point.h:283
int const x0
Definition: saturated.cc:45
int getAsInt(std::string const &name) const
Definition: PropertySet.cc:333
double getAsDouble(std::string const &name) const
Definition: PropertySet.cc:406
int const y0
Definition: saturated.cc:45
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 1253 of file Wcs.cc.

1256 {
1257  PTR(lsst::daf::base::PropertySet) wcsMetadata = wcs->getFitsMetadata();
1258  std::vector<std::string> paramNames = wcsMetadata->paramNames();
1259  paramNames.push_back("CDELT1");
1260  paramNames.push_back("CDELT2");
1261  paramNames.push_back("LTV1");
1262  paramNames.push_back("LTV2");
1263  paramNames.push_back("PC001001");
1264  paramNames.push_back("PC001002");
1265  paramNames.push_back("PC002001");
1266  paramNames.push_back("PC002002");
1267  for (std::vector<std::string>::const_iterator ptr = paramNames.begin(); ptr != paramNames.end(); ++ptr) {
1268  metadata->remove(*ptr);
1269  }
1270 
1271  return 0; // would be ncard if remove returned a status
1272 }
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
Definition: saturated.cc:82
#define PTR(...)
Definition: base.h:41
tbl::Key< int > wcs
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.