brainvisa / morpho-deepsulci

Deep learning methods for Morphologist sulci recognition
8 stars 1 forks source link

Allow to import SulciDeepTraining #5

Closed BastienCagna closed 3 years ago

BastienCagna commented 3 years ago

I need to use SulciDeepTraining capsul process but I can't.

Traceback (most recent call last): File [...], in from deepsulci.sulci_labeling.capsul import SulciDeepTraining ImportError: cannot import name 'SulciDeepTraining'

denisri commented 3 years ago

In which code is this statement ? I can't find it... The training capsul process is in deepsulci.sulci_labeling.capsul.training, and you normally instantiate it this way:

from capsul.api import capsul_engine
ce = capsul_engine()
training_process = ce.get_process_instance('deepsulci.sulci_labeling.capsul.training')
BastienCagna commented 3 years ago

Ah, ok I though that we should directly import de class of the process. So you may reject the pull request I think.

denisri commented 3 years ago

For a process like this one, yes you can instantiate it directly (but here the class is inside another level of submodule, you could just add .taining in your code). The ce.get_process_instance is the general (and thus recommended) way to intantiate a process, and is useful especially if the process needs some configuration from the capsul engine. So it's a "good habit" to use it. For PR #6 it's as you like, it's OK for me to accept it also.

BastienCagna commented 3 years ago

Ok, it's better to use recommended habits. I will close de PR.