TypeError when launching the deterministic atlas

83 views
Skip to first unread message

yue.che...@gmail.com

unread,
Apr 2, 2020, 2:08:41 PM4/2/20
to Deformetrica
Dear Deformetrica Team,

I am a beginner of Deformetrica. I'm learning to construct a deterministic atlas with my own data set, which consists of 6 vtk files. When I tried to launch the program, I got a TypeError. Could you please help me figure it out? The detail of the error is as below.

deformetrica estimate model.xml data_set.xml -p optimization_parameters.xml
Logger has been set to: WARNING
Traceback (most recent call last):
  File "/home/yue/anaconda3/envs/deformetrica/bin/deformetrica", line 12, in <module>
    sys.exit(main())
  File "/home/yue/anaconda3/envs/deformetrica/lib/python3.7/site-packages/deformetrica.py", line 127, in main
    model_options=get_model_options(xml_parameters))
  File "/home/yue/anaconda3/envs/deformetrica/lib/python3.7/site-packages/api/deformetrica.py", line 180, in estimate_deterministic_atlas
    dimension=model_options['dimension'], **dataset_specifications)
  File "/home/yue/anaconda3/envs/deformetrica/lib/python3.7/site-packages/in_out/dataset_functions.py", line 39, in create_dataset
    dimension))
  File "/home/yue/anaconda3/envs/deformetrica/lib/python3.7/site-packages/in_out/deformable_object_reader.py", line 42, in create_object
    out_object = SurfaceMesh(points, connectivity)
  File "/home/yue/anaconda3/envs/deformetrica/lib/python3.7/site-packages/core/observations/deformable_objects/landmarks/surface_mesh.py", line 30, in __init__
    torch.from_numpy(points), torch.from_numpy(triangles))
TypeError: expected np.ndarray (got NoneType)

Thank you very much.

Yue

Alexandre Bône

unread,
Apr 3, 2020, 3:48:18 AM4/3/20
to Deformetrica
Hello Yue, 

Thank you for your interest. 

This error is weird, you input meshes must be in an unexpected format. The method "read_vtk_file" in this file must fail for some reason: https://gitlab.com/icm-institute/aramislab/deformetrica/-/blob/master/src/in_out/deformable_object_reader.py

In order to understand, could you try to run the following python code: 

import numpy as np
from vtk import vtkPolyDataReader
from vtk.util import numpy_support as nps

poly_data_reader = vtkPolyDataReader()
poly_data_reader.SetFileName(filename)
poly_data_reader.Update()
poly_data = poly_data_reader.GetOutput()

points = nps.vtk_to_numpy(poly_data.GetPoints().GetData()).astype('float64')
polygons = nps.vtk_to_numpy(poly_data.GetPolys().GetData()).reshape((-1, 4))[:, 1:]

and ensure that the numpy arrays "points" and "polygons" seem correctly filled ? From your log, I expect at least one of them to be "None" for some reason.  

Best, 
Alex 
Reply all
Reply to author
Forward
0 new messages