Code Monkey home page Code Monkey logo

ome-files-cpp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ome-files-cpp's Issues

ome-files does not correctly load dependencies when imported in CMake

I'm trying to integrating ome-files in a CMake C++ project. In my hands, the following is a minimal CMakeLists.txt to successfully build a ome-files project. I am building on macOS 10.12.6 with clang 4.0.

cmake_minimum_required(VERSION 3.9)
project(ome-test) 

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_PREFIX_PATH "$ENV{OME_FILES_ROOT}")

find_package(Boost COMPONENTS log iostreams) # <- Build fails without this line
find_package(OMEXML REQUIRED)
find_package(OMEFiles REQUIRED)

include_directories($ENV{OME_FILES_ROOT}/include)
add_executable(ome-test main.cpp)
target_link_libraries(ome-test OME::Files)

If I exclude the find_package(Boost COMPONENTS log iostreams) line (or use different boost components) CMake fails with the following error:

CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::log_setup" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::log" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::iostreams" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

[SNIP]

CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::filesystem" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

As far as I understand, find_package(OMEFiles REQUIRED) should automatically import its dependencies and this line should not be required. This error occurs when using either the downloaded ome-files build or when using a freshly compiling super-build from head.

I have the build working now but thought I'd let you know as it look a while to figure this out.

Reading metadata for small files can consume lots of memory

Using the simple zzuf fuzzer I tried feeding fuzzed images into the info tool shipped with ome-files-cpp and found that large ImageWidth and ImageLength parameters in the TIFF header will cause info to attempt to allocate very large amounts of memory, leading to OOM kills in my testing VM, even for very small input files. Anecdotally, the libtiff tiffinfo tool also allocates large amounts of memory when examining these files but I could successfully run tiffinfo against these where I couldn't run the info tool.

I noticed that someone else filed a similar bug against libtiff last year with no resolution yet. It's not obvious that this is a bug but it could be a DoS vector if ome-files-cpp backs a web application that accepts user data.

Here is a set of examples. Each of these is derived from the single-channel.ome.tif from the OME-TIFF sample data and is about 70k; they can lead to memory allocations of 8GB+:
examples.zip

Investigate writing tiles out of order

The current behaviour when writing a plane is to flush tiles sequentially. This was, I think, done for the purpose of strict compatibility with the Bio-Formats TiffWriter/TiffSaver which strictly require writing in order. Looking at the libtiff documentation, libtiff does not have this restriction, and it should be possible to flush files as soon as they are completed. It would even be possible to support rewriting. This would require the IFD flush method to be adjusted to update the behaviour for coverage checking and tile ordering.

See this mail for further details.

Version.h gets stale on branch switch

Consider the following steps:

  • git clone [email protected]:ome/ome-files-cpp.git
  • mkdir build
  • cd build
  • cmake ..
  • make
  • grep OME_FILES_VCS_SHORTREVISION lib/ome/files/Version.h
    #define OME_FILES_VCS_SHORTREVISION "3a25964"

Now if you change branches in the repo which has a different HEAD commit and rebuild with make and call grep OME_FILES_VCS_SHORTREVISION lib/ome/files/Version.h again the output has not changed.

A fix could be to regenerate Version.h at every make invocation.

make doc-pdf fails

I've compiled ome-files-cpp on my debian jessie machine.
The creation of the pdf manual was not successfull, this stopped the build process.
See make-doc.txt for the build log.

$doxygen --version
1.8.13
$sphinx-build --version
Sphinx (sphinx-build) 1.5a1

Unhandled model references

With a current build, I'm seeing lots of this type of warning/error:

[warning] Unable to handle reference of type: St10shared_ptrIN3ome3xml5model9ReferenceEE

That's std::shared_ptr<ome::xml::model::Reference> in English.

That's indicative of something wrong in the model code, or invalid input. The former is most likely. Either way, it's something which should be investigated and fixed. Has there been a change to the model without a corresponding update to the C++ model code or templates?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.