Kitware / UPennContrast

UPenn ?
https://upenn-contrast.netlify.com/
Apache License 2.0
8 stars 6 forks source link

Allow for ordering of the interface elements in annotation and property workers #678

Closed arjunrajlab closed 3 months ago

arjunrajlab commented 3 months ago

Right now, when you specify the interface in a worker, the interface is rendered with the interface elements in alphabetical order. Sometimes, however, it would be good to organize the interface options in non-alphabetical order. Is there a good way to do that? One option I was thinking was to add an "_order" key that specifies the ordering. Like '_order': 1, etc. If some item is missing that key, then it shows at the end of the list in alphabetical order as before. Would that work?

def interface(image, apiUrl, token):
    client = workers.UPennContrastWorkerPreviewClient(apiUrl=apiUrl, token=token)

    # Available types: number, text, tags, layer
    interface = {
        'Channel': {
            'type': 'channel'
        },
        'Radius': {
            'type': 'number',
            'min': 0.5,
            'max': 10,
            'default': 1,
        },
    }
    # Send the interface object to the server
    client.setWorkerImageInterface(image, interface)