void IsisMain() { UserInterface &ui = Application::GetUserInterface(); // Determine whether input is a raw Mariner 10 image or an Isis 2 cube bool isRaw = false; FileName inputFile = ui.GetFileName("FROM"); Pvl label(inputFile.expanded()); // If the PVL created from the input labels is empty, then input is raw if(label.groups() + label.objects() + label.keywords() == 0) { isRaw = true; } // Import for RAW files if(isRaw) { ProcessImport p; // All mariner images from both cameras share this size p.SetDimensions(832, 700, 1); p.SetFileHeaderBytes(968); p.SaveFileHeader(); p.SetPixelType(UnsignedByte); p.SetByteOrder(Lsb); p.SetDataSuffixBytes(136); p.SetInputFile(ui.GetFileName("FROM")); Cube *oCube = p.SetOutputCube("TO"); p.StartProcess(); unsigned char *header = (unsigned char *) p.FileHeader(); QString labels = EbcdicToAscii(header); UpdateLabels(oCube, labels); p.EndProcess(); } // Import for Isis 2 cubes else { ProcessImportPds p; // All mariner images from both cameras share this size p.SetDimensions(832, 700, 1); p.SetPixelType(UnsignedByte); p.SetByteOrder(Lsb); p.SetDataSuffixBytes(136); p.SetPdsFile(inputFile.expanded(), "", label); Cube *oCube = p.SetOutputCube("TO"); TranslateIsis2Labels(inputFile, oCube); p.StartProcess(); p.EndProcess(); } }
void IsisMain() { Preference::Preferences(true); cout << "Testing ProcessImport Class ... " << endl; Preference::Preferences(true); ProcessImport p; p.SetInputFile("$base/testData/isisTruth.dat"); p.SetBase(0.0); p.SetMultiplier(1.0); p.SetDataHeaderBytes(0); p.SetDataPrefixBytes(0); p.SetDataSuffixBytes(0); p.SetDataTrailerBytes(0); p.SetDimensions(126, 126, 1); p.SetFileHeaderBytes(16384); p.SetOrganization(ProcessImport::BSQ); p.SetPixelType(Real); p.SetByteOrder(Lsb); p.SetOutputCube("TO"); p.StartProcess(); p.EndProcess(); Process p2; CubeAttributeInput att; QString file = Application::GetUserInterface().GetFileName("TO"); Cube *icube = p2.SetInputCube(file, att); Statistics *stat = icube->statistics(); cout << endl << "Average: " << stat->Average() << endl; cout << endl << "Variance: " << stat->Variance() << endl; p2.EndProcess(); QFile::remove(file); cout << endl; //Checks the setting of special pixel ranges cout << "Check the settings of the special pixel ranges" << endl; ProcessImport pNull; pNull.SetNull(0.0, 45.0); try { // Should NOT throw an error pNull.SetNull(0.0, 45.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pNull.SetLRS(35.0, 55.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should NOT throw an error pNull.SetLIS(50.0, 52.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pNull.SetHRS(-10.0, 5.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; ProcessImport pLRS; pLRS.SetLRS(10.0, 145.0); try { // Should throw an error pLRS.SetNull(35.0, 55.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pNull.SetLIS(0.0, 15.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should throw an error pLRS.SetHIS(-10.0, 155.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; try { // Should NOT throw an error pLRS.SetHIS(145.0, 155.0); } catch(IException e) { cout << e.toString() << endl; } cout << endl; cout << "Testing ProcessBil()" << endl; ProcessImport p3; p3.SetInputFile("$base/testData/isisTruth.dat"); p3.SetBase(0.0); p3.SetMultiplier(1.0); p3.SetDataHeaderBytes(0); p3.SetDataPrefixBytes(0); p3.SetDataSuffixBytes(0); p3.SetDataTrailerBytes(0); p3.SetDimensions(126, 126, 1); p3.SetFileHeaderBytes(16384); p3.SetOrganization(ProcessImport::BIL); p3.SetPixelType(Real); p3.SetByteOrder(Lsb); p3.SetOutputCube("TO"); p3.StartProcess(); p3.EndProcess(); cout << endl << "Testing ProcessBip()" << endl; ProcessImport p4; p4.SetInputFile("$base/testData/isisTruth.dat"); p4.SetBase(0.0); p4.SetMultiplier(1.0); p4.SetDataHeaderBytes(0); p4.SetDataPrefixBytes(0); p4.SetDataSuffixBytes(0); p4.SetDataTrailerBytes(0); p4.SetDimensions(126, 126, 1); p4.SetFileHeaderBytes(16384); p4.SetOrganization(ProcessImport::BIP); p4.SetPixelType(Real); p4.SetByteOrder(Lsb); p4.SetOutputCube("TO"); p4.StartProcess(); p4.EndProcess(); }