Skip to content

Commit

Permalink
reshape imports and exclude plot folder from pytest config
Browse files Browse the repository at this point in the history
  • Loading branch information
Henley13 committed May 5, 2020
1 parent 49bab67 commit 2271aa9
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 76 deletions.
183 changes: 120 additions & 63 deletions bigfish/stack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,135 @@
build stack of images.
"""

from .utils import (check_array, check_df, check_recipe, check_datamap,
check_parameter, check_range_value,
get_margin_value, get_eps_float32)
from .io import (read_image, read_dv, read_array, save_image, save_array)
from .preprocess import (build_stacks, build_stack,
build_stack_no_recipe, rescale,
cast_img_uint8, cast_img_uint16, cast_img_float32,
cast_img_float64)
from .filter import (log_filter, mean_filter, median_filter, maximum_filter,
minimum_filter, gaussian_filter, remove_background_mean,
remove_background_gaussian, dilation_filter,
erosion_filter)
from .projection import (maximum_projection, mean_projection,
median_projection, in_focus_selection,
focus_measurement, get_in_focus_indices,
focus_projection, focus_projection_fast)
from .illumination import (compute_illumination_surface,
correct_illumination_surface)
from .postprocess import (remove_transcription_site,
extract_spots_from_frame, extract_coordinates_image,
center_mask_coord, from_boundaries_to_surface,
from_surface_to_boundaries, from_binary_to_coord,
complete_coord_boundaries, from_coord_to_frame,
from_coord_to_surface)
from .preparation import (split_from_background, build_image, get_coordinates,
get_distance_layers, get_surface_layers, build_batch,
get_label, Generator, encode_labels, get_map_label,
format_experimental_data, get_label_encoder,
remove_transcription_site_bis, filter_data,
balance_data, get_gene_encoder)
from .utils import check_array
from .utils import check_df
from .utils import check_parameter
from .utils import check_range_value
from .utils import check_recipe
from .utils import check_datamap
from .utils import get_margin_value
from .utils import get_eps_float32

from .io import read_image
from .io import read_dv
from .io import read_array
from .io import save_image
from .io import save_array

from .preprocess import build_stacks
from .preprocess import build_stack
from .preprocess import build_stack_no_recipe
from .preprocess import rescale
from .preprocess import cast_img_uint8
from .preprocess import cast_img_uint16
from .preprocess import cast_img_float32
from .preprocess import cast_img_float64

from .filter import mean_filter
from .filter import median_filter
from .filter import maximum_filter
from .filter import minimum_filter
from .filter import log_filter
from .filter import gaussian_filter
from .filter import remove_background_mean
from .filter import remove_background_gaussian
from .filter import dilation_filter
from .filter import erosion_filter

from .projection import maximum_projection
from .projection import mean_projection
from .projection import median_projection
from .projection import focus_projection
from .projection import focus_projection_fast
from .projection import focus_measurement
from .projection import in_focus_selection
from .projection import get_in_focus_indices

from .illumination import compute_illumination_surface
from .illumination import correct_illumination_surface

from .postprocess import remove_transcription_site
from .postprocess import extract_spots_from_frame
from .postprocess import extract_coordinates_image
from .postprocess import center_mask_coord
from .postprocess import from_boundaries_to_surface
from .postprocess import from_surface_to_boundaries
from .postprocess import from_binary_to_coord
from .postprocess import complete_coord_boundaries
from .postprocess import from_coord_to_frame
from .postprocess import from_coord_to_surface

from .augmentation import augment_2d


_utils = ["check_array", "check_df", "check_recipe", "check_datamap",
"check_parameter", "check_range_value",
"get_margin_value", "get_eps_float32"]
_utils = [
"check_array",
"check_df",
"check_recipe",
"check_datamap",
"check_parameter",
"check_range_value",
"get_margin_value",
"get_eps_float32"]

_io = ["read_image", "read_dv", "read_array", "save_image", "save_array"]
_io = [
"read_image",
"read_dv",
"read_array",
"save_image",
"save_array"]

_preprocess = ["build_stacks", "build_stack",
"build_stack_no_recipe", "rescale",
"cast_img_uint8", "cast_img_uint16", "cast_img_float32",
"cast_img_float64"]
_preprocess = [
"build_stacks",
"build_stack",
"build_stack_no_recipe",
"rescale",
"cast_img_uint8",
"cast_img_uint16",
"cast_img_float32",
"cast_img_float64"]

_filter = ["log_filter", "mean_filter", "median_filter", "maximum_filter",
"minimum_filter", "gaussian_filter", "remove_background_mean",
"remove_background_gaussian", "dilation_filter", "erosion_filter"]
_filter = [
"log_filter",
"mean_filter",
"median_filter",
"maximum_filter",
"minimum_filter",
"gaussian_filter",
"remove_background_mean",
"remove_background_gaussian",
"dilation_filter",
"erosion_filter"]

_projection = ["maximum_projection", "mean_projection", "median_projection",
"in_focus_selection", "focus_measurement",
"get_in_focus_indices", "focus_projection",
"focus_projection_fast"]
_projection = [
"maximum_projection",
"mean_projection",
"median_projection",
"in_focus_selection",
"focus_measurement",
"get_in_focus_indices",
"focus_projection",
"focus_projection_fast"]

_illumination = ["compute_illumination_surface",
"correct_illumination_surface"]
_illumination = [
"compute_illumination_surface",
"correct_illumination_surface"]

_postprocess = ["remove_transcription_site",
"extract_spots_from_frame", "extract_coordinates_image",
"center_mask_coord", "from_boundaries_to_surface",
"from_surface_to_boundaries", "from_binary_to_coord",
"complete_coord_boundaries", "from_coord_to_frame",
"from_coord_to_surface"]
_postprocess = [
"remove_transcription_site",
"extract_spots_from_frame",
"extract_coordinates_image",
"center_mask_coord",
"from_boundaries_to_surface",
"from_surface_to_boundaries",
"from_binary_to_coord",
"complete_coord_boundaries",
"from_coord_to_frame",
"from_coord_to_surface"]

_augmentation = ["augment_2d"]
_augmentation = [
"augment_2d"]

_preparation = ["split_from_background", "build_image", "get_coordinates",
"get_distance_layers", "get_surface_layers", "build_batch",
"get_label", "Generator", "encode_labels", "get_map_label",
"format_experimental_data", "get_label_encoder",
"remove_transcription_site_bis", "filter_data", "balance_data",
"get_gene_encoder"]

__all__ = (_utils + _io + _preprocess + _postprocess +
_filter + _projection + _illumination +
_augmentation + _preparation)
__all__ = (_utils + _io + _preprocess + _postprocess + _filter + _projection +
_illumination + _augmentation)
3 changes: 2 additions & 1 deletion bigfish/stack/augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"""

