the-virtual-brain / tvb-gdist

Geodesic Library (adaptation by TVB Team)
Other
48 stars 30 forks source link

Failing on cortex 2x120k #41

Closed ayan-b closed 4 years ago

ayan-b commented 4 years ago

Dataset: https://github.com/the-virtual-brain/tvb-data/blob/master/tvb_data/surfaceData/cortex_2x120k.zip

Used code:

import numpy as np

import gdist

file = "cortex_2x120k"

for t in ['l', 'r']:
    print("Trying " + t)
    vertices = np.loadtxt("data/surface_data/" + file +
                        "/vertices" + t + ".txt", dtype=np.float64)
    triangles = np.loadtxt("data/surface_data/" + file +
                        "/triangles" + t + ".txt", dtype=np.int32)
    source = np.array([0, 1, 2, 3], dtype=np.int32)
    target = np.array([2, 5], dtype=np.int32)
    distance = gdist.compute_gdist(
        vertices,
        triangles,
        source,
        target,
    )
    print(distance)

Related to #22

While only using the C++ library:

Assertion failed!
File: geodesic_mesh.h, Line 158

Expression: vertex_index < num_vertices
ayan-b commented 4 years ago

This is failing because the code expects the vertices indicated by the faces to be 0-indexed. However, it is 1-indexed for the cortex mesh and thus it is going out of bound for the last vertex.

liadomide commented 4 years ago

Good finding. Could you pls add a unit-test on this?

ayan-b commented 4 years ago

Added in e6f6e19a5132391596d4f6e660ae48dd81347bc5.