mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
Improve import behavior for rag fallback
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
try:
|
try:
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
msg = "Graph functions require networkx, which is not installed"
|
||||||
class nx:
|
class nx:
|
||||||
class Graph:
|
class Graph:
|
||||||
pass
|
def __init__(self, *args, **kwargs):
|
||||||
|
raise ImportError(msg)
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warn('Region Adjacency Graph (RAG) features require networkx')
|
warnings.warn(msg)
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.ndimage import filters
|
from scipy.ndimage import filters
|
||||||
from scipy import ndimage as nd
|
from scipy import ndimage as nd
|
||||||
|
|||||||
Reference in New Issue
Block a user