TIFF: Minor fixes for reading
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 14m17s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 15m43s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m18s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 18m0s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 18m7s
Build Packages / build:rpm (rocky8) (push) Successful in 18m24s
Build Packages / build:rpm (rocky9) (push) Successful in 18m29s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 19m18s
Build Packages / Generate python client (push) Successful in 1m45s
Build Packages / Build documentation (push) Successful in 1m42s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m52s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 10m46s
Build Packages / XDS test (durin plugin) (push) Successful in 9m47s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m36s
Build Packages / XDS test (neggia plugin) (push) Successful in 9m47s
Build Packages / DIALS test (push) Successful in 13m43s
Build Packages / Unit tests (push) Successful in 1h3m1s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 14m17s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 15m43s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m18s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 18m0s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 18m7s
Build Packages / build:rpm (rocky8) (push) Successful in 18m24s
Build Packages / build:rpm (rocky9) (push) Successful in 18m29s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 19m18s
Build Packages / Generate python client (push) Successful in 1m45s
Build Packages / Build documentation (push) Successful in 1m42s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m52s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 10m46s
Build Packages / XDS test (durin plugin) (push) Successful in 9m47s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m36s
Build Packages / XDS test (neggia plugin) (push) Successful in 9m47s
Build Packages / DIALS test (push) Successful in 13m43s
Build Packages / Unit tests (push) Successful in 1h3m1s
This commit is contained in:
@@ -28,7 +28,7 @@ JFJochStateMachine::JFJochStateMachine(const DiffractionExperiment& in_experimen
|
||||
#else
|
||||
data_processing_settings.indexing = true;
|
||||
#endif
|
||||
SupressTIFFErrors();
|
||||
SuppressTIFFErrors();
|
||||
}
|
||||
|
||||
bool JFJochStateMachine::ImportPedestalG0(const JFJochReceiverOutput &receiver_output) {
|
||||
|
||||
+10
-7
@@ -121,23 +121,26 @@ CompressedImage ReadTIFF(const std::string &s, std::vector<uint8_t> &buffer) {
|
||||
TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_string);
|
||||
TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &format);
|
||||
|
||||
if (elem_size % 8 != 0)
|
||||
throw JFJochException(JFJochExceptionCategory::TIFFGeneratorError, "Only byte-aligned TIFF samples are supported");
|
||||
|
||||
if (cols * lines * elem_size <= 0)
|
||||
const size_t elem_size_bytes = elem_size / 8;
|
||||
if (cols == 0 || lines == 0 || elem_size_bytes == 0)
|
||||
throw JFJochException(JFJochExceptionCategory::TIFFGeneratorError,"Size wrong");
|
||||
|
||||
if (cols * elem_size != TIFFScanlineSize(tiff))
|
||||
if (cols * elem_size_bytes != TIFFScanlineSize(tiff))
|
||||
throw JFJochException(JFJochExceptionCategory::TIFFGeneratorError, "TIFFScanlineSize mismatch");
|
||||
|
||||
buffer.resize(cols * lines * elem_size);
|
||||
buffer.resize(static_cast<size_t>(cols) * static_cast<size_t>(lines) * elem_size_bytes);
|
||||
|
||||
for (int i = 0; i < lines; i++) {
|
||||
if (TIFFReadScanline(tiff, buffer.data() + i * cols * elem_size, i, 0) < 0)
|
||||
for (uint32_t i = 0; i < lines; i++) {
|
||||
if (TIFFReadScanline(tiff, buffer.data() + static_cast<size_t>(i) * cols * elem_size_bytes, i, 0) < 0)
|
||||
throw JFJochException(JFJochExceptionCategory::TIFFGeneratorError, "TIFFReadScanline error");
|
||||
}
|
||||
|
||||
TIFFClose(tiff);
|
||||
|
||||
CompressedImageMode mode = CalcImageMode(elem_size / 8, (format == SAMPLEFORMAT_IEEEFP), (format == SAMPLEFORMAT_INT));
|
||||
CompressedImageMode mode = CalcImageMode(elem_size_bytes, (format == SAMPLEFORMAT_IEEEFP), (format == SAMPLEFORMAT_INT));
|
||||
return CompressedImage(buffer, cols, lines, mode);
|
||||
}
|
||||
|
||||
@@ -216,6 +219,6 @@ std::vector<uint16_t> ReadTIFFFromString16(const std::string &s, uint32_t &cols,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SupressTIFFErrors() {
|
||||
void SuppressTIFFErrors() {
|
||||
TIFFSetErrorHandler(nullptr);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef JUNGFRAUJOCH_WRITETIFF_H
|
||||
#define JUNGFRAUJOCH_WRITETIFF_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -16,5 +15,4 @@ CompressedImage ReadTIFF(const std::string &s, std::vector<uint8_t> &buffer);
|
||||
std::vector<uint32_t> ReadTIFFFromString32(const std::string& s, uint32_t &cols, uint32_t &lines);
|
||||
std::vector<uint16_t> ReadTIFFFromString16(const std::string& s, uint32_t &cols, uint32_t &lines);
|
||||
|
||||
void SupressTIFFErrors();
|
||||
#endif //JUNGFRAUJOCH_WRITETIFF_H
|
||||
void SuppressTIFFErrors();
|
||||
|
||||
Reference in New Issue
Block a user