ttk icon indicating copy to clipboard operation
ttk copied to clipboard

TTK Crashes when ttk::AtomicUF::mergeStates() is called and one of the states is empty

Open josiahblaisdell opened this issue 4 years ago • 3 comments

Describe the bug This bug occurred when trying to create the persistence diagram for a tumor from an MRI stored in a "Structured Grid". I used a threshold to remove voxels with enhancement of 0 and I used tetrahedralize in order to create a persistence diagram.

I modified the CurrentState struct's "merge" function to check if the "other" state's propagation is empty. This seemed to fix the bug on my end. I am not sure why the propogation was empty in the first place though, and this may be indicative of a larger issue. I am using the dev branch here: https://github.com/topology-tool-kit/ttk/pull/487

The error I get says: /usr/include/boost/heap/fibonacci_heap.hpp:352: const value_type& boost::heap::fibonacci_heap<T, A0, A1, A2, A3, A4>::top() const [with T = int; A0 = boost::heap::compare<std::function<bool(int, int)> >; A1 = boost::parameter::void_; A2 = boost::parameter::void_; A3 = boost::parameter::void_; A4 = boost::parameter::void_; boost::heap::fibonacci_heap<T, A0, A1, A2, A3, A4>::value_type = int]: Assertion `!empty()' failed.

To Reproduce I'm not sure how to reproduce this without my data... I attached a screenshot of the data. If you need to reproduce this with my data let me know and I can email it to you.

Expected behavior The persistence diagram is computed.

Screenshots If applicable, add screenshots to help explain your problem. image image

Potential Fix I have gotten the (currently) latest code included in this pull: https://github.com/topology-tool-kit/ttk/pull/487 , here are the changes I made:

In FTMStructures.h:

      void merge(CurrentState &other) {
        if(!other.propagation.empty()){

          propagation.merge(other.propagation);
          vertex = propagation.top();
        }
      }

In FTMAtomicUF.h:

          if(! (*data_.states[i]).empty()){
            s->merge(*data_.states[i]);
          }

System (please complete the following information):

  • OS: Ubuntu 20.04
  • Compiler gcc 9.3 g++ 9.3
  • Boost version 1.71.0
  • Installed TTK's optional dependencies:
-- GraphViz found
-- Found SQLITE3: /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Python version: 3.8
-- Numpy headers: /usr/include
-- ttk options -----------------------------------------------------------------
-- TTK_ENABLE_64BIT_IDS: OFF
-- TTK_ENABLE_CPU_OPTIMIZATION: ON
-- TTK_ENABLE_DOUBLE_TEMPLATING: OFF
-- TTK_ENABLE_EIGEN: ON
-- TTK_ENABLE_GRAPHVIZ: ON
-- TTK_ENABLE_KAMIKAZE: OFF
-- TTK_ENABLE_MPI: OFF
-- TTK_ENABLE_OPENMP: ON
-- TTK_ENABLE_SCIKIT_LEARN: ON
-- TTK_ENABLE_SPECTRA: ON
-- TTK_ENABLE_SQLITE3: ON
-- TTK_ENABLE_ZFP: ON
-- TTK_ENABLE_ZLIB: ON
-- ttk build -------------------------------------------------------------------
-- CMAKE_BUILD_TYPE: Release
-- TTK_BUILD_DOCUMENTATION: OFF
-- TTK_BUILD_PARAVIEW_PLUGINS: ON
--   ParaView_DIR: /usr/local/PARAVIEW58/lib/cmake/paraview-5.8
-- TTK_BUILD_STANDALONE_APPS: ON
-- TTK_BUILD_VTK_WRAPPERS: ON
--   VTK_DIR: /usr/local/PARAVIEW58/lib/cmake/paraview-5.8/vtk
--   TTK_BUILD_VTK_PYTHON_MODULE: ON
-- ttk install -----------------------------------------------------------------
-- CMAKE_INSTALL_PREFIX: /usr/local
-- TTK_PYTHON_MODULE_DIR: lib/python3.8/site-packages
-- TTK_INSTALL_PLUGIN_DIR: /usr/local/PARAVIEW58/lib/cmake/paraview-5.8/../../../bin/plugins
-- -----------------------------------------------------------------------------

Additional context I have written my own vtk+c++ program to compute the distance between MRI data. This is occurring in my program, but I can reproduce in Paraview.

josiahblaisdell avatar Sep 11 '20 16:09 josiahblaisdell

hi josiah,

thanks for the issue. @CharlesGueunet can you please have a quick look into this? (if the fix looks reasonable to you, joshiah could PR it).

cheers,

julien-tierny avatar Sep 14 '20 06:09 julien-tierny

Hello,

I am not sure how we can have an empty state here,the propagation should at least contains one vertex. Is your data set clean ? Can it have disconnected points ? Eventually without cells associated ?

If we keep them, we may want to put these checks only when Kamikaze is off as they impact methods called really often during the computation of the tree. The performance of FTM / FTR really depends on these.

Charles

CharlesGueunet avatar Sep 14 '20 11:09 CharlesGueunet

@josiahblaisdell if you just run tetrahedralize after a voxel selection, it is likely your domain is not manifold (see the manifold check example https://topology-tool-kit.github.io/img/gallery/manifoldCheck.jpg). ftm supports only manifold domains at the moment (although it would be cool to extend it to non-manifold cases, without sacrificing performances).

for your analysis, maybe you can walk around the voxel selection and simply work with the original data.

cheers,

Dr Julien Tierny CNRS Researcher Sorbonne Universite http://lip6.fr/Julien.Tierny

On Monday, 14 September 2020 13:51:27 CEST Charles Gueunet wrote:

Hello,

I am not sure how we can have an empty state here,the propagation should at least contains one vertex. Is your data set clean ? Can it have disconnected points ? Eventually without cells associated ?

If we keep them, we may want to put these checks only when Kamikaze is off as they impact methods called really often during the computation of the tree. The performance of FTM / FTR really depends on these.

Charles

julien-tierny avatar Sep 14 '20 11:09 julien-tierny