Skip to content

Commit

Permalink
clean up and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RRobert92 committed Jul 24, 2024
1 parent 657fd5c commit 58365b3
Show file tree
Hide file tree
Showing 25 changed files with 652 additions and 2,014 deletions.
2 changes: 0 additions & 2 deletions _version.py

This file was deleted.

97 changes: 0 additions & 97 deletions napari.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions src/napari_tardis_em/napari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contributions:
title: Predict Microtubules 3D

# - id: napari-tardis-em.viewer_mt_2d
# python_name: napari_tardis_em.viewers.viewer_mt_3d:TardisWidget
# python_name: napari_tardis_em.viewers.viewer_mt_2d:TardisWidget
# title: Predict Microtubules 2D

# Membrane
Expand All @@ -49,7 +49,7 @@ contributions:
title: Predict Membrane 3D

- id: napari-tardis-em.viewer_mem_2d
python_name: napari_tardis_em.viewers.viewer_mt_2d:TardisWidget
python_name: napari_tardis_em.viewers.viewer_mem_2d:TardisWidget
title: Predict Microtubules 2D

# # Actin
Expand Down
29 changes: 18 additions & 11 deletions src/napari_tardis_em/viewers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ def update_viewer_prediction(viewer, image: np.ndarray, position: dict):
position["x"][1] = position["x"][0] + diff[1]

img.data[
position["y"][0]: position["y"][1],
position["x"][0]: position["x"][1],
] = image[: diff[0], : diff[1],]
position["y"][0] : position["y"][1],
position["x"][0] : position["x"][1],
] = image[
: diff[0],
: diff[1],
]
viewer.layers["Prediction"].visible = False
viewer.layers["Prediction"].visible = True

Expand All @@ -101,7 +104,7 @@ def create_point_layer(
pass

point_features = {
"confidence": tuple(points[:, 0].flatten()*np.random.randint(100)),
"confidence": tuple(points[:, 0].flatten() * np.random.randint(100)),
}
points = np.array(points[:, 1:])

Expand All @@ -111,11 +114,7 @@ def create_point_layer(
points = np.hstack((points, z))

# Convert xyz to zyx
points = np.vstack((
points[:, 2],
points[:, 1],
points[:, 0]
)).T
points = np.vstack((points[:, 2], points[:, 1], points[:, 0])).T
viewer.layers.select_all()
viewer.layers.toggle_selected_visibility()

Expand Down Expand Up @@ -198,7 +197,9 @@ def create_image_layer(
viewer.layers[name].visible = False


def setup_environment_and_dataset(dir_, mask_size, pixel_size, patch_size, correct_pixel_size=None):
def setup_environment_and_dataset(
dir_, mask_size, pixel_size, patch_size, correct_pixel_size=None
):
"""Set environment"""
TRAIN_IMAGE_DIR = join(dir_, "train", "imgs")
TRAIN_MASK_DIR = join(dir_, "train", "masks")
Expand All @@ -213,7 +214,13 @@ def setup_environment_and_dataset(dir_, mask_size, pixel_size, patch_size, corre
img_format=IMG_FORMAT,
test_img=TEST_IMAGE_DIR,
test_mask=TEST_MASK_DIR,
mask_format=("_mask.am", ".CorrelationLines.am", "_mask.mrc", "_mask.tif", "_mask.csv"),
mask_format=(
"_mask.am",
".CorrelationLines.am",
"_mask.mrc",
"_mask.tif",
"_mask.csv",
),
)

"""Optionally: Set-up environment if not existing"""
Expand Down
Loading

0 comments on commit 58365b3

Please sign in to comment.