-
Notifications
You must be signed in to change notification settings - Fork 0
Worker development
m3art edited this page Apr 30, 2012
·
1 revision
As many modern frameworks also Fresco is composed from three main parts.
- Core- run workers, holds data, process results of workers. Core should offer images and their common GUI representations (previews/icons/color conversions/zoom)
- GUI- graphical user interface - buttons, menus, panels, ... GUI should render images, solve user actions
- Workers- image processing algorithms. Workers are the main part of Fresco. Worker is an single threaded algorithm processing some images. Images are obtained from core, output of worker is also managed by core. Worker should report progress to GUI.
Few points on how to develop own worker:
- Selection of package - Workers are of several types an according to type they are split into packages: ** workers.analyse - Algorithms which analyze images - edge detecotrs, difference matrices, pattern analysers ** workers.correction - Simple algorithms for smoothing, denoising, normalization ** workers.morphology - Algorithms working with segmented images ** workers.registration - Registration of images - different types of rigid or local transformation algorithms ** workers.segmentation - Segmentation of images to ”uniform” areas. Worker must extend the workers.CImageWorker class and implement its abstract methods.
- User action registration - In the fresco.action.IAction.RegID enum, it is necessary to register a new worker - add its ID to the enum values into the correct category.
- Menu item creation - Menus are created in the fresco.swing.CMenuBar class. Add a new CMenuItem(“desired menu item label”, worker ID) to the corresponding part of the menu creation process. If your worker requires any input data to properly function, such as one/two loaded input images or a specific number of registration marks, please add this condition to the checkEnable method, use [workerID].setEnable(true/false)
- Running your worker: Now that the menu item is created, we must define the associated action. When a user clicks on the item, the fresco.action.CUserActionListener.CUserAction method is run. Usually, it will be enough to add the new worker ID to the end of the large switch..case statement inside, but should you require a more specific initialization, see the invocation of other workers in this switch..case statement. Also, you can handle exceptions from runImageWorker here. The initialization of your worker is then performed through the runImageWorker method, which calls CImageWorker.createWorker, this method will usually passes your input etc.NOTE: images are ordered as follows: [0, first input],[1, output],[2,second]
- Worker running task - After menu is created and user click on it, method fresco.action.CUserActionListener.CUserAction is called. In this method can be handled exceptions from basic call of runImageWorker schema. Typically is sufficient to add RegID of our new worker at the and of switch. When worker is enabled this way, its creation must be defined. This is done in CImageWorker class in factory method createImageWorker. For our new RegID we want to create our new Worker. NOTE: images are ordered [0, first input],[1, output],[2,second input]. See other worker creations for details.
- Worker output handling - If worker requires any special handling of its output (typically output is not an image), special behavior can be defined in method fresco.action.CActionManager#cleanImageWorker which is called immediately after worker finish.
This process generates a menu item which runs your worker and puts the output of your worker typically into an output panel.
- There are a lot of know bugs (more than developers can fix) in the fresco application. We apologize for that. If you want to fix any of them, write to us at blazek@utia.cas.cz and be a collaborator.