mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-29 03:37:34 +08:00
Improve import behavior for rag fallback
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user