text accelerated color palette

Post questions on how to use or achieve an effect in Inkscape.
a.janke
Posts: 6
Joined: Sat Aug 30, 2008 8:42 pm

text accelerated color palette

Postby a.janke » Wed Mar 16, 2011 3:18 pm

Hi all,

background: I work in medical imaging, one of the things we use inkscape for is colouring/tracing histology via wacom tablets. I create the inkscape files using perl scripts (images + SVG overlays) that are then traced by people who know about histology.

In our current (rather ambitious) project we are attempting to identify all 1025 structures in 160 odd histological sections of mouse brain. I have created a custom .gpl palette for this but the problem is now finding an efficient method of selecting them (by name). All 1025 structures have short abbreviations which are known to the tracers.

So, is there a palette tool/dialog for inkscape in which you can select a predefined fill color quickly via the keyboard? Ideally this same palette chooser would also store the most recently used colors at the top and also display the color names. I am not adverse to writing an extension if this doesn't exist already but though I should ask first.

Thanks (especially to whoever wrote the "Paint bucket" tool, it now saves us hours of work).


--
Andrew Janke - andrew.janke@cai.uq.edu.au
Centre for Advanced Imaging, UQ
Brisbane->Australia +61 (402) 700 883

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: text accelerated color palette

Postby druban » Wed Mar 16, 2011 5:18 pm

I am not sure, if what you want is speed, there is anything faster than clicking in the swatches or palette. As far as I can tell there is no extension that accesses the palette or swatches to fill with so your planned extension might fill a needed spot. Curious to see how you envision using keyboard shortcuts to fill - maybe you could offer a keybinding for fill with first swatch, fill with second swatch, third etc. but I can only see about te or twelve being practical.
Your mind is what you think it is.

a.janke
Posts: 6
Joined: Sat Aug 30, 2008 8:42 pm

Re: text accelerated color palette

Postby a.janke » Wed Mar 16, 2011 10:33 pm

@druban,

I guess I should have been more clear, the users in our workflow have to apply a fill to about 40 traced objects in each image they work on. The list of fill titles (brain substructures) is currently just over 1000, meaning using the swatches really isn't workable.

Each of the 1000 structures does have a code though (1H, 1H2, ..etc) and the tracers know these codes. I also name the (randomly assigned) colours by the structure. Below is the palette in question:

GIMP Palette
Name: Paxinos Structures
#
98 231 167 1 (layer 1 of cortex)
247 66 45 1/2Cb (lobules 1 and 2 of the cerebellar vermis)
162 159 184 10Cb (10th cerebellar lobule (nodule))
26 56 127 10n (vagus nerve)
223 16 9 10N (dorsal motor nucleus of vagus)
40 135 135 10n/11n (vagus nerve/accessory nerve)
47 1 77 11n (accessory nerve)
.....

So what I envisage is to select an object and then either pick the colour from a dialog box that also displays (or sorts) the colors by their names or perhaps, select an object then press some key/accelerator combination and start typing the color name. ie: 11n at which point that fill is chosen.

Perhaps I should look at adding an attribute (name) to each object instead and then assigning the colour using a perl script. Hrm...

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: text accelerated color palette

Postby ~suv » Wed Mar 16, 2011 10:40 pm

I would recommend to take your question to the 'inkscape-devel' mailing list. It's an interesting use case developers might enjoy to learn about, OTOH I doubt that the current extension system would allow you to write a perfomant extension for this specific task (available widgets for extension dialogs are limited, extensions don't have access to internal commands, etc.). There is no alternative to the palette and the swatches dialog in Inkscape available which would allow to search for and pick colors by name, and no dynamic palette or swatches dialog with a history widget for easier selecting of most recently used colors (though I'm certain that these features have been requested in the bug tracker already).

You do use the 'Swatches…' dialog in list format, to have at least all names visible to select them by name?

Maybe it would be worth while to investigate the new dbus scripting API (GSoC project from 2009, as discussed on the mailing list: 1, 2, 3, 4) which had been merged into the development branch after the release of Inkscape 0.48. Documentation is scarce and not online available (sources for the docs are in the source tree), and - due to using dbus - the new scripting API for inkscape is not yet fully cross-platform (there's ongoing work to port it to Windows afaik as part of the rewrite of Inkscape's whiteboard feature: inkboardng).

There's also a separate branch of Inkscape (from the MadButterfly project) which added additional features (python bindings) to allow creating menu items and docked dialogs via dbus scripting. The proposal was discussed controversially on 'inskcape-devel' and on irc for now …

[edit]didn't see your answer to druban with further details, which was posted while I was writing my comment[/edit]
Last edited by ~suv on Wed Mar 16, 2011 10:49 pm, edited 1 time in total.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: text accelerated color palette

Postby ~suv » Wed Mar 16, 2011 10:46 pm

a.janke wrote:So what I envisage is to select an object and then either pick the colour from a dialog box that also displays (or sorts) the colors by their names
~suv wrote:You do use the 'Swatches…' dialog in list format, to have at least all names visible to select them by name?
Attachments
swatches-as-list.png
swatches-as-list.png (101.43 KiB) Viewed 1201 times

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: text accelerated color palette

Postby druban » Thu Mar 17, 2011 2:47 am

Perhaps I should look at adding an attribute (name) to each object ...


Hmm, I think if you do this you could just open the svg file in msword or even in notepad++ and use the find and replace to 'colour' your objects!
Your mind is what you think it is.

a.janke
Posts: 6
Joined: Sat Aug 30, 2008 8:42 pm

Re: text accelerated color palette

Postby a.janke » Thu Mar 17, 2011 9:21 pm

@~suv

Nope, didn't know about the list swatches dialog, that might be a good intermediate step. I'd then write something that continually polls the colors in the traced drawings so far and updates the list of 'colours' in the palette (in /usr/share/inkscape/palettes/) as my slaves are beavering away identifying areas. Hackish: yes. Willitwork? yes.

Still thanks for taking the time with an in-depth response, I'll give up on the extension thought for now. If I get energetic and write some code I'll just go straight for inkscape itself now. Shouldn't be that hard to modify the swatches dialog/modal you have pointed out to accept text input (so long as it can take focus).


@druban

msword? notepad? what are these strange things you speak of? We're a Debian/Ubuntu shop around here. :)

But yes, I am having thoughts of giving up on colors alltogether and just modifying the object properties directly via some hacked up shortcut key sequence.


Thanks again all.

--
Andrew Janke
(a.janke@gmail.com || http://a.janke.googlepages.com/)
Brisbane->Australia +61 (402) 700 883


Return to “Help with using Inkscape”