fedorov / MultiVolumeImporter

A 3D Slicer module to support import of multi-volume data from non-DICOM sources, and provide plugin for importing such data from images saved in DICOM.
http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/MultiVolumeImporter
Other
9 stars 25 forks source link

Fail graciously when numpy is not available #6

Closed jcfr closed 11 years ago

jcfr commented 11 years ago

Something like what is done for simpleitk could be done. See https://github.com/Slicer/Slicer/commit/0d3f082

jcfr commented 11 years ago

For reference - See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22144

fedorov commented 11 years ago

JC, what do you mean by "fail graciously"? MultiVolumeImporter module is not an Editor or DICOM module plugin. So its failure to load does not affect functionality of any other module, as far as I understand. If import numpy fails, the module will just not show up on the module list. Looks gracious to me.

fedorov commented 11 years ago

Can you suggest how a module can tell the main Slicer application that a dependency is not satisfied and it cannot be loaded?

jcfr commented 11 years ago

Currently there are no mechanism allowing a module to "prevent" its loading by on the some logic. The idea wouldn't be to prevent the module from being loaded by to display a warning in the console if numpy is not available.

On Sat, Jul 6, 2013 at 1:12 PM, Andrey Fedorov notifications@github.comwrote:

Can you suggest how a module can tell the main Slicer application that a dependency is not satisfied and it cannot be loaded?

— Reply to this email directly or view it on GitHubhttps://github.com/fedorov/MultiVolumeImporter/issues/6#issuecomment-20557525 .

+1 919 869 8849

fedorov commented 11 years ago

The module is not functional if numpy is not available.

If there is no numpy, the module should not be loaded. Right now it is not laded because the import exception is not caught.

Sure, I can print the warning message, but what is the alternative method to prevent the module from loading?

I am just trying to understand what should be the expected behavior of the module.

fedorov commented 11 years ago

I talked to @pieper today, and he explained to me what you mean!! Sorry I didn't get it on my own. Will commit the fix now.