/** * @internal * @history 2008-11-05 Jeannie Walldren - Replaced reference * to MocLabels IsWideAngleRed() with MocLabels * WideAngleRed(). */ MocWideAngleCamera::MocWideAngleCamera (Isis::Pvl &lab) : LineScanCamera(lab) { // See if we have a moc camera MocLabels *moclab = new Isis::Mgs::MocLabels(lab); double lineRate = moclab->LineRate(); double csum = moclab->CrosstrackSumming(); double dsum = moclab->DowntrackSumming(); double ss = moclab->FirstLineSample(); bool isRed = moclab->WideAngleRed(); // Set up the camera info from ik/iak kernels // LoadEulerMounting(); SetFocalLength(); SetPixelPitch(); if ( PixelPitch() == 1) { throw iException::Message(iException::User, "Cube file needs to be spiceinit'd with updated iak",_FILEINFO_); } InstrumentRotation()->SetTimeBias(-1.15); // Get the start time from labels Isis::PvlGroup &inst = lab.FindGroup ("Instrument",Isis::Pvl::Traverse); string stime = inst["SpacecraftClockCount"]; SpiceDouble etStart; scs2e_c (NaifSpkCode(),stime.c_str(),&etStart); // Setup detector map MocWideAngleDetectorMap *detectorMap = new MocWideAngleDetectorMap(this,etStart,lineRate,moclab); detectorMap->SetDetectorSampleSumming(csum); detectorMap->SetDetectorLineSumming(dsum); detectorMap->SetStartingDetectorSample(ss); // Setup focal plane map CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this,NaifIkCode()); if (isRed) { focalMap->SetDetectorOrigin(1674.65,0.0); focalMap->SetDetectorOffset(0.0,6.7785); } else { focalMap->SetDetectorOrigin(1688.58,0.0); focalMap->SetDetectorOffset(0.0,-0.8486); } // Setup distortion map new MocWideAngleDistortionMap(this,isRed); // Setup the ground and sky map new LineScanCameraGroundMap(this); new LineScanCameraSkyMap(this); LoadCache(); }
/** * Creates a Hirise Camera Model * * @param lab Pvl label from the iamge * @internal * @history 2011-05-03 Jeannie Walldren - Added NAIF error check. */ HiriseCamera::HiriseCamera(Cube &cube) : LineScanCamera(cube) { NaifStatus::CheckErrors(); // Setup camera characteristics from instrument and frame kernel SetFocalLength(); SetPixelPitch(); //LoadFrameMounting("MRO_SPACECRAFT", "MRO_HIRISE_OPTICAL_AXIS"); instrumentRotation()->SetFrame(-74690); // Get required keywords from instrument group Pvl &lab = *cube.label(); PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse); int tdiMode = inst["Tdi"]; double binMode = inst["Summing"]; int chan = inst["ChannelNumber"]; int cpmm = inst["CpmmNumber"]; double deltaLineTimerCount = inst["DeltaLineTimerCount"]; QString stime = inst["SpacecraftClockStartCount"]; // Convert CPMM number to CCD number static int cpmm2ccd[] = {0, 1, 2, 3, 12, 4, 10, 11, 5, 13, 6, 7, 8, 9}; int ccd = cpmm2ccd[cpmm]; // Compute the line rate, convert to seconds, and multiply by the // downtrack summing double unBinnedRate = (74.0 + (deltaLineTimerCount / 16.0)) / 1000000.0; double lineRate = unBinnedRate * binMode; // Convert the spacecraft clock count to ephemeris time SpiceDouble et; // The -74999 is the code to select the transformation from // high-precision MRO SCLK to ET et = getClockTime(stime, -74999).Et(); // Adjust the start time so that it is the effective time for // the first line in the image file. Note that on 2006-03-29, this // time is now subtracted as opposed to adding it. The computed start // time in the EDR is at the first serial line. et -= unBinnedRate * (((double) tdiMode / 2.0) - 0.5); // Effective observation // time for all the TDI lines used for the // first line before doing binning et += unBinnedRate * (((double) binMode / 2.0) - 0.5); // Effective observation time of the first line // in the image file, which is possibly binned // Compute effective line number within the CCD (in pixels) for the // given TDI mode. // This is the "centered" 0-based line number, where line 0 is the // center of the detector array and line numbers decrease going // towards the serial readout. Line number +64 sees a spot // on the ground before line number 0 or -64. double ccdLine_c = -64.0 + ((double) tdiMode / 2.0); // Setup detector map for transform of image pixels to detector position // CameraDetectorMap *detectorMap = // new LineScanCameraDetectorMap(this,et,lineRate); LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, et, lineRate); detectorMap->SetDetectorSampleSumming(binMode); detectorMap->SetDetectorLineSumming(binMode); if(chan == 0) { detectorMap->SetStartingDetectorSample(1025.0); } // Setup focal plane map for transform of detector position to // focal plane x/y. This will read the appropriate CCD // transformation coefficients from the instrument kernel CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, -74600 - ccd); focalMap->SetDetectorOrigin(1024.5, 0.0); focalMap->SetDetectorOffset(0.0, ccdLine_c); // Setup distortion map. This will read the optical distortion // coefficients from the instrument kernel CameraDistortionMap *distortionMap = new CameraDistortionMap(this); distortionMap->SetDistortion(naifIkCode()); // Setup the ground and sky map to transform undistorted focal // plane x/y to lat/lon or ra/dec respectively. new LineScanCameraGroundMap(this); new LineScanCameraSkyMap(this); LoadCache(); NaifStatus::CheckErrors(); }
/** * Constructor for the LRO NAC Camera Model * * @param lab Pvl Label to create the camera model from * * @internal * @history 2011-05-03 Jeannie Walldren - Added NAIF error check. */ LroNarrowAngleCamera::LroNarrowAngleCamera(Cube &cube) : LineScanCamera(cube) { NaifStatus::CheckErrors(); // Set up the camera info from ik/iak kernels SetFocalLength(); SetPixelPitch(); double constantTimeOffset = 0.0, additionalPreroll = 0.0, additiveLineTimeError = 0.0, multiplicativeLineTimeError = 0.0; QString ikernKey = "INS" + toString(naifIkCode()) + "_CONSTANT_TIME_OFFSET"; constantTimeOffset = getDouble(ikernKey); ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIONAL_PREROLL"; additionalPreroll = getDouble(ikernKey); ikernKey = "INS" + toString(naifIkCode()) + "_ADDITIVE_LINE_ERROR"; additiveLineTimeError = getDouble(ikernKey); ikernKey = "INS" + toString(naifIkCode()) + "_MULTIPLI_LINE_ERROR"; multiplicativeLineTimeError = getDouble(ikernKey); // Get the start time from labels Pvl &lab = *cube.label(); PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse); QString stime = inst["SpacecraftClockPrerollCount"]; SpiceDouble etStart; if(stime != "NULL") { etStart = getClockTime(stime).Et(); } else { etStart = iTime((QString)inst["PrerollTime"]).Et(); } // Get other info from labels double csum = inst["SpatialSumming"]; double lineRate = (double) inst["LineExposureDuration"] / 1000.0; double ss = inst["SampleFirstPixel"]; ss += 1.0; lineRate *= 1.0 + multiplicativeLineTimeError; lineRate += additiveLineTimeError; etStart += additionalPreroll * lineRate; etStart += constantTimeOffset; setTime(etStart); // Setup detector map LineScanCameraDetectorMap *detectorMap = new LineScanCameraDetectorMap(this, etStart, lineRate); detectorMap->SetDetectorSampleSumming(csum); detectorMap->SetStartingDetectorSample(ss); // Setup focal plane map CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode()); // Retrieve boresight location from instrument kernel (IK) (addendum?) ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE"; double sampleBoreSight = getDouble(ikernKey); ikernKey = "INS" + toString(naifIkCode()) + "_BORESIGHT_LINE"; double lineBoreSight = getDouble(ikernKey); focalMap->SetDetectorOrigin(sampleBoreSight, lineBoreSight); focalMap->SetDetectorOffset(0.0, 0.0); // Setup distortion map LroNarrowAngleDistortionMap *distMap = new LroNarrowAngleDistortionMap(this); distMap->SetDistortion(naifIkCode()); // Setup the ground and sky map new LineScanCameraGroundMap(this); new LineScanCameraSkyMap(this); LoadCache(); NaifStatus::CheckErrors(); }