GithubHelp home page GithubHelp logo

kabasset / linx Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 1.23 MB

Extensible ND image laboratory

License: Apache License 2.0

CMake 2.38% C++ 88.98% Makefile 0.38% CSS 6.93% HTML 1.09% Python 0.22% Groovy 0.02%
cpp dft fftw image-processing ndarray tensor under-development

linx's Introduction

I'm a PhD specialized in signal and image processing, as well as an engineer specialized in software development focused on optimization, parallelization and efficiency.

As an employee of CNES, the French space agency, I mostly work in the frame of large space missions like Euclid or Lisa.

Learn more on my website.

linx's People

Contributors

kabasset avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

linx's Issues

Enable GPU parallelization

Given that there are few constraints on the underlying container, it should be possible to rely on some CUDA container and enable GPU parallelization, e.g. in Raster::apply().

Refactor DFT API

There are too many public entities and names are sometimes obscure.

Implement separable filters in terms of FilterMixin

OrientedFilter may be too restrictive, and some arbitrary composition of filters would be beneficial, as SeparableFilter(Mixin) which would apply to any kind of filter, and would be composed with operator*().

Add standard services when possible

As much as possible, provide default ctor and operator==() for compatibility with std::vector & co.
If other simple additions can simplify integration with the STL, they would be welcome.

Stop using data() with a std::array of size 0

This is the error reported by Hubert on EleFits (CNES/EleFits#60):

(gdb) run
Starting program: /home/hubert/Work/Space/Euclid/EleFits/build.x86_64-fc38-gcc13-dbg/bin/EleCfitsioWrapper_CfitsioWrapper_test 
[Thread debugging using libthread_db enabled]                                                                                                     
Using host libthread_db library "/lib64/libthread_db.so.1".
Running 4 test cases...                                                                                                                           

Breakpoint 1.95, Euclid::Fits::ContiguousContainerMixin<long, Euclid::Fits::Position<0l> >::operator[] (this=0x7fffffff9ec0, index=0)
    at /home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131
131	    return *(static_cast<const TDerived&>(*this).data() + index);
(gdb) where
#0  Euclid::Fits::ContiguousContainerMixin<long, Euclid::Fits::Position<0l> >::operator[] (this=0x7fffffff9ec0, index=0)
    at /home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131
#1  0x00007ffff7f14979 in Euclid::Fits::ContiguousContainerMixin<long, Euclid::Fits::Position<0l> >::operator[] (this=0x7fffffff9ec0, index=0)
    at /home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:138
#2  0x00007ffff7f13812 in Euclid::Cfitsio::HduAccess::init_image<unsigned char, 0l> (fptr=0x5555555a9380, name="", shape=warning: RTTI symbol not found for class 'Euclid::Fits::Position<0l>'
warning: RTTI symbol not found for class 'Euclid::Fits::Position<0l>'
...)
    at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/EleCfitsioWrapper/impl/HduWrapper.hpp:22
#3  0x00007ffff7f1122c in Euclid::Cfitsio::HduAccess::init_primary (fptr=0x5555555a9380)
    at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/src/lib/HduWrapper.cpp:143
#4  0x00007ffff7f0f4a4 in Euclid::Cfitsio::FileAccess::create_open (filename="/tmp/hubert/f724-6cbe-6fa9-8c80", 
    policy=Euclid::Cfitsio::FileAccess::CreatePolicy::OverWrite)
    at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/src/lib/FileWrapper.cpp:23
#5  0x00007ffff7f0b612 in Euclid::Fits::Test::MinimalFile::MinimalFile (this=0x7fffffffa090)
    at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/src/lib/CfitsioFixture.cpp:14
#6  0x000055555557ab88 in CfitsioWrapper_test::read_ulong_record_learning_test::read_ulong_record_learning_test (this=0x7fffffffa090)
    at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/tests/src/CfitsioWrapper_test.cpp:34
#7  0x000055555556b318 in CfitsioWrapper_test::read_ulong_record_learning_test_invoker ()
    at /home/hubert/Work/Space/Euclid/EleFits/EleCfitsioWrapper/tests/src/CfitsioWrapper_test.cpp:34
