Ticket #472 (closed task: fixed)

Opened 8 years ago

Last modified 8 years ago

Test and improve legacy layer

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: biweekly-2011: Apr-25 to May-06
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

If image translation can be handled by an up conversion (12-bit to 16-bit for example) then copy data by value and copy results back on return. The copy on return would have to range clamp as needed.

If image translation can only happen as a down conversion (64-bit long to 16-bit short) then fail gracefully. Eventually prompt user that they indeed want to narrow the type and if so narrow it, send it to IJ, and widen it upon return.

Write unit tests to ensure these things are working.

Change History

comment:1 Changed 8 years ago by bdezonia

  • Status changed from new to accepted

Wrote unit tests (RGBImageTranslatorTest and GrayscaleImageTranslatorTest) to verify current functionality is robust. Expanded translation capabilities to track some of the metadata. Improved RGBImageTranslator to accept many more kinds of isRGBMerged() Datasets (axis order unimportant) when going to IJ1.

comment:2 Changed 8 years ago by bdezonia

Further discussions with Curtis.

1) make sure the ImageTranslator implementations disallow translation when data contains an unexepected index (already done for RgbImageTranslator I think)

2) right now we throw exceptions if a given Img is not planar in preparation for translation to legacy images (is this in LegacyImageMap?). we need to be able to work with copies when possible and hatch copies for nonplanar Imgs.

3) need to smartly reuse Datasets rather than always creating new Datasets. Instead optimize by generating "data change" or "structure change" events as needed and transform the exisitng Dataset to match the one returned by the ImageTranslator. Perhaps I am not totally clear on what needs to be done here.

4) In the nonplanar Dataset case Dataset::getPlane() should reason about the underlying data type and hatch a primitive array of data that can be used by the ImageTranslators. Gathers data using a Cursor. Need to decide what a plane of 1-bit and 12-bit data should be. Note that type reasoning can be done for NativeType backed data. What do we do if the type is not a NativeType?

comment:3 Changed 8 years ago by bdezonia

Made Dataset::getPlane() create a data copy of the desired plane if the internal storage is not a planar data structure containing primitive arrays. In the case of data types that cannot be represented by primitive arrays (such as 1-bit and 12-bit) an exception is thrown.

comment:4 Changed 8 years ago by bdezonia

Note that in summary:
1) done
4) done with exceptions thrown as needed. Nothing decides whether an imglib type is a NativeType. Rather we reason about bitdepth/sign/integer and encode into primitives as needed. Maybe this is not typesafe.

2) and 3) need to be worked on

comment:5 Changed 8 years ago by bdezonia

4) completed implementation of nonplanar case of getPlane() using pure Imglib code. No more type reasoning used. This should support all types backed by NativeType. Done.

2) and 3) left to do

comment:6 Changed 8 years ago by bdezonia

3) added code to LegacyImageMap that updates existing Datasets when needed. Changes to Metadata, Dataset shape, and other data changes are pulled from the ImagePlus and pushed into the Dataset. Dataset events (rebuilds and updates) are generated as needed.

2) can't find where we throw exception for nonplanar dataset. not yet sure where to start

comment:7 Changed 8 years ago by bdezonia

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

2) pretty sure I understand what needed to be done here. completed

Ticket closed.

comment:8 Changed 8 years ago by bdezonia

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Milestone changed from imagej-2.0-alpha3 to biweekly-2011: Apr-25 to May-06

comment:9 Changed 8 years ago by bdezonia

Forgot I need to hatch unit tests.

comment:10 Changed 8 years ago by bdezonia

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

unit tests done. ticket complete.

Note: See TracTickets for help on using tickets.