Starting Off With Some Basic Widgets

After I thoroughly went through the code of the library I am working on during the Community Bonding period, I focused my attention to some basic widget implementations to get comfortable with writing code in VTK. After a video chat with my mentors during the first week, we came up with a list of tasks for me to complete to get my hands dirty.

Image Widget

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.

Possible improvements to this include:

  1. Resizing the image with mouse.
  2. Changing the image by browsing the file system during display.

The code for this is available here :


I then moved on to implement a checkbox element. This was implemented as a composition of the Button2D and TextBox2D class objects. This was where I really started getting experience with VTK since I faced a lot of problems during implementation which made me go through a lot of documentation of the toolkit. It helped me find a few bugs in the classes that I used. This is what I finally made:

One issue I faced while implementing this was that the set of icons used in the Button2D class was a dictionary. This was a problem because we need a particular order for the icons in the buttons (Block followed by a Tick if checked) but dictionaries in python are randomly ordered, thus sometimes the buttons were initially ticks. After discussing with my mentors, we decided to change the dictionary to a list of tuples. The code for the same can be found here:

My mentors and I focused our attention to reviewing a pending PR in the repository. It is an important PR which refactors a huge portion of the code. I have decided to make a PR for checkbox after this PR and the one mentioned above are merged.

Plans for the Project

In a video call meeting, my mentors discussed what outcomes they expect from this project. They want me to move to 3D UI components ASAP, so I decided to complete the 2D portions in the next 2-3 weeks. One of the most important of the 2D widgets is a file select menu, which is not only an important component in itself, but can also enhance the functioning of other elements by allowing the user to control what is displayed.


My name is Karandeep Singh Juneja and I am really excited to be working for DIPY this summer as a part of Google Summer of Code. I am a Computer Science undergraduate at IIIT Hyderabad.

About DIPY

DIPY is a free and open source software library for computational neuroanatomy and medical data science. It contains algorithms for diffusion magnetic resonance imaging (dMRI) analysis and tractography but also contains implementations of other computational imaging methods such as denoising and registration that are applicable to the greater medical imaging and image processing communities.

Project Information

dipy.viz provides many visualization capabilities. The goal of my project is to improve DIPY’s current User Interface widgets and create new futuristic ones so as to have a complete library from which users can build interactive applications.

Current Status of the library

Currently, dipy.viz implements some basic functionalities using VTK (Visualization Toolkit) in Python. The interactive tools already present are buttons, sliders, panels, text boxes, and file-select menus, all two dimensional.

My Project

I have planned to divide the project into two main parts:

  1. Improving and implementing 2D widgets: These new 2D widgets will include basic objects like checkboxes, radio buttons, progress bars, color picker, images, divider and combo boxes. There will also be containers like Adaptive Rectangles and stack panels for these widgets. The users would be allowed to change the basic styling like color, size, position, orientation and margins of these widgets at runtime. If time permits, I might experiment with adding some animations to them.
  2. Implementation of 3D widgets: One 3D widget already in progress is an orbital menu.