Isis 3 Programmer Reference
ApolloPanoramicDetectorMap.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ApolloPanoramicDetectorMap.h"
10#include "Application.h"
11#include "PvlGroup.h"
12#include "SerialNumber.h"
13#include "Table.h"
14#include "iTime.h"
15
16#include <iostream>
17using namespace std;
18
19using namespace std;
20namespace Isis {
29 bool ApolloPanoramicDetectorMap::SetDetector(const double sample, const double line) {
30 //given a detector coordinate and a time (read from the 'parent' camera class)
31 // set the image coordinates
32 //save the detector coordinates
33 //negative signs are counterintuitive and I cannot fully explain them, I believe they are
34 // because of the negative z direction in the distortion map....
35 p_detectorLine = -line;
36 p_detectorSample = -sample;
37
38 //convert from detector to fiducial coordinants
39 double fidL = (p_camera->time().Et() - m_etMiddle)/m_lineRate;
40 //double fidS = sample; //conversion is identity so it is skiped
41
42 //convert from fiducial coordinates to parent image coordinates
44
45 //cout << "fiducial values sent to IO: " << p_detectorSample << " " << fidL << endl; //debug
46 //cout << "cube coordinates returned from IO: " << p_parentSample << " " << p_parentLine << endl;
47 return true;
48 }
49
58 bool ApolloPanoramicDetectorMap::SetParent(const double sample, const double line) {
59 //Given an image (aka 'Parent', aka encoder, aka machine) coordinate set the detector
60 //coordiante and the time (time is set in the 'parent' camera class)
61 //save the parent data
62 p_parentLine = line;
63 p_parentSample = sample;
64 //convert from machine to fiducial coordinates
65 //cout << "cube coordinates sent to IO: " << sample << " " << line << endl; //debug
66
68
69 //cout << "fiducial coordinate return from IO: " << p_detectorSample << " " << p_detectorLine << endl;
70 //convert from fiducial coordinates to detector/time coordinates
72 p_camera->setTime(isisTime);
73 //This declaration may cause some debate. Regardless it seems to that
74 // since we model the motion of the camera as continuous smooth motion
75 // (not some discretely defined series of 1 pixel or 1 mm wide 'push-frames'),
76 // and we calculate the positions, pointings, etc at the specific time implied
77 // by the sub-pixel/mm line then the line in the dector will always be the same
78 // (in this case zero)
79 p_detectorLine = 0.0;
80
81 return true;
82 }
83
97 int i,nrec;
98 //read the fidicial measurements from the attached table in the camera labels to define a
99 // series of affine transformation between image (aka encoder aka machine) coordinates
100 // and fiducial coordinates
101 Table tableFid("Fiducial Measurement", m_lab->fileName());
102
103 nrec = tableFid.Records(); //get the number of records found in the cube blobs
104
105 if( nrec <= 0) {
106 throw IException(IException::User,"No FID_MEASURES table found in cube blobs.\n",
107 _FILEINFO_);
108 return -1;
109 }
110 if( tableFid.Records() < 4) {
111 throw IException(IException::User,"Less than four FID_MEASURES found in cube blobs.\n",
112 _FILEINFO_);
113 return -1;
114 }
116
117 for(i=0;i<nrec;i++) //input all the observations to the the Interior Orientation Class
118 p_intOri.fiducialObservation(tableFid[i][0], tableFid[i][1], tableFid[i][2]);
119
121
122 if( i != 1) { //unsuccessful computation of the interior orienation
123 throw IException(IException::User,"Insufficient Fiducial Observations for computation of "
124 "the interior orientation.\nAt least one vertical pair "
125 "must be measured, many more is recomented.\n",
126 _FILEINFO_);
127 return -1;
128 }
129
130 return 1;
131 }
132} //end namespace Isis
void initialize()
Initilizes member variables in preparation for solving for the interior orientation affines.
int machine2Image(double *machineX, double *machineY)
This method does an in place (overwriting input) conversion of a cube coordinate (sample,...
int image2Machine(double *imageX, double *imageY)
This method does an in place (overwriting input) conversion of an image coordinate into cube (machine...
int fiducialObservation(int fiducialNumber, double machine_x, double machine_y)
This method adds a measurement of the center of an apollo panoramic image fiducial mark for considera...
int computeInteriorOrienation()
This method leverages all the fiducial obersatvions to caculate a series of affine transformations fo...
int initializeInteriorOrientation()
This method uses the ApolloPanIO class to compute transforamtion from cube to image (aka fiducial coo...
virtual bool SetParent(const double sample, const double line)
This method sets dector sample line coordinates from given cube coordinates.
double m_etMiddle
Ephemeris time at the middle line.
virtual bool SetDetector(const double sample, const double line)
This method sets cube sample line coordinates from given Dector coordinates.
Pvl * m_lab
Image label used to construct camera object.
ApolloPanIO p_intOri
Class to preform transformations from cube coordiantes to image coordinates.
double p_parentLine
The parent line calculated from the detector.
double p_parentSample
The parent sample calculated from the detector.
double p_detectorSample
Detector coordinate sample value.
double p_detectorLine
Detector coordinate line value.
Camera * p_camera
Pointer to the camera.
Isis exception class.
Definition IException.h:91
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
QString fileName() const
Returns the filename used to initialise the Pvl object.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
Definition Sensor.cpp:99
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition Spice.cpp:891
Class for storing Table blobs information.
Definition Table.h:61
int Records() const
Returns the number of records.
Definition Table.cpp:313
Parse and return pieces of a time string.
Definition iTime.h:65
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition iTime.h:126
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.