Improve import behavior for rag fallback

This commit is contained in:
Steven Silvester
2014-08-04 07:40:37 -05:00
parent 56152fe6a7
commit 2a339fe69c
+4 -2
View File
@@ -1,11 +1,13 @@
try:
import networkx as nx
except ImportError:
msg = "Graph functions require networkx, which is not installed"
class nx:
class Graph:
pass
def __init__(self, *args, **kwargs):
raise ImportError(msg)
import warnings
warnings.warn('Region Adjacency Graph (RAG) features require networkx')
warnings.warn(msg)
import numpy as np
from scipy.ndimage import filters
from scipy import ndimage as nd