tracer-workspace

Webknossos Segment Renamer

A Tampermonkey userscript that adds quick semantic renaming to Webknossos segments via context menus.

Features

✨ Two Ways to Rename Segments:

🎨 Pre-defined Semantic Categories:

⚑ Smart Features:

Installation

Prerequisites

  1. Install Tampermonkey extension for your browser:

Install the Script

Option 1: Direct Install (Recommended)

  1. Click on the raw script file: webknossos-segment-renamer.user.js
  2. Tampermonkey will automatically detect it and show an installation prompt
  3. Click Install

Option 2: Manual Install

  1. Copy the contents of webknossos-segment-renamer.user.js
  2. Open Tampermonkey Dashboard
  3. Click ”+” to create a new script
  4. Paste the code
  5. Save (Ctrl+S / Cmd+S)

Usage

Renaming from Segment List

  1. Open a Webknossos annotation
  2. Right-click any segment in the segment list
  3. Choose a semantic ID from the popup menu
  4. βœ… Segment automatically renamed!

Renaming from 2D View

  1. Open a Webknossos annotation
  2. Right-click on a segment in any 2D viewport
  3. Look for β€œπŸ·οΈ Rename Segment ▢” in the context menu
  4. Hover to see submenu with semantic IDs
  5. Click your choice
  6. βœ… Segment automatically renamed!

Configuration

Custom Webknossos Domain

If your Webknossos instance is on a custom domain, update the @match directives:

// Add your domain to the script header
// @match        https://your-domain.com/*
// @match        http://your-domain.com:9000/*

Custom Semantic IDs

Edit the SEMANTIC_IDS array in the script:

const SEMANTIC_IDS = [
    { id: 'your-id', label: 'Your Label', emoji: '🎯' },
    { id: 'another', label: 'Another Type', emoji: '🌟' },
    // Add more...
];

Compatibility

Troubleshooting

Script not working?

  1. Check Tampermonkey icon - should show the script is enabled
  2. Open Console (F12) - look for β€œWebknossos Segment Renamer initialized”
  3. Verify URL match - script only runs on configured domains

Renaming not saving?

Development

Debug Mode

The script logs detailed information to the console:

[2D Menu] Found segment context menu with ID: 23
[2D Menu] Injecting rename menu item for segment: 23
[2D Menu] Inserted menu item before divider

Open DevTools (F12) β†’ Console to see these messages.

Project Structure

tampermonkey-scripts/
β”œβ”€β”€ README.md                                    # This file
β”œβ”€β”€ CHANGELOG.md                                 # Version history
β”œβ”€β”€ LICENSE                                      # License information
β”œβ”€β”€ QUICK_START.md                              # Quick reference guide
└── scripts/
    └── webknossos-segment-renamer.user.js      # Main script

Contributing

Contributions are welcome! To contribute:

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Test thoroughly on your Webknossos instance
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

MIT License - see LICENSE file for details.

Free to use for research, personal, and commercial projects.

Acknowledgments

Changelog

See CHANGELOG.md for version history and updates.

Support


Made with ❀️ for efficient connectomics annotation