Giter Club home page Giter Club logo

ftk's Introduction

FTK: The Feature Tracking Kit

Build Status

FTK is a library that scales, simplifies, and delivers feature tracking algorithms for scientific datasets. You may use FTK as ParaView plugins, Python bindings, or a command-line interface. See arXiv:2011.08697 for more details on our feature tracking algorithms.

See documentation for more details.

Installation

To install FTK, use spack install ftk, pip install pyftk, or build from source; see this page for more details on dependencies, compilation, and installation.

For Windows users only: this code has been developed and tested using MacOS and Linux environments; we have not tried porting functionalities to Windows. Windows users may use a Linux virtual machine to compile and use FTK; the use of WSL2 has not been tested yet. Stay tuned.

FTK command line interface

FTK provides one single executable ftk. See this page for mor details on the usage of FTK command line interface.

FTK for ParaView

Building ParaView plugins

FTK provides ParaView plugins to allow users track critical points (maxima, minima, and saddles) in scalar field data. In order to build the plugins, we recommend to build and use (ParaView version 5.8.0 and higher required)

$ git clone https://github.com/hguo/ftk $FTK_SOURCE_DIR
$ mkdir $FTK_SOURCE_DIR/build && cd $FTK_SOURCE_DIR/build
$ cmake .. -DFTK_BUILD_PARAVIEW=ON -DParaView_DIR=$YOUR_ParaView_Build
$ make

If built successfully, you will see the plugins binary as lib/paraview-5.8/plugins/FTK/FTK.so. Open the "Plugin Manager" in ParaView, and load this binary with "Load New..." button, and then select and load FTK in the list. To check if ParaView plugins are correctly built by reproducing the results in the above figure, use "Sources-->FTK-->SpiralWoven2DSource", "Filters-->FTK-->CriticalPointTracker2D",followed by the "Tube" filter in ParaView.

Using ParaView plugins

We demonstrate the use the 2D critical point tracking filter (vtkCriticalPoint2DTracker) with a dataset. The input of this filter must be a 3D volumetric data that stacks 2D time-varying scalar fields in the Z direction. In this demo, we first add a synthetic 3D volume data by using Sources / FTK / Spiral2DSource. We then track the trajectories of 2D critical points with Filters / FTK / CriticalPoint2DTracker. The output trajectires can be visualized as tubes and color-coded by their types, scalar values, or IDs. In this demo, the time-varying scalar field is defined in closed form:

$f(x,y,t)=cos(x\cos t - y\sin t) \sin(x\sin t + y\cos t),$

where $x$ and $y$ are 2D coordinates and $t$ is time. We discretize the $x,y$ domain into a $128\times 128$ regular grid and the time domain into 10 timesteps. Local maximum are defined as the loci of points that $(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial x})=0$ and both eigenvalues of the Hessian of $f$ (in terms of $x$ and $y$) are negative. We use a sweep-and-trace algorithm to first localize local maximum and trace the maximum over space-time. We first mesh the scalar field with a 3D regular simplex mesh and check every 2-elements (faces) meets the criteria. We then do the connected component labeling; two faces are connected if each of them has a local maxima and share the same 3-element (tetrahedra). The trajectories are then constructured from the connected components.

FTK for Python (PyFTK)

You can install PyFTK with pip. The only dependency in the current release is numpy. If you would like to build PyFTK from source and use advanced build options, see this page.

$ pip3 install pyftk

PyFTK provides synthetic data generators (pyftk.synthesizers), feature extractors (pyftk.extractors), and feature trackers (pyftk.trackers). Currently, PyFTK only supports critical points. The following is an example of tracking critical points in a synthetic spiral woven data:

>>> import pyftk
>>> data = pyftk.synthesizers.spiral_woven(10, 10, 20) # generate synthetic spiral woven data (width=10, height=10, and 20 timesteps).  The shape of data is (1, 10, 10, 20)
>>> result = pyftk.trackers.track_critical_points_2d_scalar(data) # track critical points in a scalar field
>>> print(result)

