After an amazing summer, GSOC has finally come to an end. My project with DIPY under the umbrella of Python Software Foundation was one of the most interesting and challenging projects I have ever worked on.
dipy.viz provides many visualization capabilities. The goal of my project was to improve DIPY’s current User Interface widgets and create new ones so as to have a complete library from which users can build interactive applications.
Overview of the work done
Before my project, the library already had working implementations of button, rectangle, disk, sliders, panel, text-box and file menu.
VTK is a great framework as its provides a high level abstraction over the complicated code for graphics rendering. However, there isn’t much documentation and working examples available on the internet to refer to. Therefore, whenever I experimented with new stuff like 3D widgets, animations and filters, progress was slow. But the weekly meetings with my mentors and the targets given kept me going on and I was able to create a lot of new elements.
Since we were building a highly customizable UI, we kept a lot of parameters as arguments so that users can create elements according to their needs. Most of the parameters were also given default values to allow users to simply instantiate an element and see how it works.
Here is an overview of the various widgets that will soon be provided by the library:
My first widget was a simple image element which takes the image path and the required size as inputs. I started off with this because the code for this was pretty simple and most of it was already written in other classes.
Option, Checkbox and RadioButton
The Option class, which is a set of a `Button2D` and a TextBlock2D, acts as a single option for check-boxes and radio buttons. It keeps a
checked attribute to facilitate checking and unchecking in `Checkbox` and RadioButton classes. The
toggle logic is used to change its state.
The Checkbox class implements check-boxes, which is a set of
Option objects, where multiple options can be checked at once.
The RadioButton class, which inherits from Checkbox implements radio buttons, which is a set of
Option objects, where only one option can be checked at a time.
LineDoubleSlider2D and RangeSlider
The LineDoubleSlider2D allows the user to have two handles on the same slider. These handles can slide on the track, while not crossing each other at any point. This element is useful for setting a range for a parameter.
This element uses a
LineDoubleSlider2D to select a range which restricts a
LineSlider2D to move within that range. This is done by updating the
max_value of the
LineSlider2D according to the positions of the handles of
The scroll bar is an addition to the
ListBox2D element which used up and down arrow keys for navigation earlier.
This element allows the user to browse their file system and look at files and folders. They can navigate into and out of directories by clicking on them in the menu.
This is a disk menu around the menu objects which always faces the camera. This is my first try at 3D elements. I haven’t made a PR for this because it requires a major change is the entire library since all the current elements only work in a 2D setting. This has been put on hold and will be continued later. Meanwhile, I assembled a working sample of how it would look like by manually making some changes to the other elements.
A Preloader is a visual indication of the process of ‘loading’, displayed to tell the user that the program is running in the background and has not stopped. These include those rotating circles and moving bars we all hate to see on our screens.
The Color Picker I made follows the HSV color model and converts the selected color to RGB. It consists of a vertical bar that selects the hue and a square that selects the saturation and value for the selected hue. There is a small ring inside the square to track the colors selected. The colors in the square get updated whenever the hue is changed.
Here’s a list of what we want to do in the future:
- Generalize the entire viz module, so that all elements work in both 2D and 3D settings. 2D elements should not transform when the camera is moved in a 3D environment.
- Change the way callbacks are bound to elements. Currently, there are multiple ways this can be done. We want to make a single function to bind callbacks to actors before the next release this year.
- Style the elements to give a futuristic/ sci-fi appearance.
I would like to thank my mentors, Eleftherios Garyfallidis , David Reagan and Ranveer Aggarwal for helping me throughout the summer and holding regular meetings to discuss the project. They, along with other contributors like Marc-Alexandre Côté and Serge Koudoro regularly provided feedback and suggestions to improve my code.
Apart from improving my coding style, this project has helped me to overcome my fear of starting working on large projects.
Thank You !!