From d2971bc83bd01452b46a07be4e13ab47d4214966 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 8 Apr 2023 23:29:59 +0200 Subject: [PATCH] Remove libtiff dependency + update README.md --- README.md | 25 ++++++++-------------- common/CMakeLists.txt | 1 - common/WriteTIFF.cpp | 48 ------------------------------------------- common/WriteTIFF.h | 13 ------------ tests/CMakeLists.txt | 2 +- tests/TIFFTest.cpp | 30 --------------------------- 6 files changed, 9 insertions(+), 110 deletions(-) delete mode 100644 common/WriteTIFF.cpp delete mode 100644 common/WriteTIFF.h delete mode 100644 tests/TIFFTest.cpp diff --git a/README.md b/README.md index bbe4af4a..76341568 100644 --- a/README.md +++ b/README.md @@ -26,15 +26,15 @@ Instructions see [here](receiver/README.md) ## Software ### Dependencies -1. C++17 compiler and C++17 standard library (NOT provided by default RHEL 7 installation, need to install Developer Tools, tested with `devtools-11`) +1. C++20 compiler and C++20 standard library (NOT provided by default RHEL 7 installation, need to install Developer Tools, tested with `devtools-11`) 2. CMake version 3.21 or newer + GNU make tool 3. HDF5 library version 1.10 or newer 4. ZeroMQ library 5. Google Remote Procedure Call (gRPC) - see notes below 6. CUDA compiler version 11 or newer (spot finding, indexing, and radial integration) -7. TIFF library with C++ bindings -8. Mellanox OFED - Infinibands Verbs (optional) -9. NUMA library (optional) +7. Mellanox OFED - Infinibands Verbs (optional) +8. NUMA library (optional) +9. Node.js (optional) - to make frontend Additional dependencies: SLS Detector Package, tinycbor (Intel) and Zstandard (Facebook) are provided as GIT submodules. @@ -65,7 +65,7 @@ To compile gRPC: ``` git clone https://github.com/grpc/grpc cd grpc -git checkout v1.41.1 +git checkout v1.53.0 git submodule update --init mkdir build cd build @@ -84,7 +84,7 @@ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/grpc/lib/pkgconfig:/opt/grpc/lib64/ Use the following commands (use `cmake` instead of `cmake3` in non-RHEL systems): ``` -git submodule update --init +git submodule update --init --recursive mkdir build cd build cmake3 .. @@ -103,22 +103,13 @@ Automated test routine is then accessible as `tests/CatchTest`. There are also b In addition, tests are executed to verify that datasets written by Jungfraujoch are readable with XDS Durin plugin and CrystFEL. Input files for these programs are placed in `xds_durin` and `crystfel` folders. See `.gitlab-ci.yml` for details. -## Building web user interface -### Dependencies -For web user interface: -1. Node.js -2. Web server, e.g. Apache httpd -3. Web grpc +## Web user interface ### Building To build web interface: ``` cd frontend_ui +npm install npm build ``` -To install on RHEL 7 and Apache: -``` -cd build -sudo cp -r * /var/www/html/ -``` diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 7055a731..61368ddd 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -44,7 +44,6 @@ ADD_LIBRARY( CommonFunctions STATIC TestImagePusher.cpp TestImagePusher.h SpotToSave.h NetworkAddressConvert.h NetworkAddressConvert.cpp - WriteTIFF.cpp WriteTIFF.h grpcToJson.h jsonToGrpc.h to_fixed.h GPUImageAnalysis.h GPUImageAnalysis.cu DiffractionExperiment.h DiffractionGeometry.cpp) diff --git a/common/WriteTIFF.cpp b/common/WriteTIFF.cpp deleted file mode 100644 index 41c3d1de..00000000 --- a/common/WriteTIFF.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (2019-2022) Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "WriteTIFF.h" -#include "JFJochException.h" - -#include -#include -#include - -void WriteTIFF(TIFF *tiff, void *buff, size_t cols, size_t lines, size_t elem_size, bool is_signed) { - if (tiff == nullptr) - throw JFJochException(JFJochExceptionCategory::TIFFGeneratorError, "TIFFStreamOpen error"); - - TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, cols); // set the width of the image - TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, lines); // set the height of the image - TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1); // set number of channels per pixel - TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, elem_size * 8); // set the size of the channels - TIFFSetField(tiff, TIFFTAG_COMPRESSION, COMPRESSION_LZW); // setc ompression to LZW - TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, lines); - if (is_signed) - TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT); - else - TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT); - - if (TIFFWriteEncodedStrip(tiff, 0, buff,cols * lines * elem_size) < 0) - throw JFJochException(JFJochExceptionCategory::TIFFGeneratorError, "TIFFWriteEncodedStrip error"); - -} - -std::string WriteTIFFToString(void *buff, size_t cols, size_t lines, size_t elem_size, bool is_signed) { - std::stringstream os; - - TIFF *tiff = TIFFStreamOpen("x", (std::ostream *) &os); - WriteTIFF(tiff, buff, cols, lines, elem_size, is_signed); - TIFFClose(tiff); - - return os.str(); -} - -void WriteTIFFToFile(const std::string &filename, void *buff, size_t cols, size_t lines, size_t elem_size, - bool is_signed) { - TIFF *tiff = TIFFOpen(filename.c_str(), "w"); - - WriteTIFF(tiff, buff, cols, lines, elem_size, is_signed); - - TIFFClose(tiff); -} diff --git a/common/WriteTIFF.h b/common/WriteTIFF.h deleted file mode 100644 index 28052628..00000000 --- a/common/WriteTIFF.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (2019-2022) Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef JUNGFRAUJOCH_WRITETIFF_H -#define JUNGFRAUJOCH_WRITETIFF_H - -#include - -std::string WriteTIFFToString(void *buff, size_t cols, size_t lines, size_t elem_size, bool is_signed = false); -void WriteTIFFToFile(const std::string &filename, void *buff, size_t cols, size_t lines, size_t elem_size, - bool is_signed = false); - -#endif //JUNGFRAUJOCH_WRITETIFF_H diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 365c2ebf..c403a3a1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,7 +25,7 @@ add_executable(CatchTest JFCalibrationTest.cpp RadialIntegrationTest.cpp StatusVectorTest.cpp ProcessRawPacketTest.cpp - CBORTest.cpp TIFFTest.cpp JFConversionTest.cpp) + CBORTest.cpp JFConversionTest.cpp) target_link_libraries(CatchTest JFJochBroker JFJochReceiver JFJochWriter DataProcessing CommonFunctions HLSSimulation) target_include_directories(CatchTest PRIVATE .) diff --git a/tests/TIFFTest.cpp b/tests/TIFFTest.cpp deleted file mode 100644 index b9da8192..00000000 --- a/tests/TIFFTest.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (2019-2022) Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-or-later - -#include -#include <../common/WriteTIFF.h> - -TEST_CASE("TIFFTest","[TIFF]") { - std::vector values(512*1024); - REQUIRE_NOTHROW(WriteTIFFToString(values.data(), 1024, 512, 2)); -} - -TEST_CASE("TIFFTest_File","[TIFF]") { - std::vector values(512*1024); - - for (auto &i: values) - i = 345; - - REQUIRE_NOTHROW(WriteTIFFToFile("test_image.tiff", values.data(), 1024, 512, 2)); -} - -TEST_CASE("TIFFTest_File_signed","[TIFF]") { - std::vector values(512*1024); - - for (int i = 0; i < values.size(); i++) { - values[i] = static_cast(((i % 2 == 0) ? 1 : -1) * i); - } - - REQUIRE_NOTHROW(WriteTIFFToFile("test_image_signed.tiff", values.data(), 1024, 512, - 2, true)); -}