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

"ValueError: in1 and in2 should have the same dimensionality" when "is_volume=True" for Filter.DeconvolvePSF #1912

Open
aschrader5 opened this issue Nov 4, 2020 · 0 comments
Labels
bug An issue with an existing feature

Comments

@aschrader5
Copy link

aschrader5 commented Nov 4, 2020

Description

"ValueError: in1 and in2 should have the same dimensionality" error is thrown when "is_volume=True" when running Filter.DeconvolvePSF. Function works correctly when is_volume = False

Filtering images using Filter.GaussianHighPass(is_volume=True) prior to deconvolution does not throw the same error.

Image stack that is being processing is 1 FOV, 8 rounds, 2 color, 3 zplanes.

Steps/Code to Reproduce

from starfish import FieldOfView
imgs = experiment[current_fov].get_image(FieldOfView.PRIMARY_IMAGES)
print("Images loaded")
print(imgs)
#apply transforms
warp = ApplyTransform.Warp()
warp.run(imgs, transforms_list=transforms_list, in_place=True)
print("Images warped")

if imgs.num_zplanes > 1: vol = True
else: vol=False

#Apply filters
ghp = Filter.GaussianHighPass(sigma=2, is_volume=vol)
ghp.run(imgs, verbose=True, in_place=True)
print("High passed")

from starfish.types import Levels
dpsf = Filter.DeconvolvePSF(num_iter=15, sigma=2, level_method=Levels.SCALE_SATURATED_BY_CHUNK, is_volume=vol)
dpsf.run(imgs, verbose=True, in_place=True)*
print("Deconvolved")

glp = Filter.GaussianLowPass(sigma=1, is_volume=vol)
glp.run(imgs, in_place=True, verbose=True)
print("low passed")

Error occurs at *

Expected Results

10%|█ | 5/48 [00:00<00:01, 36.92it/s]Images loaded
<starfish.ImageStack (r: 8, c: 2, z: 3, y: 2048, x: 2048)>
100%|██████████| 48/48 [00:00<00:00, 79.02it/s]
Images warped
100%|██████████| 16/16 [00:00<00:00, 1336.78it/s]
High passed
100%|██████████| 16/16 [00:00<00:00, 3007.70it/s]
Deconvolved
100%|██████████| 16/16 [00:00<00:00, 1458.32it/s]
low passed

Actual Results

10%|█ | 5/48 [00:00<00:01, 36.92it/s]Images loaded
<starfish.ImageStack (r: 8, c: 2, z: 3, y: 2048, x: 2048)>
100%|██████████| 48/48 [00:00<00:00, 79.02it/s]
Images warped
100%|██████████| 16/16 [00:00<00:00, 1336.78it/s]
High passed
100%|██████████| 16/16 [00:00<00:00, 1145.81it/s]
File "\20201020_starfish_workflow_3_errorid_z_norm.py", line 1233, in
dpsf.run(imgs, verbose=True, in_place=True)

File "starfish\core\pipeline\algorithmbase.py", line 23, in helper
result = func(*args, **kwargs)

File "starfish\core\image\Filter\richardson_lucy_deconvolution.py", line 210, in run
level_method=self.level_method,

File "starfish\core\imagestack\imagestack.py", line 862, in apply
**kwargs)

File "starfish\core\imagestack\imagestack.py", line 949, in transform
return list(zip(results, selectors))

File "concurrent\futures_base.py", line 598, in result_iterator
yield fs.pop().result()

File "concurrent\futures_base.py", line 435, in result
return self.__get_result()

File "concurrent\futures_base.py", line 384, in __get_result
raise self._exception

File "concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)

File "starfish\core\imagestack\imagestack.py", line 964, in _processing_workflow
return worker_callable(sliced, *args, **kwargs) # type: ignore

File "starfish\core\imagestack\imagestack.py", line 880, in _in_place_apply
result = apply_func(data, *args, **kwargs)

File "starfish\core\image\Filter\richardson_lucy_deconvolution.py", line 158, in _richardson_lucy_deconv
x = convolve_method(im_deconv, psf, 'same')

File "scipy\signal\signaltools.py", line 525, in fftconvolve
raise ValueError("in1 and in2 should have the same dimensionality")

ValueError: in1 and in2 should have the same dimensionality

Versions

Windows-10-10.0.19041-SP0
Python 3.7.6 | packaged by conda-forge | (default, Jun 1 2020, 18:11:50) [MSC v.1916 64 bit (AMD64)]
NumPy 1.19.0
SciPy 1.5.1
scikit-image 0.15.0
pandas 1.0.5
sklearn 0.23.1
xarray 0.16.0
sympy 1.6.1
starfish 0.2.1

@aschrader5 aschrader5 added the bug An issue with an existing feature label Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant