NOTICE! This is a static HTML version of a legacy LOCI Software ticket.

LOCI projects are now located on GitHub. The Bio-Formats project can be found here.

Ticket #195 (closed defect: fixed)

Opened 2007-10-10T17:23:29-05:00

Last modified 2007-10-11T14:31:36-05:00

Cannot construct 2-channel images with ImageTools

Reported by: curtis Owned by: melissa
Priority: major Milestone:
Component: bio-formats Severity:
Keywords: Cc:
Blocked By: Blocking:

Description

Currently, ImageTools throws an exception when you attempt to create a two-channel image (blank or not). For example, both of the following calls fail with an exception.

ImageTools.blankImage(400, 300, 2, FormatTools.UINT8);
ImageTools.makeImage(new byte[2][400 * 300], 400, 300);

The problem is essentially that the sRGB color space requires three color components. One possible solution might be to use the grayscale color space with an alpha channel, but that's a pretty lame hack. Alternately, we could figure out how to construct our own color space (though my initial efforts to do so failed). Or maybe there is an easier workaround to the problem. At the least, if we cannot find a solution, we should throw IllegalArgumentException within ImageTools if a channel count of two is given as a parameter directly or indirectly.

Change History

comment:1 Changed 2007-10-11T14:31:36-05:00 by melissa

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r3267. Solution was to add new 2-component ColorSpace (loci.formats.TwoChannelColorSpace).