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
83 class OPENMS_DLLAPI ImzMLFile :
84 public Internal::XMLFile,
85 public ProgressLogger
86 {
87 public:
88
94 ~ImzMLFile() override = default;
96
104 void setOptions(const PeakFileOptions& options);
106
129 void load(const std::string& filename, MSImagingExperiment& exp);
130
151
168 static void buildImagingGeometry(const std::vector<ImzMLSpectrumIndex>& index,
169 const ImzMLMeta& meta,
170 MSImagingGeometry& geom);
171
185 void load(const std::string& filename, Interfaces::IMSDataConsumer& consumer);
186
202 void loadSpectraIndex(const std::string& filename,
203 ImzMLMeta& meta,
204 std::vector<ImzMLSpectrumIndex>& index,
205 const std::string& ibd_path = "");
207
217 bool isValid(const std::string& filename, std::ostream& os);
218
245 void store(const std::string& filename, const MSExperiment& exp) const;
246
265 void store(const std::string& filename, const MSImagingExperiment& exp) const;
267
268 private:
269
270 void loadImpl_(const std::string& filename,
272 MSExperiment& meta_exp,
273 ImzMLMeta* out_meta,
274 std::vector<ImzMLSpectrumIndex>* out_index,
275 bool index_only,
276 const std::string& ibd_path_override = "");
277
278 static std::string inferIbdPath_(const std::string& imzml_path);
279
281 };
282
283} // namespace OpenMS
File adapter for imzML 1.1.0 mass spectrometry imaging data.
Definition ImzMLFile.h:86
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)
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:280
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:30
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:36
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19