Ticket #1945 (closed defect: moved)
Opened 2013-07-12T10:10:31-05:00
Last modified 2013-07-29T11:13:11-05:00
Add infrastructure for typed dataset plugins
Reported by: | bdezonia | Owned by: | bdezonia |
---|---|---|---|
Priority: | major | Milestone: | imagej2-b8-analysis |
Component: | Plugin Framework | Version: | |
Severity: | serious | Keywords: | |
Cc: | curtis | Blocked By: | |
Blocking: | #1519 |
Description
It would be nice if we provided a template class for designing plugins that only work with certain types of Datasets. For instance the user might make a plugin that only works with unsigned byte type data. (This is similar to IJ1's DOES_RGB, DOES_ALL, etc.) We need to provide ways to get the type of a Dataset for checking. If we could make the template class check parameters at init time (and not when run() is called) that would be great. This would simplify plugin developers lives.
However a template class approach may be too limiting in that we really need multiple inheritance to cover the flexibility of our other plugin base class implementations. So maybe instead we provide interfaces and helper methods.
Another possibility is to have all plugins have a precheck() method with current abstract base classes providing empty ones. And plugin developers could provide their own implementation. The precheck would happen after @Parameters assignment and maybe after initializers were run but before run() is ever called.
One approach Curtis mentioned is to add annotations to an @Parameter and have the input harvester (?) do the type checking. He thought this was clunky but maybe we should keep this in mind.
(Note that some typed conversion code is now present in the DefaultDatasetService of the data-types branch. This could be used in the case where the plugin checks in the run() method and aborts if needed)
Change History
comment:1 Changed 2013-07-19T15:18:27-05:00 by bdezonia
comment:2 Changed 2013-07-29T11:13:11-05:00 by bdezonia
The TypedDataset approach was eliminated in favor of an ImgPlusService that is merged to master. See commit be9c777fcec78e992b6a15585acdd6b04be754e0
comment:3 Changed 2014-05-01T05:38:43-05:00 by curtis
- Status changed from new to closed
- Resolution set to moved
Migrated to https://github.com/imagej/imagej-common/issues/1
In regards to the parenthetical comment at the end of the description: recently I also made a TypedDataset class with constructors on the data-types branch. If merged to master it could be used instead of the DefaultDatasetService code.