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

index out of range in vsi2tif and bftools #39

Open
mssher07 opened this issue Jan 11, 2025 · 1 comment
Open

index out of range in vsi2tif and bftools #39

mssher07 opened this issue Jan 11, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@mssher07
Copy link

Hello. I'm deep in the weeds trying to extract .vsi to .tif. The .vsi images are ~12-15 ROIs acquired on a VS200 olympus that cover the majority of a slide; but each ROI (at full res) is about 15k x 15k pixels. I need to do image registration for multi-round microscopy, so I just want to extract the highest resolution image in each ROI; but, would be fine if all of them are extracted and I can parse through to grab the ones I want.

Got vsi2tif installed along with a java sdk, here's my call in a jupyterlab cell:

path_to_vsi='H:/Folder_20241210/Image.vsi'
path_to_tif='H:/Folder_20241210/Image.tif'

!vsi2tif -i H:/Folder_20241210/Image.vsi -o H:/Folder_20241210/Image.tif -b [my_path]/bftools/bfconvert -v 0

Error:

INFO:root:Performing single conversion...
ERROR:root:Command failed with error: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 16 out of bounds for length 16
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
	at java.base/java.util.Objects.checkIndex(Objects.java:365)
	at java.base/java.util.ArrayList.get(ArrayList.java:428)
	at loci.formats.in.CellSensReader.parseETSFile(CellSensReader.java:1105)
	at loci.formats.in.CellSensReader.initFile(CellSensReader.java:668)
	at loci.formats.FormatReader.setId(FormatReader.java:1397)
	at loci.formats.ImageReader.setId(ImageReader.java:839)
	at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:385)
	at loci.formats.tools.ImageConverter.main(ImageConverter.java:884)

ERROR:root:Failed to convert BigTIFF to tiled, pyramidal TIFF. Skipping image: H:/Folder_20241210/Image.vsi
ERROR:root:Input file not found at: C:\Users\MSS\AppData\Local\Temp\tmptqgu3_ia\temporary.btf
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\python\envs\vsi_to_tif\Scripts\vsi2tif.exe\__main__.py", line 7, in <module>
  File "C:\python\envs\vsi_to_tif\Lib\site-packages\vsi2tif\vsi2tif.py", line 68, in main
    cellsens2tif_single(
  File "C:\python\envs\vsi_to_tif\Lib\site-packages\vsi2tif\src\benchmark.py", line 9, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "C:\python\envs\vsi_to_tif\Lib\site-packages\vsi2tif\src\process.py", line 52, in cellsens2tif_single
    cellsens2tif(input_path, output_path, bfconvert, compression, tz, plane, quality, max_mem, verbose)
  File "C:\python\envs\vsi_to_tif\Lib\site-packages\vsi2tif\src\convert.py", line 78, in cellsens2tif
    raise e
  File "C:\python\envs\vsi_to_tif\Lib\site-packages\vsi2tif\src\convert.py", line 74, in cellsens2tif
    raw2tif(bigtiff_path, output_path, compression, quality, verbose)
  File "C:\python\envs\vsi_to_tif\Lib\site-packages\vsi2tif\src\convert.py", line 35, in raw2tif
    raise FileNotFoundError(f"Input file not found at: {input_path}")
FileNotFoundError: Input file not found at: C:\Users\MSS\AppData\Local\Temp\tmptqgu3_ia\temporary.btf

I figured I'd try bftools directly, very similar error. With no arguments flags, just the i/o:

CellSensReader initializing H:/Folder_20241210/Image.vsi
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 16 out of bounds for length 16
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
        at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
        at java.base/java.util.Objects.checkIndex(Objects.java:365)
        at java.base/java.util.ArrayList.get(ArrayList.java:428)
        at loci.formats.in.CellSensReader.parseETSFile(CellSensReader.java:1105)
        at loci.formats.in.CellSensReader.initFile(CellSensReader.java:668)
        at loci.formats.FormatReader.setId(FormatReader.java:1397)
        at loci.formats.ImageReader.setId(ImageReader.java:839)
        at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:385)
        at loci.formats.tools.ImageConverter.main(ImageConverter.java:884)

Suggestions?

@mssher07 mssher07 changed the title out of index in bftools index out of range in vsi2tif and bftools Jan 11, 2025
@andreped
Copy link
Owner

Hello, @mssher07 :]

This seems to be an issue in bfconvert. Thus, it should be resolved in the bioformats repo. I would open a ticket here instead. Then you can refer to this issue there, such that when it gets resolved, we could potentially add this fix to vsi2tif as well.

@andreped andreped added the bug Something isn't working label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants