OpenMS
Loading...
Searching...
No Matches
ImzMLFile.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Aditya Sarna $
7// --------------------------------------------------------------------------
8
9#pragma once
10
18#include <OpenMS/OpenMSConfig.h>
19
20#include <iosfwd>
21#include <string>
22#include <vector>
23
24namespace OpenMS
25{
26
27 class MSImagingExperiment;
28 class MSImagingGeometry;
29
68 class OPENMS_DLLAPI ImzMLFile :
69 public Internal::XMLFile,
70 public ProgressLogger
71 {
72 public:
73
77 ~ImzMLFile() override = default;
79
84 void setOptions(const PeakFileOptions& options);
86
107 void load(const std::string& filename, MSImagingExperiment& exp);
108
123
140 static void buildImagingGeometry(const std::vector<ImzMLSpectrumIndex>& index,
141 const ImzMLMeta& meta,
142 MSImagingGeometry& geom);
143
157 void load(const std::string& filename, Interfaces::IMSDataConsumer& consumer);
158
174 void loadSpectraIndex(const std::string& filename,
175 ImzMLMeta& meta,
176 std::vector<ImzMLSpectrumIndex>& index,
177 const std::string& ibd_path = "");
179
189 bool isValid(const std::string& filename, std::ostream& os);
190
214 void store(const std::string& filename, const MSExperiment& exp) const;
215
234 void store(const std::string& filename, const MSImagingExperiment& exp) const;
236
237 private:
238
239 void loadImpl_(const std::string& filename,
241 MSExperiment& meta_exp,
242 ImzMLMeta* out_meta,
243 std::vector<ImzMLSpectrumIndex>* out_index,
244 bool index_only,
245 const std::string& ibd_path_override = "");
246
247 static std::string inferIbdPath_(const std::string& imzml_path);
248
250 };
251
252} // namespace OpenMS
File adapter for imzML 1.1.0 mass spectrometry imaging data.
Definition ImzMLFile.h:71
void loadSpectraIndex(const std::string &filename, ImzMLMeta &meta, std::vector< ImzMLSpectrumIndex > &index, const std::string &ibd_path="")
Parse XML and build a per-spectrum .ibd index without loading peaks.
void setOptions(const PeakFileOptions &options)
const PeakFileOptions & getOptions() const
~ImzMLFile() override=default
PeakFileOptions options_
Definition ImzMLFile.h:249
static void buildImagingGeometry(const std::vector< ImzMLSpectrumIndex > &index, const ImzMLMeta &meta, MSImagingGeometry &geom)
Build MSImagingGeometry directly from a parsed imzML spectrum index.
void loadImpl_(const std::string &filename, Interfaces::IMSDataConsumer *consumer, MSExperiment &meta_exp, ImzMLMeta *out_meta, std::vector< ImzMLSpectrumIndex > *out_index, bool index_only, const std::string &ibd_path_override="")
void load(const std::string &filename, MSImagingExperiment &exp)
Load an imzML file into an MSImagingExperiment for in-memory random access.
bool isValid(const std::string &filename, std::ostream &os)
Validate an imzML file against the mzML 1.1.0 XML schema.
void store(const std::string &filename, const MSImagingExperiment &exp) const
Store an MSImagingExperiment as imzML, taking pixel coordinates and grid dimensions from its MSImagin...
PeakFileOptions & getOptions()
static std::string inferIbdPath_(const std::string &imzml_path)
void load(const std::string &filename, Interfaces::IMSDataConsumer &consumer)
Stream-load an imzML file into a consumer.
void store(const std::string &filename, const MSExperiment &exp) const
Store an experiment as imzML (XML + companion .ibd).
static void buildImagingGeometry(const MSExperiment &exp, MSImagingGeometry &geom)
Build MSImagingGeometry from a loaded imzML MSExperiment.
The interface of a consumer of spectra and chromatograms.
Definition IMSDataConsumer.h:46
Base class for loading and storing XML files via Xerces, with optional schema validation and transpar...
Definition XMLFile.h:38
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
In-memory model for a 2D imaging mass spectrometry dataset.
Definition MSImagingExperiment.h:30
Pixel grid metadata and (x, y) -> spectrum_index lookup for MSI data.
Definition MSImagingGeometry.h:31
Options for loading files containing peak data.
Definition PeakFileOptions.h:22
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:27
Dataset-level metadata for imzML mass spectrometry imaging files.
Definition ImzMLHandlerHelper.h:36
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19