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

ASHLAR registers tiles as cycles/fileseries not working #197

Open
FaehlingT opened this issue Aug 10, 2023 · 2 comments
Open

ASHLAR registers tiles as cycles/fileseries not working #197

FaehlingT opened this issue Aug 10, 2023 · 2 comments

Comments

@FaehlingT
Copy link

FaehlingT commented Aug 10, 2023

Hi guys,
I am using ashlar to read two .ome.tiff images with 18 channels each that are two tiles of a bigger image. Unfortunately, ASHLAR initially added the images on top of each other, creating one image with 36 channels (18 channels x 2 cycles).
When I used the fileseries command: ashlar 'fileseries|/folderpath|pattern=tile{series:2}.ome.tiff|width=2|height=1|pixel_size=0.182|overlap=0.02' --output-channels 15 I got the following error:
aligning edge 1/1Traceback (most recent call last):
File "/home/t141g/.local/lib/python3.9/site-packages/ashlar/reg.py", line 674, in register_pair
shift, error = self._cache[key]
KeyError: (0, 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/xxxxx/.local/bin/ashlar", line 8, in
sys.exit(main())
File "/home/xxxxx/.local/lib/python3.9/site-packages/ashlar/scripts/ashlar.py", line 212, in main
return process_single(
File "/home/xxxxx/.local/lib/python3.9/site-packages/ashlar/scripts/ashlar.py", line 243, in process_single
edge_aligner.run()
File "/home/xxxxx/.local/lib/python3.9/site-packages/ashlar/reg.py", line 485, in run
self.register_all()
File "/home/xxxxx/.local/lib/python3.9/site-packages/ashlar/reg.py", line 596, in register_all
self.register_pair(t1, t2)
File "/home/xxxxx/.local/lib/python3.9/site-packages/ashlar/reg.py", line 697, in register_pair
error = utils.nccw(o1, o2, self.filter_sigma)
File "/home/xxxxx/.local/lib/python3.9/site-packages/ashlar/utils.py", line 55, in nccw
correlation = np.abs(np.sum(img1w * img2w))
ValueError: operands could not be broadcast together with shapes (2976,109) (3695,109)
I don't really get the problem her, is there somebody who could help?
Thank you!

@FaehlingT FaehlingT reopened this Aug 10, 2023
@FaehlingT FaehlingT changed the title ASHLAR registers tiles as cycles ASHLAR registers tiles as cycles/dileseries not working Aug 10, 2023
@FaehlingT FaehlingT changed the title ASHLAR registers tiles as cycles/dileseries not working ASHLAR registers tiles as cycles/fileseries not working Aug 10, 2023
@jmuhlich
Copy link
Collaborator

Sorry for the late response, but did you figure this out? Your command line looks OK if your files are named tile00.ome.tif and tile01.ome.tif. Very small tilesets like this do sometimes fail with unhelpful error messages, but I think I've fixed this in the master branch. I plan to make an official release soon including this fix, but you could try installing directly from github and see how it works. Also, in the current master branch, the included preview_slide tool now supports fileseries so you could use that to make sure ashlar is interpreting your inputs as you expect.

@FaehlingT
Copy link
Author

Hi,
I figured it out, by setting maximum shift to ≤4 µm it worked.
However, when using the same command on another fileseries with 19 channels, ashlar fails at the process of saving the pyramid when I have it save all channels. When I limit it to ≤18 channels, it works (regardless of the channel I omit). It shows the following error message:

...
Channel 18:
    merging tile 35/35
Generating pyramid
  Level 1 (12788 x 15437)
<tifffile.TiffPages @16> invalid page offset 3250604960
    processing channel 3/19Traceback (most recent call last):
 File “/home/xx/.local/bin/ashlar”, line 8, in <module>
  sys.exit(main())
 File “/home/xx/.local/lib/python3.9/site-packages/ashlar/scripts/ashlar.py”, line 212, in main
  return process_single(
 File “/home/xx/.local/lib/python3.9/site-packages/ashlar/scripts/ashlar.py”, line 277, in process_single
  writer.run()
 File “/home/xx/.local/lib/python3.9/site-packages/ashlar/reg.py”, line 1247, in run
  tiff.write(
 File “/home/xx/.local/lib/python3.9/site-packages/tifffile/tifffile.py”, line 3337, in write
  iteritem = next(dataiter)
 File “/home/xx/.local/lib/python3.9/site-packages/tifffile/tifffile.py”, line 22910, in newiter
  yield from iterator
 File “/home/xx/.local/lib/python3.9/site-packages/ashlar/reg.py”, line 1206, in subres_tiles
  a = zimg[c, y:y+th, x:x+tw, 0]
 File “/home/xx/.local/lib/python3.9/site-packages/zarr/core.py”, line 842, in __getitem__
  result = self.get_orthogonal_selection(pure_selection, fields=fields)
 File “/home/xx/.local/lib/python3.9/site-packages/zarr/core.py”, line 1122, in get_orthogonal_selection
  indexer = OrthogonalIndexer(selection, self)
 File “/home/xx/.local/lib/python3.9/site-packages/zarr/indexing.py”, line 617, in __init__
  dim_indexer = IntDimIndexer(dim_sel, dim_len, dim_chunk_len)
 File “/home/xx/.local/lib/python3.9/site-packages/zarr/indexing.py”, line 150, in __init__
  dim_sel = normalize_integer_selection(dim_sel, dim_len)
 File “/home/xx/.local/lib/python3.9/site-packages/zarr/indexing.py”, line 124, in normalize_integer_selection
  raise BoundsCheckError(dim_len)
zarr.errors.BoundsCheckError: index out of bounds for dimension with length 2

@FaehlingT FaehlingT reopened this Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants