CSC400 IS Kelly Dwan--Log

From CSclasswiki
Jump to: navigation, search

This is the main page for Kelly Dwan's Independent Study (CSC400).
Spring 2009
Dept. of Computer Science
Smith College
Dominique Thiebaut, David Bickar advisors


The goal of this IS is to generate software tools to merge brain scans of human patients into a 3D brain visualizer, MRIcron used by Prof. David Bickar in his research.

The idea is to take images of brain scans, extract their geometry information (size, location in the brain, angles of orientation, etc.), and then from that information generate data files of 3D shapes that can be superimposed in a 3D brain visualizer.


Below is a rough list of steps for Kelly for approaching this problem.

  1. Learn how to use PyQt, especially the ability to import images (JPG very likely) in a window, and use the mouse to click on areas to determine their locations, shape, etc. See this tutorial for starting with PyQt
  2. Install MRIcon
  3. Play with MRIcon (will need interaction with D. Bickar)
  4. Dig into MRIcon's documentation/source code to understand
    • how it works,
    • what file format it supports,
    • how it imports data files (something that D. Bickar knows how to do)
  1. Obtain brain scan images from David Bickar and start looking at how to visualize them with PyQt.

TO DO for next week

Meeting 2/9/09

  • Start a Wiki page that will be the report of the full IS. The link to the page is 3D Visualization of 2D Brain Scans
  • Modify GUI and make it import a JPG file. Use a scan if possible, although not necessarily needed.
  • Form will ask user to click on
    • 4 points first: left, right, top and bottom of the brain.
    • 2 more points: left and right side of scale (10 mm).
    • 1 point which will become a circle whose radius is 1/2 of 10 mm (obtained from previous 2 points)
  • Form will save coordinates of these points in a text file, in XML. Here's an example of format:
  <left>23, 34</left>
  <right>930, 44</rigth>
  <top>100, 10</top>
  <bottom>700, 550</bottom>
  • Install MRICRON on laptop
  • Explore U. Michigan's database site for brain scans ( and locate some of the scans presented by David Bickar on 2/9/09.
  • Prepare the paperwork for the collaboration event.

Meeting 2/16/09

Good image of scan imported in PyQt MainWindow.

  • For next week, figure out a way to draw points on the main window. This program may have some good information.

Meeting 2/23/09

  • Figured out a way to get (x,y) printed in textEdit
  • For next week, please work on these action items:
    • Programming: User specifies the name of the scan he/she wants to load up. name of jpg file is kept in variable.
    • User clicks 8 points on scan, and resulting x,y are recorded in a text file.
      • First 4 points are on top, right, bottom and left boundaries of brain
      • next 2 are for the scale
      • last 2 are for defining a disk with a center and a radius
    • After 8th point clicked, the information is written to a text file

x1 y1
x2 y2
x3 y3
x3 y3
x4 y4
x5 y5
x6 y6
x7 y7
x8 y8

    • Work by hand: figure out a way to add a disk/cylinder of known center and radius in the MIRCron 3D-model, in a plane corresponding to the same plane as where the scan comes from.

Meeting 3/4/09

To do for next week:

  • Schedule a meeting with David Bickar. This is a very busy time for him, so he may not have time this week, or next. If this is the case, explore MRIcron on your own. Try to figure out how to:
    • create a disk or very thin cylinder in a vertical plane of the 3D model of the brain
    • save this blob shape to file, using MRIcron's save function
    • deconstruct the saved file to understand its format
  • Start generating an algorithm for creating blob files artificially, so that they can be imported in MRICron. For example, see if you could edit by hand a file and a make it create a cube at some predefined location. By the way, if creating cubes is easier than creating cylinders, let's use cubes. Whatever makes it easy to generate volumes.
  • Start writing the wiki page for the project. Its main sections should be:
    • Description of the project
    • Tools: what is being used: designer, pyQt4, MRICron
  • Resources
    • what database is used to get the scans
  • Directions for using the software
    • Directions for creating the .py file from the ui file
    • Directions for how to create the file with the coordinates of the points selected by the user
    • The format of the text file containing the coordinates.

Meeting 3/9/09

To do for next week:

  • Explore some more the Nifti python library, to see if it is usable for our purpose.
  • See if VOI or ROI files can be generated by some Python module available on the Web.
  • I will contact Chris Rorden ( about the VOI format
  • If we cannot go anywhere with Nifti and VOI file, it is possible that the way to go is ROI --> VOI --> MRICron...

The next meeting will be the Monday after the break...

To do to wrap up (4/27/09)

  • Document!!!
  • Update Wikipage
  • Add screen captures
  • The Python code
  • Explanation of the format of the data files for MRIcron
  • Step by step description of how to use the tool
  • List of features of the Python tool
  • List of lacking features and how to best implement them





  • Amira: another 3D visualizer, for reference
  • ITK: an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis.
  • ITK-Snap; a software application used to segment structures in 3D medical images.