| 62 | } |
| 63 | |
| 64 | IMFormat IMTypes::determineIMFormat(const MSExperiment& exp) |
| 65 | { |
| 66 | std::set<IMFormat> occs; |
| 67 | for (const auto& spec : exp.getSpectra()) |
| 68 | { |
| 69 | occs.insert(determineIMFormat(spec)); |
| 70 | } |
| 71 | occs.erase(IMFormat::NONE); // ignore NONE (i.e. normal spectra) |
| 72 | |
| 73 | if (occs.empty()) |
| 74 | { |
| 75 | return IMFormat::NONE; |
| 76 | } |
| 77 | if (occs.size() == 1 && (occs.find(IMFormat::CONCATENATED) != occs.end() || occs.find(IMFormat::MULTIPLE_SPECTRA) != occs.end())) |
| 78 | { |
| 79 | return *occs.begin(); |
| 80 | } |
| 81 | if (occs.size() == 2 && occs.find(IMFormat::CONCATENATED) != occs.end() && occs.find(IMFormat::MULTIPLE_SPECTRA) != occs.end()) |
| 82 | { |
| 83 | return IMFormat::MIXED; |
| 84 | } |
| 85 | |
| 86 | throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "subfunction returned invalid value(s)", "Number of different values: " + String(occs.size())); |
| 87 | } |
| 88 | |
| 89 | IMFormat IMTypes::determineIMFormat(const MSSpectrum& spec) |
| 90 | { |
nothing calls this directly
no test coverage detected