diff --git a/histomicstk/annotations_and_masks/review_gallery.py b/histomicstk/annotations_and_masks/review_gallery.py index a1bb55678..b52fd0e12 100644 --- a/histomicstk/annotations_and_masks/review_gallery.py +++ b/histomicstk/annotations_and_masks/review_gallery.py @@ -3,7 +3,6 @@ import tempfile import numpy as np -import pyvips from imageio import imwrite from PIL import Image @@ -322,6 +321,7 @@ def create_review_galleries( post request to upload the gallery to DSA. """ + import pyvips from pandas import DataFrame if upload_results: diff --git a/histomicstk/annotations_and_masks/tests/test_annotation_database_parser.py b/histomicstk/annotations_and_masks/tests/test_annotation_database_parser.py index 19acb3a65..85d4f25f5 100644 --- a/histomicstk/annotations_and_masks/tests/test_annotation_database_parser.py +++ b/histomicstk/annotations_and_masks/tests/test_annotation_database_parser.py @@ -5,8 +5,6 @@ import pandas as pd import pytest -import sqlalchemy as db -from sqlalchemy import text from histomicstk.annotations_and_masks.annotation_database_parser import ( dump_annotations_locally, parse_annotations_to_local_tables) @@ -67,6 +65,9 @@ class TestDatabaseParser: def test_dump_annotations_locally_1(self): """Test dump annotations locally.""" + import sqlalchemy as db + from sqlalchemy import text + savepath = tempfile.mkdtemp() # recursively save annotations -- JSONs + sqlite for folders/items @@ -98,6 +99,9 @@ def test_dump_annotations_locally_1(self): def test_dump_annotations_locally_2(self): """Test dump annotations locally.""" + import sqlalchemy as db + from sqlalchemy import text + savepath = tempfile.mkdtemp() # recursively save annotations -- parse to csv + sqlite diff --git a/histomicstk/cli/SuperpixelSegmentation/SuperpixelSegmentation.py b/histomicstk/cli/SuperpixelSegmentation/SuperpixelSegmentation.py index 6bdef8de4..78b99a7cf 100644 --- a/histomicstk/cli/SuperpixelSegmentation/SuperpixelSegmentation.py +++ b/histomicstk/cli/SuperpixelSegmentation/SuperpixelSegmentation.py @@ -5,7 +5,6 @@ import large_image import numpy -import pyvips import scipy import skimage @@ -20,6 +19,8 @@ def createSuperPixels(opts): # noqa opts.callback, which is a function that takes (step_name: str, step_count: int, step_total: int). """ + import pyvips + averageSize = opts.superpixelSize ** 2 overlap = opts.superpixelSize * 4 * 2 if opts.overlap else 0 tileSize = opts.tileSize + overlap