Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TypeChanger non-dynamic, and use DataTypeService #9

Open
ctrueden opened this issue Jul 20, 2014 · 0 comments
Open

Make TypeChanger non-dynamic, and use DataTypeService #9

ctrueden opened this issue Jul 20, 2014 · 0 comments

Comments

@ctrueden
Copy link
Member

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.

Migrated-From: http://trac.imagej.net/ticket/2007

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant