-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327 from computational-cell-analytics/dev
Changes for new release
- Loading branch information
Showing
131 changed files
with
3,933 additions
and
1,769 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import imageio.v3 as imageio | ||
import napari | ||
|
||
from micro_sam.instance_segmentation import ( | ||
load_instance_segmentation_with_decoder_from_checkpoint, mask_data_to_segmentation | ||
) | ||
from micro_sam.util import precompute_image_embeddings | ||
|
||
checkpoint = "./for_decoder/best.pt" | ||
segmenter = load_instance_segmentation_with_decoder_from_checkpoint(checkpoint, model_type="vit_b") | ||
|
||
image_path = "/home/pape/Work/data/incu_cyte/livecell/images/livecell_train_val_images/A172_Phase_A7_1_02d00h00m_1.tif" | ||
image = imageio.imread(image_path) | ||
|
||
embedding_path = "./for_decoder/A172_Phase_A7_1_02d00h00m_1.zarr" | ||
image_embeddings = precompute_image_embeddings( | ||
segmenter._predictor, image, embedding_path, | ||
) | ||
# image_embeddings = None | ||
|
||
print("Start segmentation ...") | ||
segmenter.initialize(image, image_embeddings) | ||
masks = segmenter.generate(output_mode="binary_mask") | ||
segmentation = mask_data_to_segmentation(masks, with_background=True) | ||
print("Segmentation done") | ||
|
||
v = napari.Viewer() | ||
v.add_image(image) | ||
# v.add_image(segmenter._foreground) | ||
v.add_labels(segmentation) | ||
napari.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.