NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #2007 (closed enhancement: moved)

Opened 2013-10-02T11:22:19-05:00

Last modified 2013-10-02T11:22:55-05:00

Make TypeChanger non-dynamic, and use DataTypeService

Reported by: curtis Owned by: bdezonia
Priority: major Milestone: imagej2-b8-analysis
Component: Data Model Version:
Severity: serious Keywords:
Cc: Blocked By:

Description (last modified by curtis)

The TypeChanger class is currently a DynamicCommand but does not need to be. It has a private String typeName parameter with an initializer that asks the DataTypeService for its list of instances. But the module framework takes care of this automatically now: just change the parameter to private DataType type and the available singletons will be automatically used in a multiple choice (via the ObjectWidget). See ImageCalculator and Threshold for working examples.

There is also a large amount of code embedded in the command, which should be factored out to one or more methods of DataTypeService instead. Then the TypeChanger command itself becomes very simple, merely delegating to DataTypeService to perform the actual type change. This is the preferred ImageJ2 design pattern so that the type change operation is available to other code directly from a @Parameter DataTypeService dataTypeService field, instead of needing to explicitly construct and invoke a TypeChanger command instance.

Change History

comment:1 Changed 2013-10-02T11:22:55-05:00 by curtis

  • Description modified

comment:2 Changed 2014-07-19T23:02:20-05:00 by curtis

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