I am currently working on custom algorithms for the ImFusion Suite. I have a model pretrained for different vessel segmentation tasks, and I would like to provide a dropdown list with the names of the tasks to load the weights before sending the data for computation.
I’ve seen a similar feature in the Cone-beam Simulation algorithm, and I was wondering if this functionality is supported in the Python SDK or if there are any guidelines for implementing this feature.
Thank you for your inquiry. Unfortunately, we do not have this functionality in the Python SDK yet. To provide a dropdown list the parameter has to be marked as an enum type (I don’t mean the Python Enum class here). In the Python SDK the types of parameters are automatically deduced from their value types in Python but Enum is not supported there yet. We plan to improve the ergonomics of writing Algorithms from Python in the near future but I cannot give a concrete estimate for when this will land. Sorry .
You can however add other available attributes to your parameters (see here, note that Enum and Color types are not available from Python yet).
You can pass attribute strings through the attributes parameter in Algorithm.add_param.
You could at least provide a tooltip that shows the options in a text field, e.g. attributes="tooltip: 'The options are A, B and C'" (I know this is not very user friendly, but it something )
Alternatively, if the weights are files on disk you could pass a pathlib.Path instance to add_param which would allow you to open a file dialog in the algo controller.