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, Patrick Boschmann $
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
102 class OPENMS_DLLAPI ImzMLFile :
103 public Internal::XMLFile,
104 public ProgressLogger
105 {
106 public:
107
113 ~ImzMLFile() override = default;
115
123 void setOptions(const PeakFileOptions& options);
125
148 void load(const std::string& filename, MSImagingExperiment& exp);
149
170
187 static void buildImagingGeometry(const std::vector<ImzMLSpectrumIndex>& index,
188 const ImzMLMeta& meta,
189 MSImagingGeometry& geom);
190
204 void load(const std::string& filename, Interfaces::IMSDataConsumer& consumer);
205
229 void loadSpectraIndex(const std::string& filename,
230 ImzMLMeta& meta,
231 std::vector<ImzMLSpectrumIndex>& index,
232 MSExperiment& spectra,
233 const std::string& ibd_path = "");
235
245 bool isValid(const std::string& filename, std::ostream& os);
246
273 void store(const std::string& filename, const MSExperiment& exp) const;
274
293 void store(const std::string& filename, const MSImagingExperiment& exp) const;
295
296 private:
297
298 void loadImpl_(const std::string& filename,
300 MSExperiment& meta_exp,
301 ImzMLMeta* out_meta,
302 std::vector<ImzMLSpectrumIndex>* out_index,
303 bool index_only,
304 const std::string& ibd_path_override = "");
305
306 static std::string inferIbdPath_(const std::string& imzml_path);
307
309 };
310
311} // namespace OpenMS
File adapter for imzML 1.1.0 mass spectrometry imaging data.
Definition ImzMLFile.h:105
void loadSpectraIndex(const std::string &filename, ImzMLMeta &meta, std::vector< ImzMLSpectrumIndex > &index, MSExperiment &spectra, const std::string &ibd_path="")
Parse the XML into a per-spectrum .ibd index and the spectrum metadata, without loading peaks.
void setOptions(const PeakFileOptions &options)
Set options for loading/storing.
const PeakFileOptions & getOptions() const
Non-mutable access to the options for loading/storing.
ImzMLFile()
Default constructor.
~ImzMLFile() override=default
Destructor.
PeakFileOptions options_
Definition ImzMLFile.h:308
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()
Mutable access to the options for loading/storing.
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:40
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:36
Pixel grid metadata and (x, y) -> spectrum_index lookup for MSI data.
Definition MSImagingGeometry.h:33
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:38
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19