Skip to content

Instantly share code, notes, and snippets.

View psobolewskiPhD's full-sized avatar

Peter Sobolewski psobolewskiPhD

View GitHub Profile
@psobolewskiPhD
psobolewskiPhD / tensorstore_labels_patches.py
Created May 16, 2024 16:27
painting patches of a large labels layer using tensorstore
# %%
# The idea behind this is to enable painting into a patch of a large
# labels layer that is loaded multiscale into napari
# By using tensorstore we can paint into a view of the array
# in memory and then commit the painting to disc async.
# This ends up being quite responsive and performant.
# %%
import numpy as np
import napari
import tensorstore as ts
@psobolewskiPhD
psobolewskiPhD / points_scale1_n3d.py
Created April 8, 2024 22:27
script to setup point annotator test
import napari
import numpy as np
from skimage import data
from napari_threedee.annotators import PointAnnotator
from napari_threedee.manipulators import RenderPlaneManipulator
viewer = napari.Viewer()
image_data = data.cells3d()[:,1,...] # just get the one channel
@psobolewskiPhD
psobolewskiPhD / point_annotator_scale_bug.ipynb
Created April 8, 2024 21:40
napari-threedee point annotator when layer has scale
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@psobolewskiPhD
psobolewskiPhD / toggle_blending_with_vis.py
Last active December 24, 2022 19:22
Keep Bottom-visible layer blending translucent
import napari
from skimage import data
viewer = napari.Viewer()
viewer.add_image(data.kidney(),
colormap = ["I Blue", "I Purple", "I Orange"],
channel_axis=3,
rgb=False,
blending= ["translucent_no_depth", "minimum", "minimum"]
)
Package Version Editable project location
----------------------------- ------------------------------ -----------------------------------------------
aicsimageio 4.9.2
aicspylibczi 3.0.5
aiohttp 3.8.3
aiosignal 1.2.0
alabaster 0.7.12
app-model 0.1.2.dev3+gf9c9390.d20221114 /Users/piotrsobolewski/Dev/app-model
appdirs 1.4.4
appnope 0.1.3
npe2 list (napari-dev) ─╯
╭────────────────────── Traceback (most recent call last) ───────────────────────╮
│ /Users/piotrsobolewski/Dev/miniforge3/envs/napari-dev/lib/python3.10/site-pack │
│ ages/npe2/cli.py:291 in list │
│ │
│ 288 │ │
│ 289 │ pm = PluginManager.instance() │
│ 290 │ pm.discover(include_npe1=True) │
│ ❱ 291 │ pm.index_npe1_adapters() │
│ 292 │ pm_dict = pm.dict(include={f.lstrip("!") for f in normed_fields}) │
@psobolewskiPhD
psobolewskiPhD / torch-mps-cellpose.py
Created December 12, 2022 16:41
Test script for cellpose MPS branch
# %%
%env PYTORCH_ENABLE_MPS_FALLBACK=1
# %%
import numpy as np
import time, os, sys
from urllib.parse import urlparse
import skimage.io
import matplotlib.pyplot as plt
import matplotlib as mpl
%matplotlib inline
import numpy as np
from skimage import io
from skimage import filters
from skimage import morphology
from skimage import measure
from skimage import exposure
# Read the TIFF image
img = io.imread('organoid.tiff')
import numpy as np
from skimage import io
from skimage import filters
from skimage import morphology
from skimage import measure
# Read the TIFF image
img = io.imread('organoid.tiff')
# Apply median filtering to remove noise
@psobolewskiPhD
psobolewskiPhD / gist:098f6f31a4dc0fd60e7cc86b648de9b5
Created October 5, 2022 09:34
macOS crash report Translated Report (Full Report Below) (macOS 12.6, arm64)
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: python3.10 [34952]
Path: /Users/USER/*/python3.10
Identifier: python3.10
Version: ???
Code Type: ARM-64 (Native)
Parent Process: fish [31007]