Repository navigation
Remove obsolete String/StringConversions/StringUtilsSimple shim headers - #9468
Merged
Merged
Conversation
Following the String -> std::string migration (PR #9450), the headers String.h, StringConversions.h and StringUtilsSimple.h (and their .cpp counterparts) became empty backward-compat shims that just forwarded to StringUtils.h. Remove them and point all includers directly at StringUtils.h. - Delete the 6 shim files (.h/.cpp for String, StringConversions, StringUtilsSimple); String.cpp was an empty stub. - Rewrite all #include <OpenMS/DATASTRUCTURES/String.h> (and the two remaining StringUtilsSimple.h includes) to StringUtils.h across the source tree. - Drop the deduped duplicate includes this created (FASTAContainer.h, SwathWindowLoader.cpp, PeptideIdentification_test.cpp). - Remove the stale entries from the DATASTRUCTURES sources.cmake files. The StringConversions namespace lives on inside StringUtils.h and is unaffected. Verified: cmake reconfigure + full libOpenMS build succeed. Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-10 06:00:40.326227500 +0000
+++ AUTHORS.new 2026-06-10 06:00:45.586630798 +0000
@@ -22,8 +22,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
timosachsenberg
added a commit
that referenced
this pull request
Jun 10, 2026
#9471) #9468 removed the obsolete String/StringConversions/StringUtilsSimple shim headers, but three code-example tutorials still include <OpenMS/DATASTRUCTURES/String.h>. That breaks the class-topp CI build (which compiles doc/code_examples) on develop and on every branch based on it, e.g.: doc/code_examples/Tutorial_IdentificationClasses.cpp:14: fatal error: OpenMS/DATASTRUCTURES/String.h: No such file or directory None of the three files use the String type, so the include is simply removed. All three compile and link again locally. Co-authored-by: Claude Opus 4.8 <[email protected]>
timosachsenberg
added a commit
to Aditya-Sarna/OpenMS
that referenced
this pull request
Jun 11, 2026
…agingGeometry reuse Follow-up to the rebase of the imzML PR onto develop, making it compile and correct against current develop and integrating it with the IMAGING module. Migration (post OpenMS#9450 / OpenMS#9468, which removed OpenMS::String): - Port all imzML sources, the FileHandler imzML helpers, the pyOpenMS bindings and the tests to std::string + StringUtils/StringConversions. Correctness fixes: - ImzMLHandler: only snapshot per-spectrum IMS state for spectra MzMLHandler actually delivers (gate on !skip_spectrum_) — fixes silent coordinate/.ibd offset corruption when PeakFileOptions skip any spectrum. - ImzMLFile: add an advisory .ibd UUID integrity check (16-byte header vs IMS:1000080); accept dashed and brace-wrapped UUIDs. - Reject negative IMS:1000102/1000103 offset/count values (std::stoull wraps). - Thread the .ibd path override through loadSpectraIndex so the override file (not an inferred sibling) is the one validated and read. - Regenerate the malformed continuous test fixture: prepend the 16-byte UUID header, shift external offsets by 16, fix the declared md5 and dataset hash. OnDiscImzMLExperiment: reuse the shared IMAGING module instead of a bespoke coordinate map. - Build an MSImagingGeometry eagerly in open() (in-memory pass; only peak decode stays lazy) and route getSpectrumAtCoord through it; delete PixelKey/coord_map_. - Add getGeometry() (+ pyOpenMS binding) returning the 0-based 2D geometry. Lenient loading: a UUID mismatch, an out-of-grid pixel, or a <1 coordinate are now warnings (the dataset still loads); duplicate coordinates remain a hard error. Cleanup: remove dev scaffolding (demo_imzML_*.py, run_imzML_metadata_demo.sh); relocate test_data_paths.py into tests/unittests with depth-independent resolution. Co-Authored-By: Claude Opus 4.8 <[email protected]>
5 tasks done
timosachsenberg
added a commit
that referenced
this pull request
Jun 15, 2026
* [FEATURE,TEST,API] Add imzML read and write support Add ImzMLFile with full load, streaming, on-disc random access, RAM pixel lookup, and export via store() (float32 external arrays, UUID-linked .ibd); register FileTypes::IMZML at end of enum with FileHandler integration; expose pyOpenMS bindings, tests, tutorial, and demo. Harden IBD I/O, IMS CV parsing, imaging metadata, schema validation, and on-disc thread safety. Address review feedback across multiple rounds: coordinate/z lookups, test guards, batched consumer docs, SAX file parsing, full ImzMLMeta on load, WRITEABLE file type, big-endian fix, UUID .ibd header, collision-safe pixel map, streaming MD5, RAII .ibd writes, continuous-mode validation, hybrid array decode, required pixel coords, compressed imzML detection, mzML XML ordering, safe move semantics, and balanced Xerces init/terminate. Co-authored-by: Cursor <[email protected]> * [FEATURE,TEST] Extend ImzML writer with options, metadata, precision Apply PeakFileOptions on store (filtering, sort, metadata-only), round-trip imaging metadata and spectrum RT/MS level, and support float32/float64 .ibd export via getMz32Bit/getIntensity32Bit with MD5 and SHA-1 checksums. Co-authored-by: Cursor <[email protected]> * [TEST,DOC] Add imzML dataset metadata tests and demo scripts Verify ImzMLMeta is mirrored on MSExperiment for continuous and processed reference fixtures. Add demo_imzML_metadata.py, a shell runner, and extend Tutorial_ImzMLFile to print dataset metadata after load. Co-authored-by: Cursor <[email protected]> * [DOC] Correct imzML export precision documentation Clarify that ImzMLFile::store() supports float32/float64 via PeakFileOptions, not float32-only. Update scan_direction CV comment. Co-authored-by: Cursor <[email protected]> * [FIX,TEST] Fix imzML max_dim export and align modes tests Correct max_dim_x/y scaling on export (micrometer units). Align Python all_modes tests with ImzMLFile_all_modes_test.cpp and assert max_dim round-trip in C++ and Python metadata store tests. Co-authored-by: Cursor <[email protected]> * [DOC] Fix max_dim unit label in imzML metadata demo Use micrometers (um) for max_dim_x/y output to match imzML convention and ImzMLWriter export units. Co-authored-by: Cursor <[email protected]> * [FIX] Remove incorrect noexcept from OnDiscImzMLExperiment moves Moved-from state allocates a new Impl via make_unique, which may throw; do not mark move ctor/assignment as noexcept. Co-authored-by: Cursor <[email protected]> * [FIX,TEST] Hash imzML and companion ibd in FileHandler When rewrite_source_file and compute_hash are enabled, imzML datasets now get a SHA1 over both the .imzML XML and its .ibd binary file, matching the two-file nature of the format. Co-authored-by: Cursor <[email protected]> * [FIX] Throw on null .ibd handle in ImzML binary writer writeFloat32Array and writeFloat64Array no longer treat a null FILE* as success; invalid handles fail fast instead of producing broken .imzML/.ibd file pairs. Co-authored-by: Cursor <[email protected]> * [FIX] Reject partially parsed UUID hex bytes in ImzMLWriter uuidStringToBytes_ now requires strtoul to consume the full two-character hex byte, rejecting inputs like "1g" instead of silently truncating. Co-authored-by: Cursor <[email protected]> * [FIX] Reject mixed empty/non-empty spectra for continuous imzML spectraShareMz_ now returns false when any spectrum is empty, preventing continuous export from assigning a shared m/z count to empty pixels. Co-authored-by: Cursor <[email protected]> * [FIX] Remove broken GlobalLogSilencer from ImzMLFile load The guard removed global WARN/ERROR sinks but only restored std::cerr, which could drop user-configured log destinations. It also did not suppress handler warnings because OPENMS_LOG_* uses thread-local streams. Co-authored-by: Cursor <[email protected]> * [FIX] Release Xerces error messages in ImzMLFile parse failures Use Internal::StringManager::convert() for XML/SAX exception text so transcoded Xerces buffers are released on parse error paths. Co-authored-by: Cursor <[email protected]> * [FIX] Check open state in OnDiscImzMLExperiment::getSpectrumAtCoord Throw FileNotFound when the .ibd is not open before coordinate lookup, matching getSpectrum() instead of misleading ElementNotFound errors. Co-authored-by: Cursor <[email protected]> * [FIX] Release GIL during ImzMLFile index load and validation loadSpectraIndex and isValid now use gil_scoped_release for blocking C++ I/O, consistent with the other ImzMLFile pyOpenMS bindings. Co-authored-by: Cursor <[email protected]> * [FIX] Use _fseeki64 for imzML .ibd seeks on Windows MSVC does not provide POSIX fseeko; use _fseeki64 on WIN32 and keep fseeko elsewhere. Also include cstdio explicitly in the .cpp translation unit. Co-authored-by: Cursor <[email protected]> * Fix MSVC C4100 in ImzMLHandlerHelper decodeLittleEndian_ Mark data and count as [[maybe_unused]] because they are only referenced inside the OPENMS_IS_BIG_ENDIAN branch; on Windows (little-endian) MSVC treats the unused parameters as errors. Co-authored-by: Cursor <[email protected]> * imzML: rebase fixups — std::string migration, correctness fixes, MSImagingGeometry reuse Follow-up to the rebase of the imzML PR onto develop, making it compile and correct against current develop and integrating it with the IMAGING module. Migration (post #9450 / #9468, which removed OpenMS::String): - Port all imzML sources, the FileHandler imzML helpers, the pyOpenMS bindings and the tests to std::string + StringUtils/StringConversions. Correctness fixes: - ImzMLHandler: only snapshot per-spectrum IMS state for spectra MzMLHandler actually delivers (gate on !skip_spectrum_) — fixes silent coordinate/.ibd offset corruption when PeakFileOptions skip any spectrum. - ImzMLFile: add an advisory .ibd UUID integrity check (16-byte header vs IMS:1000080); accept dashed and brace-wrapped UUIDs. - Reject negative IMS:1000102/1000103 offset/count values (std::stoull wraps). - Thread the .ibd path override through loadSpectraIndex so the override file (not an inferred sibling) is the one validated and read. - Regenerate the malformed continuous test fixture: prepend the 16-byte UUID header, shift external offsets by 16, fix the declared md5 and dataset hash. OnDiscImzMLExperiment: reuse the shared IMAGING module instead of a bespoke coordinate map. - Build an MSImagingGeometry eagerly in open() (in-memory pass; only peak decode stays lazy) and route getSpectrumAtCoord through it; delete PixelKey/coord_map_. - Add getGeometry() (+ pyOpenMS binding) returning the 0-based 2D geometry. Lenient loading: a UUID mismatch, an out-of-grid pixel, or a <1 coordinate are now warnings (the dataset still loads); duplicate coordinates remain a hard error. Cleanup: remove dev scaffolding (demo_imzML_*.py, run_imzML_metadata_demo.sh); relocate test_data_paths.py into tests/unittests with depth-independent resolution. Co-Authored-By: Claude Opus 4.8 <[email protected]> * Tutorial_ImzMLFile: load bundled data via OPENMS_DOC_PATH Follow the existing code-examples convention instead of a bespoke mechanism. Other file-loading tutorials (Tutorial_FileIO_mzML, Tutorial_GaussFilter, ...) load a committed input from doc/code_examples/data/ via the global OPENMS_DOC_PATH macro and need no per-example build wiring. - Add the example dataset doc/code_examples/data/Tutorial_ImzMLFile.{imzML,ibd} (force-added; the dir is .gitignored like the other tutorial fixtures). - Use OPENMS_DOC_PATH + "/code_examples/data/Tutorial_ImzMLFile.imzML" as the default input (argv[1] still overrides); drop the OPENMS_IMZML_TUTORIAL_FILE macro and the now-dead usage/empty-path branch. - Remove the if(i STREQUAL "Tutorial_ImzMLFile") target_compile_definitions block from doc/code_examples/CMakeLists.txt -- it was the only per-example special-case in the examples loop. The no-argument ctest passes against the bundled dataset (all 7 imzML modes run). Co-Authored-By: Claude Opus 4.8 <[email protected]> * imzML: load only into MSImagingExperiment (treat imzML as an imaging format) imzML is a mass spectrometry imaging format, so its canonical in-memory target is MSImagingExperiment, matching BrukerTimsImagingFile (which is likewise imaging-only and not reachable through the generic FileHandler). Stop treating imzML as a flat mzML-like MSExperiment. - Remove ImzMLFile::load(const std::string&, MSExperiment&); load(MSImagingExperiment&) now decodes the spectra and builds the geometry directly. Callers that only need the flat spectra use MSImagingExperiment::getMSExperiment(). load(consumer), loadSpectraIndex() and store(MSExperiment) are unchanged. - FileHandler::loadExperiment() no longer loads imzML: it throws Exception::InvalidFileType with guidance to use ImzMLFile. Drop the imzML dataset-hash branch and its now-unused helpers (computeImzMLDatasetHash_, inferImzMLIbdPath_); FileHandler::getType / getTypeByContent still detect imzML. - pyOpenMS: drop the load(MSExperiment&) binding (keep load(MSImagingExperiment&)). - Update tests, the tutorial, and the Python tests: flat loads go through MSImagingExperiment::getMSExperiment(); FileHandler-loads-imzML cases now assert the InvalidFileType throw; the tutorial drops its FileHandler load mode. Co-Authored-By: Claude Opus 4.8 <[email protected]> * imzML: geometry-driven store(MSImagingExperiment); drop imzML store from FileHandler Make storing symmetric with loading and consistent with how the imaging model is populated. BrukerTimsImagingFile builds MSImagingGeometry directly (no imzml:* MetaValues); the imzML writer, however, reads coordinates from per-spectrum imzml:x/y MetaValues, so a geometry-only MSImagingExperiment (e.g. a Bruker-loaded one) could not be stored as imzML. - Add ImzMLFile::store(const std::string&, const MSImagingExperiment&): the geometry is the source of truth for pixel coordinates, grid dimensions and pixel size. They are derived from exp.getGeometry() onto a copy of the wrapped experiment, so this works for any MSImagingExperiment regardless of whether the spectra carry imzml:x/y MetaValues. The low-level store(MSExperiment&) (MetaValue-driven) stays for building imzML from raw spectra. - FileHandler::storeExperiment() no longer stores imzML: it throws Exception::InvalidFileType (symmetric with loadExperiment). imzML I/O now goes exclusively through ImzMLFile, matching BrukerTimsImagingFile (which is also absent from the generic FileHandler). Removed the now-unused ImzMLFile.h include from FileHandler.cpp. - pyOpenMS: bind store(MSImagingExperiment&). - Test: store a geometry-only MSImagingExperiment with NO imzml:x/y MetaValues and verify the coordinates round-trip from the geometry. Co-Authored-By: Claude Opus 4.8 <[email protected]> * imzML: build the imaging geometry directly from the parsed index (one shared builder) Make the geometry the source of truth on the read side too, like BrukerTimsImagingFile. Previously ImzMLFile::load(MSImagingExperiment&) reconstructed the geometry by reading imzml:x/y MetaValues back off the spectra, while OnDiscImzMLExperiment built it directly from the parsed index — two implementations, and an unnecessary MetaValue dependency. - Add ImzMLFile::buildImagingGeometry(const std::vector<ImzMLSpectrumIndex>&, const ImzMLMeta&, MSImagingGeometry&): derives the pixel grid straight from the per-spectrum coordinates captured during parsing (1-based -> 0-based, z==1 plane, dims/pixel-size from meta; out-of-grid/<1 coords warned and skipped, duplicates throw). No MetaValue reads. - ImzMLFile::load(MSImagingExperiment&) now captures the parsed index/meta and builds the geometry with that overload instead of buildImagingGeometry(MSExperiment&). - OnDiscImzMLExperiment::buildGeometry_ delegates to the shared builder (deletes its duplicated logic + now-unused includes), so the in-memory and on-disc paths cannot diverge. - Keep buildImagingGeometry(MSExperiment&) as a public utility for experiments that carry imzml:x/y MetaValues; disambiguate its pyOpenMS binding (now overloaded). - Test: build a geometry from a hand-built index with no MSExperiment and no imzml:* MetaValues. imzml:x/y MetaValues are still attached to spectra as per-spectrum provenance, but the geometry no longer depends on them — it is built directly from the parsed coordinates. Co-Authored-By: Claude Opus 4.8 <[email protected]> * imzML: document loadSpectraIndex ibd_path parameter (fix Doxygen_Warning_test) The ibd_path parameter added to ImzMLFile::loadSpectraIndex was missing a @PARAM entry, which Doxygen flags and Doxygen_Warning_test treats as a failure. Co-Authored-By: Claude Opus 4.8 <[email protected]> * [DOC] imzML: correct CHANGELOG entry for imaging-first API The imzML changelog line still described the pre-rework API. Update it to match the merged code: loads into MSImagingExperiment (imaging-only, like BrukerTimsImagingFile) with the geometry built from the parsed spectrum index; geometry-driven store(MSImagingExperiment) plus low-level store(MSExperiment); FileHandler detects imzML but rejects flat load/store. Co-authored-by: Cursor <[email protected]> * [DOC] imzML: drop stale load(MSExperiment&) from docstrings The ImzMLFile class-level "Loading modes" comment and the pyOpenMS ImzMLFile docstring still described a load-into-MSExperiment mode that was removed when imzML became imaging-only. Point both at load(MSImagingExperiment&) (with getMSExperiment() for the flat spectra), matching the current API. Co-authored-by: Cursor <[email protected]> * [FIX] ImzMLFile: don't call Xerces Terminate() from noexcept guard dtor The XercesPlatformGuard destructor called XMLPlatformUtils::Terminate(), which is not noexcept and may throw. Since destructors are implicitly noexcept, a throw during cleanup invoked std::terminate(), crashing the process. On Windows/MSVC this surfaced as a __fastfail with exit code 0xC0000409 (3221226505) during the pyOpenMS wheel tests, killing the run at the first in-memory imzML parse (test_imaging_experiment_ram_lookup); macOS and Linux wheels were unaffected because Terminate() does not throw there. It also tore down the process-global Xerces state shared with every other OpenMS XML reader. OpenMS initializes Xerces once process-wide via the guard in CONCEPT/Init.cpp (ticket #352), and no other parser pairs Initialize() with a per-operation Terminate(). Drop the per-load Terminate(); keep the idempotent, reference-counted Initialize() to match Internal::XMLFile. The existing test_imaging_experiment_ram_lookup covers the regression. Co-authored-by: Cursor <[email protected]> * [FIX] ImzMLHandler: suppress OpenMP log-race heap corruption on Windows imzML's companion .ibd files mean the inline <binary> elements are empty placeholders, yet the spectrum still declares defaultArrayLength = N (the external element count). MzMLHandler::populateSpectraWithData_() runs inside a `#pragma omp parallel for`; for every spectrum it compared the 0 decoded values against the declared N and emitted "array has size 0 but should have size N (defaultArrayLength)" via OPENMS_LOG_WARN. LogStreamBuf is not thread-safe (shared streambuf, static line buffer, incomplete_line_ string, message cache), so those concurrent writes from multiple OpenMP threads corrupt the heap — observed as a non-deterministic 0xC0000374 abort in both the Windows C++ class test (ImzMLFile_test) and the Windows pyOpenMS wheel tests. Fix: at binaryDataArray end, zero bin_data_.back().size for external arrays so decodeBase64Arrays sees a length-0 array (no mismatch, no warning). At spectrum end, zero default_array_length_ when either array is external — this is the value MzMLHandler snapshots into the batch before the parallel populate pass. ImzMLInterceptConsumer fills the real peaks from the .ibd afterwards using the external offsets/counts, which are independent of these fields. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Timo Sachsenberg <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
1 task done
timosachsenberg
added a commit
that referenced
this pull request
Jul 10, 2026
…9450) (#9724) PR #9450 removed the OpenMS::String class (and StringView) in favor of std::string / std::string_view but never added a CHANGELOG entry. Record it as a BREAKING change in the 3.6.0 General section next to the related Qt string-interop removal (#8940), noting the StringUtils free-function migration path and the follow-up shim-header removal (#9468). Co-authored-by: Claude Fable 5 <[email protected]>
3 of 5 tasks
timosachsenberg
added a commit
that referenced
this pull request
Sep 28, 2026
… teach it (#10298) OpenMS 3.6 replaced OpenMS::String with std::string (#9450, #9468), but there was no migration guide, and several documents still showed the removed API. New page manual/develop/string-migration.md: the replacement for each member of the 3.5 String (checked against the 3.5 String.h and the current StringUtils.h), and the changes the compiler does not catch: - the DataValue/ParamValue conversion to std::string is strict and throws, where String(DataValue) was lenient (use StringUtils::toStr); - `s += 5` without StringUtils.h appends the character 5, and std::to_string writes six decimals; - StringUtils::prefix/suffix(s, c) return the whole string where String::prefix/suffix(c) threw ElementNotFound. Stale references fixed: developer_cpp_guide, coding conventions and TargetedQuantitation Doxygen pages, AGENTS.md and the Copilot instructions (the text of the unmerged 976e0dc), plus the developer FAQ (temporary directories via SystemSettings/TempDir instead of Qt), the new-tool page (ListUtils::create), and the pyOpenMS wrapping guides. Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7 Co-authored-by: Claude <[email protected]>
timosachsenberg
added a commit
that referenced
this pull request
Oct 15, 2026
develop removed OpenMS::String from these classes (#9450, #9468): stringListToIsotopeCorrectionMatrixSplit_() now takes std::string lists and uses StringUtils. It also accepts the single-parameter layout of OpenMS 3.6.0 (one 14-column row for every channel in correction_matrix), so INI files written by 3.6.0 keep working. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012GBvJZN8neGpv9RoUshwFL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up cleanup to the
String→std::stringmigration (#9450). After that migration, three header/source pairs became empty backward-compat shims that merely forwarded toStringUtils.h. This PR removes them and points all includers directly atStringUtils.h.Removed (6 files, all shims)
DATASTRUCTURES/String.h/String.cpp—String.honly forwarded toStringUtils.h(plus a doc-comment-only namespace);String.cppwas an empty stub.DATASTRUCTURES/StringConversions.h/StringConversions.cppDATASTRUCTURES/StringUtilsSimple.h/StringUtilsSimple.cppChanges
#include <OpenMS/DATASTRUCTURES/String.h>(and the two remainingStringUtilsSimple.hincludes) toStringUtils.hacross the source tree (~290 files).FASTAContainer.h,SwathWindowLoader.cpp,PeptideIdentification_test.cpp).DATASTRUCTURES/sources.cmakefiles.Note
The
StringConversionsnamespace still lives insideStringUtils.hand is unaffected — only the forwarding file was removed.Verification
cmakereconfigure: ✅ exit 0libOpenMS.sobuild: ✅ exit 0 (compiles all rewritten TUs, including the widely-includedFASTAContainer.h/PeptideIndexing.hheaders)🤖 Generated with Claude Code