DerThorsten / nifty

A nifty library for graph based image segmentation.
MIT License
41 stars 21 forks source link

LiftedMulticutObjectiveUndirectedGraph: No constructor defined! #129

Closed alexandre01 closed 5 years ago

alexandre01 commented 5 years ago

Hi, Thanks for the awesome library!

When defining a lifted multicut objective, for instance:

Graph = nifty.graph.UndirectedLongRangeGridGraph2D

LiftedMulticutObjective = Graph.LiftedMulticutObjective
objective = LiftedMulticutObjective(g, weights)

I'm getting the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-629-572870f259de> in <module>
----> 1 objective = LiftedMulticutObjective(g, weights)

TypeError: nifty.graph.opt.lifted_multicut._lifted_multicut.LiftedMulticutObjectiveUndirectedGraph: No constructor defined!

Note that the same code works for a MulticutObjective. Is this related to a missing exported class via pybind? Thanks for your help!

DerThorsten commented 5 years ago

I am not at my machine atm but i think on the python side there is a factory function, 'liftedMulticutObjective' if i remember correctly. The benefit of the factory function approach is that the factory function has the same name for different graph types (send from mobile device)

alexandre01 commented 5 years ago

Thanks for your quick response! You were right, using the liftedMulticutObjective factory function worked perfectly! I was initially confused since this function only takes the graph as argument (and not the weights), but found out setGraphEdgesCosts enables to define the weights afterwards. Thanks 👍 👍