#8  0x000055555557d32f in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke (function_ptr=...)
    at /usr/include/boost/function/function_template.hpp:117
#9  0x00007ffff6f99146 in boost::function0<void>::operator() (this=<optimized out>) at ./boost/function/function_template.hpp:763
#10 boost::detail::forward::operator() (this=<optimized out>) at ./boost/test/impl/execution_monitor.ipp:1388
#11 boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke (function_obj_ptr=...)
    at ./boost/function/function_template.hpp:137
#12 0x00007ffff6fa0435 in boost::function0<int>::operator() (this=0x7fffffffb7f0) at ./boost/function/function_template.hpp:763
#13 boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) (tr=..., F=...) at ./boost/test/impl/execution_monitor.ipp:301
#14 boost::execution_monitor::catch_signals(boost::function<int ()> const&) (
    this=this@entry=0x7ffff6fff3e0 <boost::unit_test::unit_test_monitor_t::instance()::the_inst>, F=...)
    at ./boost/test/impl/execution_monitor.ipp:903
#15 0x00007ffff6fa08df in boost::execution_monitor::execute(boost::function<int ()> const&) (
    this=0x7ffff6fff3e0 <boost::unit_test::unit_test_monitor_t::instance()::the_inst>, F=...) at ./boost/test/impl/execution_monitor.ipp:1301
#16 0x00007ffff6fa09cd in boost::execution_monitor::vexecute(boost::function<void ()> const&) (this=<optimized out>, F=...)
    at ./boost/test/impl/execution_monitor.ipp:1397
#17 0x00007ffff6fbcee1 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) (
    this=0x7ffff6fff3e0 <boost::unit_test::unit_test_monitor_t::instance()::the_inst>, func=..., timeout_microseconds=<optimized out>)
    at ./boost/test/impl/unit_test_monitor.ipp:49
#18 0x00007ffff6fdb070 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) [clone .isra.0] (
    this=this@entry=0x7ffff6ffeda0 <boost::unit_test::framework::impl::(anonymous namespace)::s_frk_state()::the_inst>, tu_id=<optimized out>, 
    timeout_microseconds=0, p_random_generator=<optimized out>) at ./boost/test/impl/framework.ipp:815
#19 0x00007ffff6fdb368 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) [clone .isra.0] (
    this=this@entry=0x7ffff6ffeda0 <boost::unit_test::framework::impl::(anonymous namespace)::s_frk_state()::the_inst>, tu_id=<optimized out>, 
    timeout_microseconds=0, p_random_generator=<optimized out>) at ./boost/test/impl/framework.ipp:740
--Type <RET> for more, q to quit, c to continue without paging--
#20 0x00007ffff6fdb368 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) [clone .isra.0] (
    this=0x7ffff6ffeda0 <boost::unit_test::framework::impl::(anonymous namespace)::s_frk_state()::the_inst>, tu_id=tu_id@entry=1, timeout_microseconds=timeout_microseconds@entry=0, p_random_generator=<optimized out>)
    at ./boost/test/impl/framework.ipp:740
#21 0x00007ffff6facb61 in boost::unit_test::framework::run (id=1, continue_test=<optimized out>) at ./boost/test/impl/framework.ipp:1721
#22 0x00007ffff6fbcbd8 in boost::unit_test::unit_test_main (init_func=<optimized out>, argc=<optimized out>, argv=<optimized out>) at ./boost/test/impl/unit_test_main.ipp:250
#23 0x00007ffff7e132bb in main (argc=1, argv=0x7fffffffc008) at /usr/include/boost/test/unit_test.hpp:64
(gdb) n
/home/hubert/Work/Space/Euclid/EleFits/EleFitsData/EleFitsData/ContiguousContainer.h:131:57: runtime error: reference binding to null pointer of type 'const long int'
132	  }

Clean makers naming

