* Opens an input cube specified by the programmer and verifies requirements * are met. * * @param fname Programmer specified work file. For example, "myfile.cub". * * @param att The cube attributes to use when opening the input cube. * * @param requirements Requirements to check that the input cube meets. * See CheckRequirements(). * * @return Cub
| 66 | * @throws Isis::iException::Message |
| 67 | */ |
| 68 | Isis::Cube *Process::SetInputCube(const QString &fname, |
| 69 | const Isis::CubeAttributeInput &att, |
| 70 | int requirements) { |
| 71 | Isis::Cube *cube = new Isis::Cube; |
| 72 | if(att.bands().size() != 0) { |
| 73 | vector<QString> lame = att.bands(); |
| 74 | cube->setVirtualBands(lame); |
| 75 | } |
| 76 | |
| 77 | try { |
| 78 | if(requirements & Isis::ReadWrite) { |
| 79 | cube->open(fname, "rw"); |
| 80 | } |
| 81 | else { |
| 82 | // Make sure attributes don't get processed twice |
| 83 | cube->open(FileName(fname).expanded()); |
| 84 | } |
| 85 | } |
| 86 | catch(IException &e) { |
| 87 | delete cube; |
| 88 | throw; |
| 89 | } |
| 90 | |
| 91 | CheckRequirements(cube, requirements); |
| 92 | |
| 93 | // Everything is good so save the cube on the stack |
| 94 | AddInputCube(cube); |
| 95 | return cube; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | /** |