9#include "LroWideAngleCamera.h"
10#include "LroWideAngleCameraFocalPlaneMap.h"
11#include "LroWideAngleCameraDistortionMap.h"
19#include "CameraFocalPlaneMap.h"
20#include "CameraSkyMap.h"
21#include "CollectorMap.h"
22#include "IException.h"
25#include "NaifStatus.h"
26#include "PushFrameCameraDetectorMap.h"
27#include "PushFrameCameraGroundMap.h"
59 QString stime = inst[
"SpacecraftClockStartCount"];
68 QString instId = inst[
"InstrumentId"][0].toUpper();
70 int frameletSize = 14;
72 int filterIKBase = 10;
74 if (instId ==
"WAC-UV") {
77 filterIKBase = 15 - 1;
81 else if (instId ==
"WAC-VIS") {
84 filterIKBase = 10 - 3;
89 QString msg =
"Invalid value [" + instId
90 +
"] for keyword [InstrumentId]";
99 const PvlKeyword &filtNames = bandBin[
"Center"];
102 if (nbands != filtNames.
size()) {
104 mess <<
"Number bands in (file) label (" << nbands
105 <<
") do not match number of values in BandBin/Center keyword ("
106 << filtNames.
size() <<
") - required for band-dependent geoemtry";
111 bool dataflipped = (inst[
"DataFlipped"][0].toUpper() ==
"YES");
114 QString instCode =
"INS" + QString::number(
naifIkCode());
116 QString ikernKey = instCode +
"_FILTER_BANDCENTER";
117 IntParameterList fbc =
GetVector(ikernKey);
119 ikernKey = instCode +
"_FILTER_OFFSET";
120 IntParameterList foffset =
GetVector(ikernKey);
123 ikernKey = instCode +
"_FILTER_BANDID";
124 IntParameterList fbandid =
GetVector(ikernKey);
131 for (
int i = 0 ; i < foffset.size() ; i++) {
132 filterToDetectorOffset.
add(fbc[i], foffset[i]);
133 wavel.
add(foffset[i], fbc[i]);
134 filterIKCode.
add(fbc[i],
naifIkCode() - (filterIKBase + fbandid[i]));
140 int frameletOffsetFactor = inst[
"ColorOffset"];
141 if ( dataflipped ) frameletOffsetFactor *= -1;
143 for (
int j = 0 ; j < wavel.
size() ; j++) {
144 int wavelen = wavel.
getNth(j);
145 filterToFrameletOffset.
add(wavelen, j * frameletOffsetFactor);
150 for (
int i = 0; i < filtNames.
size(); i++) {
151 if (!filterToDetectorOffset.
exists(filtNames[i].toInt())) {
152 QString msg =
"Unrecognized filter name [" + filtNames[i] +
"]";
156 p_detectorStartLines.push_back(filterToDetectorOffset.
get(filtNames[i].toInt()));
157 p_frameletOffsets.push_back(filterToFrameletOffset.
get(filtNames[i].toInt()));
159 QString kBase =
"INS" + QString::number(filterIKCode.
get(filtNames[i].toInt()));
160 p_focalLength.push_back(
getDouble(kBase+
"_FOCAL_LENGTH"));
161 p_boreSightSample.push_back(
getDouble(kBase+
"_BORESIGHT_SAMPLE"));
162 p_boreSightLine.push_back(
getDouble(kBase+
"_BORESIGHT_LINE"));
166 double frameletRate = (double) inst[
"InterframeDelay"] / 1000.0;
173 bool flippedFramelets = dataflipped;
178 QString instModeId = inst[
"InstrumentModeId"][0].toUpper();
181 if (instModeId ==
"BW") {
182 instModeId += inst[
"Mode"][0];
185 p_frameletOffsets[0] = 0;
188 ikernKey = instCode +
"_" + instModeId +
"_SAMPLE_OFFSET";
196 for (
int i = 0 ; i < filtNames.
size() ; i++ ) {
197 fplane->
addFilter(filterIKCode.
get(filtNames[i].toInt()));
198 distort->
addFilter(filterIKCode.
get(filtNames[i].toInt()));
202 bool evenFramelets = (inst[
"Framelets"][0].toUpper() ==
"EVEN");
210 if(instId ==
"WAC-UV") {
235 int maxVirtualBands = min(p_detectorStartLines.size(), p_frameletOffsets.size());
236 if (((vband <= 0) || (vband > maxVirtualBands)) && (vband >
Bands())) {
238 mess <<
"Requested virtual band (" << vband
239 <<
") outside valid (BandBin/Center) limits (1 - " << maxVirtualBands
246 if ((vband > maxVirtualBands) && (vband <=
Bands())) {
263 p_boreSightLine.at(vband-1) + 1.0);
280 dtpool_c(key.toLatin1().data(), &found, &n, ctype);
292 QVariant poolKeySize = getStoredResult(key +
"_SIZE",
SpiceIntType);
294 int nvals = poolKeySize.toInt();
304 QString mess =
"Kernel pool keyword " + key +
" not found!";
308 IntParameterList parms;
309 for (
int i = 0; i<kw.
size(); i++){
310 parms.push_back(
toInt(kw[i]));
315 IntParameterList parms;
316 for (
int i = 0 ; i < nvals ; i++) {
333 return p_frameletOffsets.size() == 1;
void SetDetectorLineSumming(const double summing)
Set line summing mode.
void SetStartingDetectorSample(const double sample)
Set the starting detector sample.
void SetDetectorSampleSumming(const double summing)
Set sample summing mode.
void SetDetectorOrigin(const double sample, const double line)
Set the detector origin.
QString m_spacecraftNameLong
Full spacecraft name.
int ParentLines() const
Returns the number of lines in the parent alphacube.
void SetGeometricTilingHint(int startSize=128, int endSize=8)
This method sets the best geometric tiling size for projecting from this camera model.
void SetFocalLength()
Reads the focal length from the instrument kernel.
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
void LoadCache()
This loads the spice cache big enough for this image.
QString m_instrumentNameShort
Shortened instrument name.
CameraDistortionMap * DistortionMap()
Returns a pointer to the CameraDistortionMap object.
QString m_spacecraftNameShort
Shortened spacecraft name.
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
virtual void SetBand(const int band)
Virtual method that sets the band number.
QString m_instrumentNameLong
Full instrument name.
int Bands() const
Returns the number of bands in the image.
Convert between undistorted focal plane and ra/dec coordinates.
Collector/container for arbitrary items.
int size() const
Returns the size of the collection.
T & get(const K &key)
Returns the value associated with the name provided.
bool exists(const K &key) const
Checks the existance of a particular key in the list.
void add(const K &key, const T &value)
Adds the element to the list.
T & getNth(int nth)
Returns the nth value in the collection.
IO Handler for Isis Cubes.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
@ Programmer
This error is for when a programmer made an API call that was illegal.
Distort/undistort focal plane coordinates.
void setBand(int vband)
Implements band-dependant distortion parameters.
void addFilter(int naifIkCode)
Add an additional set of parameters for a given LROC/WAC filter.
Distort/undistort focal plane coordinates.
void addFilter(int naifIkCode)
Add an additional set of parameters for a given LROC/WAC filter.
void setBand(int vband)
Implements band-dependant focal plane parameters.
LRO Wide Angle Camera Model.
bool IsBandIndependent()
The camera model is band dependent, so this method returns false.
virtual int CkFrameId() const
CK frame ID - - Instrument Code from spacit run on CK.
IntParameterList GetVector(const QString &key)
double p_etStart
Ephemeris Start iTime.
int PoolKeySize(const QString &key) const
virtual int CkReferenceId() const
CK Reference ID - J2000.
void SetBand(const int band)
Sets the band in the camera model.
LroWideAngleCamera(Cube &cube)
Constructor for the LRO WAC Camera Model.
virtual int SpkReferenceId() const
SPK Reference ID - J2000.
double p_exposureDur
Exposure Duration value from labels.
int p_nframelets
Number of framelets in whole image.
~LroWideAngleCamera()
Destroys the LroWideAngleCamera object.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Convert between parent image coordinates and detector coordinates.
void SetFrameletsGeometricallyFlipped(bool frameletsFlipped)
Mirrors the each framelet in the file.
void SetBandFirstDetectorLine(int firstLine)
Change the starting line in the detector based on band.
void SetFrameletOffset(int frameletOffset)
Reset the frame offset.
void SetFrameletOrderReversed(bool frameletOrderReversed, int nframelets)
Changes the direction of the framelets.
Convert between undistorted focal plane and ground coordinates.
PushFrameCamera(Isis::Cube &cube)
Constructs the PushFrameCamera object.
PushFrameCameraDetectorMap * DetectorMap()
Returns a pointer to the PushFrameCameraDetectorMap object.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
int size() const
Returns the number of values stored in this keyword.
Contains Pvl Groups and Pvl Objects.
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
@ Traverse
Search child objects.
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
virtual iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
@ SpiceIntType
SpiceInt type.
PvlObject getStoredNaifKeywords() const
This returns the PvlObject that stores all of the requested Naif data and can be a replacement for fu...
virtual SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
void SetFrame(int frameCode)
Change the frame to the given frame code.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
This is free and unencumbered software released into the public domain.
int toInt(const QString &string)
Global function to convert from a string to an integer.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Namespace for the standard library.