Skip to content

"free(): invalid size" crash trying to call CziFile.read_mosaic() #70

@markemus

Description

@markemus

I'm trying to read a mosaic czi file but it crashes consistently when I call img.read_mosaic(). img.read_image() works, but returns a stack of (overlapping?) mosaic tiles so I would prefer to get read_mosaic working.

import aicspylibczi as acz
  ...: 
  ...: import numpy as np
  ...: import matplotlib.pyplot as plt
  ...: 
  ...: 
  ...: path = "/home/markemus/data/dev/Zeiss/2020_11_22__17_01__0165.czi"
  ...: img = acz.CziFile(path)
  ...: print(img.dims)
  ...: print(img.dims_shape())
  ...: y = img.read_mosaic(C=0)
  ...: 

results:

SCMYX
[{'X': (0, 1600), 'Y': (0, 1200), 'C': (0, 1), 'M': (0, 2203), 'S': (0, 1)}]
free(): invalid size

I tried specifying S=0, but the program told me that S is not used for mosaic images.
I tried again reading only a subregion:

y = img.read_mosaic(region=(100,100,100,100), C=0)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-6-ef2c2c78f23d>", line 1, in <module>
    y = img.read_mosaic(region=(100,100,100,100), C=0)
  File "/home/markemus/.local/lib/python3.6/site-packages/aicspylibczi/CziFile.py", line 458, in read_mosaic
    img = self.reader.read_mosaic(plane_constraints, scale_factor, region)
_aicspylibczi.PylibCZI_RegionSelectionException: Requirement violated requested region is not a subset of the defined image! 
	 (100,100,100,100) ⊄ (-162802,9720,93906,55354)
	Requested region not in image!

This looks like an integer overflow problem? I searched previous issues but couldn't find anyone who had this before. Is there a bug or am I doing something incorrect?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions