Closed haoxusci closed 2 years ago
I think the tests are passing, which does exercise registration. Do you have a full stacktrace?
I think the tests are passing, which does exercise registration. Do you have a full stacktrace?
I got the error when I run the quick-start tutorial--the function of def register(imgs, dots, method = 'translation')
https://spacetx-starfish.readthedocs.io/en/latest/gallery/quick_start/plot_quick_start.html#quick-start
AttributeError Traceback (most recent call last)
<ipython-input-13-19514b63df4a> in <module>
----> 1 register(imgs, dots, method = 'translation')
<ipython-input-12-c6bc49a02aa3> in register(imgs, dots, method)
6 mip_dots = dots.reduce(dims = [Axes.CH, Axes.ZPLANE], func="max")
7 learn_translation = LearnTransform.Translation(reference_stack=mip_dots, axes=Axes.ROUND, upsampling=1000)
----> 8 transforms_list = learn_translation.run(mip_imgs)
9 warp = ApplyTransform.Warp()
10 registered_imgs = warp.run(imgs, transforms_list=transforms_list, in_place=False, verbose=True)
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/starfish/core/pipeline/algorithmbase.py in helper(*args, **kwargs)
21 @functools.wraps(func)
22 def helper(*args, **kwargs):
---> 23 result = func(*args, **kwargs)
24 if result is not None:
25 method_class_str = str(args[0].__class__)
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/starfish/core/image/_registration/LearnTransform/translation.py in run(self, stack, verbose, *args)
66 shift, error, phasediff = register_translation(src_image=target_image,
67 target_image=reference_image,
---> 68 upsample_factor=self.upsampling)
69 if verbose:
70 print(f"For {self.axes}: {a}, Shift: {shift}, Error: {error}")
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/skimage/_shared/utils.py in wrapped(*args, **kwargs)
203 elif self.behavior == 'raise':
204 raise skimage_deprecation(msg)
--> 205 return func(*args, **kwargs)
206
207 # modify doc string to display deprecation warning
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/skimage/feature/__init__.py in register_translation(src_image, target_image, upsample_factor, space, return_error)
49 return phase_cross_correlation(src_image, target_image,
50 upsample_factor=upsample_factor,
---> 51 space=space, return_error=return_error)
52
53
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/skimage/registration/_phase_cross_correlation.py in phase_cross_correlation(reference_image, moving_image, upsample_factor, space, return_error, reference_mask, moving_mask, overlap_ratio)
202 # real data needs to be fft'd.
203 elif space.lower() == 'real':
--> 204 src_freq = fft.fftn(reference_image)
205 target_freq = fft.fftn(moving_image)
206 else:
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/scipy/fft/_backend.py in __ua_function__(method, args, kwargs)
21 if fn is None:
22 return NotImplemented
---> 23 return fn(*args, **kwargs)
24
25
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/scipy/fft/_pocketfft/basic.py in c2cn(forward, x, s, axes, norm, overwrite_x, workers, plan)
178 raise NotImplementedError('Passing a precomputed plan is not yet '
179 'supported by scipy.fft functions')
--> 180 tmp = _asfarray(x)
181
182 shape, axes = _init_nd_shape_and_axes(tmp, s, axes)
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/scipy/fft/_pocketfft/helper.py in _asfarray(x)
95 dtype = x.dtype.newbyteorder('=')
96 # Always align input
---> 97 copy = not x.flags['ALIGNED']
98 return np.array(x, dtype=dtype, copy=copy)
99
~/opt/miniconda3/envs/starfish/lib/python3.7/site-packages/xarray/core/common.py in __getattr__(self, name)
238 return source[name]
239 raise AttributeError(
--> 240 "{!r} object has no attribute {!r}".format(type(self).__name__, name)
241 )
242
AttributeError: 'DataArray' object has no attribute 'flags'
Ahh! The reason the tests did not catch this is because scikit-image 0.18.x was not released for python3.6.
Ahh! The reason the tests did not catch this is because scikit-image 0.18.x was not released for python3.6.
Great. Thanks for answering that. That makes sense. Feel free to close the PR then.
scikit-image version 0.18.0 and 0.18.1 doesn't work. For example, if you run
register(imgs, dots, method = 'translation')
, it will throw errorAttributeError: 'DataArray' object has no attribute 'flags'