Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nan to num #1

Open
wants to merge 3 commits into
base: chunked_blob_detection
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions bigstream/features.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import numpy as np
from fishspot.filter import white_tophat, apply_foreground_mask

# from fishspot.detect import detect_spots_log

from scipy.stats.mstats import winsorize

import numpy as np
Expand Down Expand Up @@ -43,9 +45,11 @@ def detect_spots_log(
#return blob_log(image, **kwargs)
return chunked_blob_log(image, **kwargs)


import numpy as np
from skimage.feature import blob_log


def chunked_blob_log(image, **kwargs): #sigma_list, chunk_size=(128, 128, 128), overlap=(32, 32, 32)):
chunk_size=(256, 256, 256)
overlap=(64, 64, 64)
Expand Down Expand Up @@ -91,8 +95,7 @@ def blob_detection(
max_blob_radius : scalar float
The largest size blob you want to find in voxel units
**kwargs : any additional kwargs
Passed to fishspot.detect_spots_log

Passed to fishspot.detect_spots_log∂
Returns
-------
blob_coordinates_and_intensities : nd-array Nx4
Expand Down
2 changes: 1 addition & 1 deletion bigstream/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def apply_transform(

# execute, return as numpy array
resampled = resampler.Execute(mov)
return sitk.GetArrayViewFromImage(resampled).astype(dtype)
return np.nan_to_num(sitk.GetArrayViewFromImage(resampled),nan=0.0,posinf=0.0,neginf=0.0).astype(dtype)


def apply_transform_to_coordinates(
Expand Down