Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def generate_apidocs(*args):
"github_user": "Project-MONAI",
"github_repo": "MONAI",
"github_version": "dev",
"doc_path": "docs/",
"doc_path": "docs/source",
"conf_py_path": "/docs/",
"VERSION": version,
}
Expand Down Expand Up @@ -167,17 +167,10 @@ def setup(app):


# -- Linkcode configuration --------------------------------------------------
DEFAULT_REF = "dev"
if os.environ.get("GITHUB_REF_TYPE", "branch") == "tag":
# When building a tag, link to the tag itself
git_ref = os.environ.get("GITHUB_REF", DEFAULT_REF)
else:
git_ref = os.environ.get("GITHUB_SHA", DEFAULT_REF)

DEFAULT_REPOSITORY = "Project-MONAI/MONAI"
repository = os.environ.get("GITHUB_REPOSITORY", DEFAULT_REPOSITORY)

base_code_url = f"https://github.com/{repository}/blob/{git_ref}"
base_code_url = f"https://github.com/{repository}/blob/{version}"
MODULE_ROOT_FOLDER = "monai"


Expand Down Expand Up @@ -208,7 +201,7 @@ def linkcode_resolve(domain, info):
except TypeError:
# e.g. object is a typing.Union
return None
file = os.path.relpath(file, os.path.abspath(".."))
file = os.path.relpath(file, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
if not file.startswith(MODULE_ROOT_FOLDER):
# e.g. object is a typing.NewType
return None
Expand Down
4 changes: 1 addition & 3 deletions monai/visualize/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
from monai.utils.type_conversion import convert_data_type, convert_to_dst_type

if TYPE_CHECKING:
from matplotlib import cm
from matplotlib import pyplot as plt
else:
plt, _ = optional_import("matplotlib", name="pyplot")
cm, _ = optional_import("matplotlib", name="cm")

__all__ = ["matshow3d", "blend_images"]

Expand Down Expand Up @@ -210,7 +208,7 @@ def blend_images(
image = repeat(image, 3, axis=0)

def get_label_rgb(cmap: str, label: NdarrayOrTensor) -> NdarrayOrTensor:
_cmap = cm.get_cmap(cmap)
_cmap = plt.colormaps.get_cmap(cmap)
label_np, *_ = convert_data_type(label, np.ndarray)
label_rgb_np = _cmap(label_np[0])
label_rgb_np = np.moveaxis(label_rgb_np, -1, 0)[:3]
Expand Down
1 change: 1 addition & 0 deletions tests/test_matshow3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def test_3d_rgb(self):
every_n=2,
frame_dim=-1,
channel_dim=0,
fill_value=0,
show=False,
)

Expand Down