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";
119 ikernKey = instCode +
"_FILTER_OFFSET";
123 ikernKey = instCode +
"_FILTER_BANDID";
130 CollectorMap<int, int> filterToDetectorOffset, wavel,filterIKCode;
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;
142 CollectorMap<int, int> filterToFrameletOffset;
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;
169 dmap->SetDetectorSampleSumming(sumMode);
170 dmap->SetDetectorLineSumming(sumMode);
173 bool flippedFramelets = dataflipped;
174 dmap->SetFrameletOrderReversed(flippedFramelets,
p_nframelets);
175 dmap->SetFrameletsGeometricallyFlipped(
false);
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";
190 dmap->SetStartingDetectorSample(sampOffset+1);
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())) {
256 dmap->SetFrameletOffset(p_frameletOffsets.at(vband - 1));
261 fplane->setBand(vband);
263 p_boreSightLine.at(vband-1) + 1.0);
266 distort->setBand(vband);
280 dtpool_c(key.toLatin1().data(), &found, &n, ctype);
292 QVariant poolKeySize = getStoredResult(key +
"_SIZE",
SpiceIntType);
294 int nvals = poolKeySize.toInt();
303 if (!NaifKeywords.hasKeyword(key)){
304 QString mess =
"Kernel pool keyword " + key +
" not found!";
309 for (
int i = 0; i<kw.size(); i++){
310 parms.push_back(
toInt(kw[i]));
316 for (
int i = 0 ; i < nvals ; i++) {
333 return p_frameletOffsets.size() == 1;
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.
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.
Distort/undistort focal plane coordinates.
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 SetBandFirstDetectorLine(int firstLine)
Change the starting line in the detector based on band.
Convert between undistorted focal plane and ground coordinates.
Generic class for Push Frame Cameras.
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.
@ Traverse
Search child objects.
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.
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.