Skip to content

Error on read_image: IoError(Custom { kind: InvalidData, error: InvalidCode }) #266

Open
@SauvageThomas

Description

@SauvageThomas

Hi,

I'm trying to decode a tiff file and it fails at reading the first image with the folllowing error Error: IoError(Custom { kind: InvalidData, error: InvalidCode })

Here is the reproductible code:

pub fn read_tiff(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
    let file = File::open(path)?;
    let mut decoder = Decoder::new(BufReader::new(file))?;

    while decoder.more_images() {
        println!("New Image colortype: {:?}, dimensions: {:?}", decoder.colortype()?, decoder.dimensions()?);
        decoder.next_image()?;
        let res = decoder.read_image()?;
    }

    Ok(())
}

The image format is a qpi tiff, I've tried to read a smaller qpi image and it works. The difference is that the image that works is not pyramidal, while this one is pyramidal.
The image is 5604x4200 with 3 levels of pyramids with f32 type and I'm able to read/open it using other tools.

Here is the image https://downloads.openmicroscopy.org/images/Vectra-QPTIFF/perkinelmer/PKI_fields/LuCa-7color_%5B17572%2C60173%5D_3x3component_data.tif

Is this image not supported or is there something wrong with my code ?

EDIT: I investigated a bit more, it seems that there is 99 tiles in the image, they all can be read, except for the chunk 61 (the following are ok). I tried to debug it more but I'm kinda lost.

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