Frederic Marion-Poll June 27, 2019 at 10:20 am
I would like to change the way a sequence is displayed by modifying the Viewer. I seem to remember that the best way is to subclass Canvas. Is there an example of it? More specifically, I would like to know how to “attach” a canvas to a sequence and thus to replace the standard canvas.
I would like to change the way specific sequences are displayed for example by adding a combobox or a text box to change how a stack is browsed, and eventually to add textual information.
fredStephane Dallongeville July 1, 2019 at 12:20 pm
You indeed need to override the Canvas class (and more specifically Canvas2D here). There is several plugins doing that as Channel Montage
You can try to look at the sources of this plugin to see how we can do that but to be honest this is something really easy to do (the base Canvas class in Icy is too complex).
– StephaneFrederic Marion-Poll July 1, 2019 at 9:12 pm
Thank you so much, Stephane!Frederic Marion-Poll July 2, 2019 at 11:08 am
Had a look at this example, which is quite interesting. If I understand correctly, it is a plugin which will change the behavior of all views.
2 more questions:
(1) Is it possible to derive a Canvas2D which will be used only by a specific class of Sequence (in my case for example, I work with a class derived from Sequence that I called “SequencePlus”). Where can I declare that SequencePlus is “associated” with my own class of Canvas2D?
(2) where is the best place to introduce a text label to define the size of a step to browse through a pile of images? Canvas2D? Viewer? I would like to adjust the interval between consecutive images. Right now, it is “1”, but I would like to change it to 3, 5, 10, 30, etc..Stephane Dallongeville July 2, 2019 at 1:50 pm
Yeah the idea is that you can add new Canvas from plugin. In you want to handle specific format of Sequence then you may detect them using if (sequence instanceof myClass) and enable special feature / view when that is the case otherwise they stay grayed.
About you text label, well you have the choice, you can extends / customize the default setting panel from Canvas2D (called panel in the Canvas2D class, it’s protected so you can access it) in which case your text label will appears in the inspector (where we have the minimap view of the image). Or you can also override the customizeToolbar(JToolBar toolBar) method from Canvas2D (you can see how it’s done in Canvas2D class to add a specific button) so it will directly appear just above the view (which may be easier to set it up).
– StephaneFrederic Marion-Poll July 2, 2019 at 1:52 pm
Thank you so much again, Stephane!
- This reply was modified 3 years, 9 months ago by Frederic Marion-Poll.
The forum ‘Development’ is closed to new topics and replies.