rasterize() is either a maker or a getter, depending on the arguments. It is not standard (as opposed to makeRaster(), which was used in EleFits). It is inconsistent with other makers like extrapolate() or convolve(), altough the latter would be ugly in standard form!

Find a consistent and easy-to-get naming scheme.

Simplify signature of PipelineStep

Something similar to std::function would be great, e.g. instead of:

struct Step0 : PipelineStep<void, char> {};
struct Step1a : PipelineStep<Step0, short> {};
struct Step1b : PipelineStep<Step0, int> {};
struct Step2 : PipelineStep<std::tuple<Step1a, Step1b>, long>{};

we'd have:

struct Step0 : PipelineStep<char()> {};
struct Step1a : PipelineStep<short(Step0)> {};
struct Step1b : PipelineStep<int(Step0)> {};
struct Step2 : PipelineStep<long(Step1a, Step1b)>{};

We'd still have the Prerequisite as a std::tuple.

Note that std::function is not adequate because the argument types is not accessible.

Switch to Apache-2.0

No need to keep LGPL for the library, the only blocking dependency is Elements, which is only required for Euclid. Could be limited to CMakeLists.

Clean type traits and other utilities

There are many type traits and type-related utility functions and classes (e.g. templateVoid) which should be cleaned, homogenized and hidden in the internal namespace.

Remove or hide BorderedBox

Usage is rather limited and the class is not mature enough to be published anyway. Rather hide it for now and clean it before publication. If usage is such that no proper class is needed, maybe even remove it at some point.

Remove contiguity constraint

The contiguity constraint was meant to implement Raster::data(), which is useful for legacy APIs like FFTW and CFITSIO. Yet, the holder itself can implement it, e.g. StdHolder::data(). It should be assessed whether such a change is feasible without breaking high-level features like decimated convolution.

Remove Matrix (at least for now)

The class was introduced for Affinity, which now relies directly on Eigen. Implementing a full matrix arithmetic/service base would be a nightmare and Eigen would probably be better in every respect.

Add operators to EuclidArithmetic containers

Often, multiplication is needed, e.g. for working with strides or non-isotropic scaling.

operator*() was considered a bad idea because it would be misleading, e.g. for vectors.
multiply() is an option, with in-place method and new-instance free function.

To be assessed, because other operators could be usefull, e.g. operator<<(), which are not related to Euclidean arithmetic.

Add pixelwise operator to FilterMixin

Sometimes, a filter has to be evaluated over few positions, such that operator* could be specialized for raster.patch(Position) or a new operator, e.g. (), could be introduced. No split is needed in this case.

Example, for flagging cosmics:

for (const auto& p : in.domain()) {
  mask[p] = (laplacian[p] > tl) && (quotient(in, p) > tq);
}

Create option creator `implicit()`

For example:

options.named("keywords,K", value<std::string>()->default_value("")->implicit_value("mrcu"), "help");

would be replaced with:

options.implicit("keywords,K", "help", "", "mrcu");

Rename resampling methods

Rename InterpolationMethods.h as ResamplingMethods.h and:

  • OutOfBoundsConstant as Constant
  • NearestNeighbor as Nearest

Add operator* to create grids from lines

More specifically:

Grid<std::max(N, M)> operator*(Line<I, M>, Line<J, N>);
Grid<std::max(N, M)> operator*(Grid<M>, Line<I, N>);
Grid<std::max(N, M)> operator*(Line<I, M>, Grid<N>);

Clean tiling

Some tiling functions still return rasters, where they should make generators. Implementation is a bit complicated, too. May require some refactoring.

Implement a unified copy mechanism

E.g. to go from a grid patch to a raster. We have copy() or raster() sometimes. rasterize() could be better, although it does not carry the notion of copying.

Merge FilterMixin and its children

As opposed to Kernel, StructuringElement is extensible, and proved to be as fast. Therefore, both could be merged into FilterMixin (to be renamed as Filter).

One thing to assess is how SeparableFilter would integrate with this design.

Detect option clash

It is possible to declare several times the same short option, typically -h, which should be catch at startup.

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.