import numpy as np
from .preprocess import check_parameter, check_array
from .preprocess import check_parameter
from .preprocess import check_array


def augment_2d(image):
Expand Down
3 changes: 2 additions & 1 deletion bigfish/stack/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import numpy as np

from skimage import io
from .utils import check_array, check_parameter
from .utils import check_array
from .utils import check_parameter


# ### Read ###
Expand Down
20 changes: 14 additions & 6 deletions bigfish/stack/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
import numpy as np

from .io import read_image
from .utils import (check_array, check_parameter, check_recipe, check_datamap,
check_range_value, fit_recipe,
get_path_from_recipe, get_nb_element_per_dimension,
count_nb_fov)

from skimage import img_as_ubyte, img_as_float32, img_as_float64, img_as_uint
from .utils import check_array
from .utils import check_parameter
from .utils import check_recipe
from .utils import check_datamap
from .utils import check_range_value
from .utils import fit_recipe
from .utils import get_path_from_recipe
from .utils import get_nb_element_per_dimension
from .utils import count_nb_fov

from skimage import img_as_ubyte
from skimage import img_as_float32
from skimage import img_as_float64
from skimage import img_as_uint
from skimage.exposure import rescale_intensity


Expand Down
11 changes: 8 additions & 3 deletions bigfish/stack/tests/test_augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
import numpy as np
import bigfish.stack as stack

from bigfish.stack.augmentation import (
_identity, _flip_h, _flip_v, _transpose, _transpose_inverse, _rotation_90,
_rotation_180, _rotation_270)
from bigfish.stack.augmentation import _identity
from bigfish.stack.augmentation import _flip_h
from bigfish.stack.augmentation import _flip_v
from bigfish.stack.augmentation import _transpose
from bigfish.stack.augmentation import _transpose_inverse
from bigfish.stack.augmentation import _rotation_90
from bigfish.stack.augmentation import _rotation_180
from bigfish.stack.augmentation import _rotation_270

from numpy.testing import assert_array_equal

Expand Down
7 changes: 5 additions & 2 deletions bigfish/stack/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
import tempfile

import bigfish.stack as stack
from bigfish.stack.utils import (fit_recipe, get_path_from_recipe,
get_nb_element_per_dimension, count_nb_fov)

import numpy as np
import pandas as pd

from bigfish.stack.utils import fit_recipe
from bigfish.stack.utils import get_path_from_recipe
from bigfish.stack.utils import get_nb_element_per_dimension
from bigfish.stack.utils import count_nb_fov


# ### Test sanity check functions ###

Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
filterwarnings =
ignore::DeprecationWarning
ignore::UserWarning
norecursedirs = plot

0 comments on commit 2271aa9

Please sign in to comment.