The results are trajectories organized in a list:

[{'length': 9, 'trace': [{'x': 2.275077079338536, 'y': 2.0, 't': 2.843946435964648, 'type': 'min', 'scalar': -0.7349697808320285}, {'x': 2.3009922790096073, 'y': 2.057205556154771, 't': 3.0, 'type': 'min', 'scalar': -0.7126261556354363}, {'x': 2.316376550504984, 'y': 2.0789601019629704, 't': 3.0789601019629704, 'type': 'min', 'scalar': -0.6994583185227987}, {'x': 2.3396684290296013, 'y': 2.109042720626548, 't': 3.339668429029601, 'type': 'min', 'scalar': -0.6203974444741183}, ...

FTK C++ Libraries

You may use FTK as a C++ library. The installation will also generate FTKConfig.cmake in the installation path, such that you can use find_package(FTK) to find and use FTK in your CMakeLists.txt

$ git clone https://github.com/hguo/ftk $FTK_SOURCE_DIR
$ mkdir $FTK_SOURCE_DIR/build && cd $FTK_SOURCE_DIR/build
$ cmake .. -DCMAKE_INSTALL_PREFIX=$FTK_INSTALL_DIR
$ make install

Including FTK in your CMake project

You may use the FTK installation in your own CMakeLists.txt file:

find_package(FTK REQUIRED)
include_directories (${FTK_INCLUDE_DIR})
target_link_library (${YOUR_TARGET} FTK::libftk)

Specify FTK_DIR with CMake:

$ cmake -DFTK_DIR=$FTK_INSTALL_DIR/lib/cmake

FTK library components

  • Hypermesh: data structures for high-dimensional meshes and mesh elements including n-simplices, n-cubes, and n-prisms; utilities to generalize given 2D/3D structured/unstructured meshes into 3D/4D spacetime meshes

  • Numeric: root-find algorithms for inverse interpolations and parallel vector operators in n-simplices, n-cubes, and simplex-prisms; lightweight linear algebra utilities to support root-finding
  • CCL: connected component labeling algorithm for building feature tracking algorithms
  • Geometry: utilities to transform connect components to geometry for visualization and analysis
  • Tracking graph: data structures to record births, deaths, merges, and splits of features; visualization algorithms for tracking graphs

Contact

Publications

  • Hanqi Guo, David Lenz, Jiayi Xu, Xin Liang, Wenbin He, Iulian R. Grindeanu, Han-Wei Shen, Tom Peterka, Todd Munson, and Ian Foster, "FTK: A Simplicial Spacetime Meshing Framework for Robust and Scalable Feature Tracking." IEEE Transactions on Visualization and Computer Graphics, 27(8):3463-3480, 2021. arXiv:2011.08697 [cs.GR]

  • Jiayi Xu, Hanqi Guo, Han-Wei Shen, Mukund Raj, Xueqiao Xu, Xueyun Wang, Zhehui Wang, and Tom Peterka, "Asynchronous and Load-Balanced Union-Find for Distributed and Parallel Scientific Data Visualization and Analysis." IEEE Transactions on Visualization and Computer Graphics (Proc. IEEE PacificVis 2021), 27(6):2808-2820, 2021. arXiv:2003.02351 [cs.DC]

ftk's People

Contributors

harviu avatar hewenbin avatar hguo avatar jiayixu64 avatar lxaltria avatar robertu94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ftk's Issues

Tracking custom entities

Hello,

I recently came across this project, and it looks quite interesting!

We have developed a methodology to identify certain features in climate data
https://bitbucket.org/vgl_iisc/rossby-wave-packet-identification/src/master/

and we would like to see if we could use ftk to track the features we identify.
Unlike the typical use-case that ftk describes in the accompanying paper,
our objects comprises of multiple critical points per feature. (See Figure 2
in our paper)

Does FTK have an API to which we can provide the features we identify (typically
clusters of critical points or graphs) and track them across time?

TIA,
Joy

Using the connected_component feature with the CLI

Hi,

I'm working on Connected Component Labeling (CCL) in massive distributed setting and I have found your work https://arxiv.org/abs/2003.02351 very interesting. So I wanted to try ftk via the CLI before trying to use it as a library to perform CCL, but I'm stumbling into some minor issues that you could may be help me to solve.

I have installed the master version of ftk with spack:

$ spack install --add ftk@master +mpi +vtk ^[email protected]

I have a file my_file.vti that contain 3D data with 4 scalar fields and a vector field of 3 components. One of this scalars field is named "contribution" and I want to identify each group of voxels that have a value above 1.

This look like an undocumented use of ftk so I have try several options of ftk that look promising to me such as: -f connected_component, --threshold 1.0, --var contribution, --output-type discrete|sliced but none of the combination that have tried seams to work.

Here are the two most illustrative examples of my problem:

$ ftk -f connected_component -i my_file.vti -n 1 --var contribution --output test.vtp

produced the following output:

[FTK FATAL] VTK variable not found
Obtained 7 stack frames.
ftk(_ZN3ftk15print_backtraceEv+0x2c) [0x55f680772acc]
ftk(_ZN3ftk5fatalEiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x81) [0x55f680777c21]
ftk(+0x19790b) [0x55f68089a90b]
ftk(+0x59bd7) [0x55f68075cbd7]
ftk(+0x3236a) [0x55f68073536a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f0c056d9083]
ftk(+0x3266e) [0x55f68073566e]

and without the option --var:

$ ftk -f connected_component -i my_file.vti -n 1 --output test.vtp

I have this output:

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
*** Process received signal ***
Signal: Aborted (6)
Signal code:  (-6)
[ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f181c636420]
[ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f181bdf700b]
[ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f181bdd6859]
[ 3] /home/user/software/spack/opt/spack/linux/gcc-9.4.0/gcc-runtime-9.4.0-tu4d4s4qlhsu3r73sgs2ta7gkecvv24m/lib/libstdc++.so.6(+0x9e8d1)[0x7f181c1b08d1]
[ 4] /home/user/software/spack/opt/spack/linux/gcc-9.4.0/gcc-runtime-9.4.0-tu4d4s4qlhsu3r73sgs2ta7gkecvv24m/lib/libstdc++.so.6(+0xaa37c)[0x7f181c1bc37c]
[ 5] /home/user/software/spack/opt/spack/linux/gcc-9.4.0/gcc-runtime-9.4.0-tu4d4s4qlhsu3r73sgs2ta7gkecvv24m/lib/libstdc++.so.6(+0xaa3e7)[0x7f181c1bc3e7]
[ 6] /home/user/software/spack/opt/spack/linux/gcc-9.4.0/gcc-runtime-9.4.0-tu4d4s4qlhsu3r73sgs2ta7gkecvv24m/lib/libstdc++.so.6(+0xaa699)[0x7f181c1bc699]
[ 7] /home/user/software/spack/opt/spack/linux/gcc-9.4.0/gcc-runtime-9.4.0-tu4d4s4qlhsu3r73sgs2ta7gkecvv24m/lib/libstdc++.so.6(_ZSt19__throw_logic_errorPKc+0x41)[0x7f181c1b31dc]
[ 8] ftk(+0x3387b)[0x56181c1ac87b]
[ 9] ftk(+0x1971de)[0x56181c3101de]
[10] ftk(+0x59bd7)[0x56181c1d2bd7]
[11] ftk(+0x3236a)[0x56181c1ab36a]
[12] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f181bdd8083]
[13] ftk(+0x3266e)[0x56181c1ab66e]
*** End of error message ***
Abandon (core dumped)

Thanks in advance,
Killian

Build in windows

How to build paraview plugins in windows system? Thanks for work!

Question about compile in win10

Hello, thanks for your work!
I am trying to use it as c++ library on win10, but I find that there are several head files that dependent on Linux. Thus, I am wondering is this code only for Linux and is there any simple recipe to transplant it to Windows?

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.