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
76 class OPENMS_DLLAPI ImzMLFile :
77 public Internal::XMLFile,
78 public ProgressLogger
79 {
80 public:
81
87 ~ImzMLFile() override = default;
89
97 void setOptions(const PeakFileOptions& options);
99
122 void load(const std::string& filename, MSImagingExperiment& exp);
123
143
160 static void buildImagingGeometry(const std::vector<ImzMLSpectrumIndex>& index,
161 const ImzMLMeta& meta,
162 MSImagingGeometry& geom);
163
177 void load(const std::string& filename, Interfaces::IMSDataConsumer& consumer);
178
194 void loadSpectraIndex(const std::string& filename,
195 ImzMLMeta& meta,
196 std::vector<ImzMLSpectrumIndex>& index,
197 const std::string& ibd_path = "");
199
209 bool isValid(const std::string& filename, std::ostream& os);
210
234 void store(const std::string& filename, const MSExperiment& exp) const;
235
254 void store(const std::string& filename, const MSImagingExperiment& exp) const;
256
257 private:
258
259 void loadImpl_(const std::string& filename,
261 MSExperiment& meta_exp,
262 ImzMLMeta* out_meta,
263 std::vector<ImzMLSpectrumIndex>* out_index,
264 bool index_only,
265 const std::string& ibd_path_override = "");
266
267 static std::string inferIbdPath_(const std::string& imzml_path);
268
270 };
271
272} // namespace OpenMS
File adapter for imzML 1.1.0 mass spectrometry imaging data.
Definition ImzMLFile.h:79
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:269
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