JaneliaSciComp / bigstream

Tools for distributed alignment of massive images
BSD 3-Clause "New" or "Revised" License
74 stars 21 forks source link

Local affine aligments #11

Closed IamJuanHilario closed 1 year ago

IamJuanHilario commented 2 years ago

I am trying to run the tutorial, however I get these errors which I cannot find a way to solve them. I would sincerely appreciate any help. I am using the values and blocksize that were provided with the tutorial


ValueError Traceback (most recent call last) Input In [21], in <cell line: 3>() 1 # Note use of mov_lowres_aligned as moving image rather than mov_lowres_data 2 # Note also that fix_lowres_spacing is used as the "moving" voxel spacing here ----> 3 local_affines = affine.prepare_piecewise_ransac_affine( 4 fix_lowres_data, mov_lowres_aligned, 5 fix_lowres_spacing, fix_lowres_spacing, 6 min_radius=6, max_radius=20, match_threshold=0.75, 7 blocksize=[128,]*3, 8 ) 11 # not a numpy array 12 print(type(local_affines))

File ~/envsternson/lib/python3.8/site-packages/bigstream/affine.py:111, in prepare_piecewise_ransac_affine(fix, mov, fix_spacing, mov_spacing, min_radius, max_radius, match_threshold, blocksize, **kwargs) 109 # wrap images as dask arrays 110 fix_da = da.from_array(fix, chunks=blocksize) --> 111 mov_da = da.from_array(mov, chunks=blocksize) 113 # wrap affine function 114 def wrapped_ransac_affine(x, y, block_info=None): 115 116 # compute affine

File ~/envsternson/lib/python3.8/site-packages/dask/array/core.py:3335, in from_array(x, chunks, name, lock, asarray, fancy, getitem, meta, inline_array) 3189 """Create dask array from something that looks like an array. 3190 3191 Input must have a .shape, .ndim, .dtype and support numpy-style slicing. (...) 3332 >>> a = da.from_array(x, chunks=((67, 33), (6,))) 3333 """ 3334 if isinstance(x, Array): -> 3335 raise ValueError( 3336 "Array is already a dask array. Use 'asarray' or " "'rechunk' instead." 3337 ) 3338 elif is_dask_collection(x): 3339 warnings.warn( 3340 "Passing an object to dask.array.from_array which is already a " 3341 "Dask collection. This can lead to unexpected behavior." 3342 )

ValueError: Array is already a dask array. Use 'asarray' or 'rechunk' instead.

GFleishman commented 1 year ago

Hi - thanks for trying bigstream. I'm sorry to have never gotten to this issue to help you last year. I am not only the developer of bigstream, I also use it every day to process a constant stream of incoming new datasets. It has been hard to find time to support external users, but I am making some extra time for it this year.

Bigstream has changed a lot since you posted this issue and the code which was giving you an error has been considerably refactored. So I'm going to close this issue for now. I hope you'll give bigstream another try if you have data for it, and I will be more able to help if so.