Skip to content

ImageJ plugin: >8 bit data in a virtual stack cannot be projected #4422

@melissalinkert

Description

@melissalinkert

See discussion in https://forum.image.sc/t/getting-exceptions-when-using-image-stacks-3d-project/119891.

The test steps are:

  • open a file with Plugins > Bio-Formats > Bio-Formats Importer
  • select Use virtual stack
  • select Image > Stacks > 3D Project..., and click OK

If the original image is 8 bit, then this just works without error. If the original image is 16+ bit though, then an exception like this is expected:

java.lang.ClassCastException: class [S cannot be cast to class [B ([S and [B are in module java.base of loader 'bootstrap')
at ij.plugin.Projector.doOneProjectionY(Projector.java:622)
at ij.plugin.Projector.doProjections(Projector.java:396)
at ij.plugin.Projector.run(Projector.java:98)
at ij.IJ.runPlugIn(IJ.java:216)
at ij.Executer.runCommand(Executer.java:152)
at ij.Executer.run(Executer.java:70)
at java.base/java.lang.Thread.run(Thread.java:1583)

It looks like for some reason the virtual stack properties don't cause the 8-bit conversion to happen within the Projector plugin:

https://github.com/imagej/ImageJ/blob/master/ij/plugin/Projector.java#L276

It might be that VirtualImagePlus just needs to override getBitDepth():

https://github.com/imagej/ImageJ/blob/master/ij/ImagePlus.java#L1376

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