Difference between revisions of "User:Mseeland"
From NAMIC Wiki
Line 59: | Line 59: | ||
====REQUIREMENTS==== | ====REQUIREMENTS==== | ||
* Ctypeslib: ctypeslib is an extension package for ctypes. It contains a ctypes code generator. | * Ctypeslib: ctypeslib is an extension package for ctypes. It contains a ctypes code generator. | ||
− | * GCC- | + | * GCC-XML (from http://www.gccxml.org/) is required to parse C header files into an XML description. |
====GETTING THE SOFTWARE==== | ====GETTING THE SOFTWARE==== |
Revision as of 02:05, 1 December 2008
Contents
Wiki of Madeleine Seeland
General Information
About myself
I am a grad student of Management Information Systems at the University of Mannheim, Germany. I'm involved in the Diffusion Tensor Imaging (DTI) project in the Laboratory of Mathematics in Imaging. Currently I'm working on two-tensor tractograohy for Neurosurgery. I will document my research experience as a diploma thesis, which I need for completing my studies in Germany.
Contact information
E-mail: mseeland (at sign) bwh.harvard.edu
Collaborators & Contacts
- Supervisors: C-F Westin, Nobuhiko Hata
- Gordon Kindlmann
- Sharon Peled
- Alireza Radmanesh
- regarding Python: Demian Wassermann, Steve Pieper, Sylvain Bouix, Julien de Siebenthal
Project: Two-Tensor Tractography integration into Slicer
Project Description
- Integration of two-tensor tractography into Slicer using Python
- My part: Interface between Python and Slicer
- The Teem Python API will be provided by Gordon Kindlmann
How to enable Python in Slicer 3.3
- The current version of Slicer, Slicer 3.2, does not support Python. In order to use Python you need to install Slicer 3.3.
- To build Slicer Version 3.3, just do the following two commands:
svn co http://svn.slicer.org/Slicer3/trunk Slicer3 ./Slicer3/Scripts/getbuildtest.tcl
- In Slicer 3.3, Python support is disabled by default. In order to enable Python, just follow the next steps:
- Edit slicer_variables.tcl
- Change "set ::USE_PYTHON "off"" to "on"
- Optional: If you prefer to use your system Python installation, see here: [1]
- Optional: installing SciPy, see here: [2]. However, there are still problems adding scipy in Slicer, whcih are not fixed yet.
- Rebuild Slicer3 using "getbuildtest.tcl":
./Slicer3/Scripts/getbuildtest.tcl
A new menu command Python Interpreter should appear on the Window menu in Slicer. This command should bring up the Python Console window.
Teem Python wrapping
BACKGROUND
- The python wrappings are based on ctypes, as well as a ctypes code generator (called "ctypeslib")
- Ctypes is a standard part of python, by which C functions in a shared library can be called from Python
- The ctypes code generator converts declarations in C header files into executable Python code: enums, structs, unions, function declarations, com interfaces, and preprocessor definitions.
- Creating wrappers for C header file(s) is a two step process.
- First, the ``h2xml.py`` script runs GCC-XML_ over the include file(s), creating a XML file containing declarations and definitions.
- Second, the ``xml2py.py`` script parses the XML files and creates Python code containing all or a subset of these definitions.
- Python code is generated for C enums, structure, unions, typedefs and function declarations.
REQUIREMENTS
- Ctypeslib: ctypeslib is an extension package for ctypes. It contains a ctypes code generator.
- GCC-XML (from http://www.gccxml.org/) is required to parse C header files into an XML description.
GETTING THE SOFTWARE
- Python 2.6 can be got here (anything after 2.5 should work): http://www.python.org/download/
- get gccxml (I used version 0.9.0), which can be got by CVS as described here: http://www.gccxml.org/HTML/Download.html
- follow the installation as described here: http://www.gccxml.org/HTML/Install.html
- use a version of ctypeslib which work with the version of gccxml:
* http://svn.python.org/projects/ctypes/branches/ctypeslib-gccxml-0.9
- But this requires some patches to work; the content of the "fixes.patch" file can be found here: [[3]]:
svn co http://svn.python.org/projects/ctypes/branches/ctypeslib-gccxml-0.9 cd ctypeslib-gccxml-0.9 patch -p0 < ../fixes.patch cd ..
- ctypeslib is written in python => there's nothing new to compile at this point
CREATING PYTHON/TEEM
- First get Teem (starting from whatever directory should contain the "teem" source dir):
svn co https://teem.svn.sourceforge.net/svnroot/teem/teem/trunk teem
and compile it as a shared library. Directions for doing this with Cmake are now here:
http://teem.sourceforge.net/build.html
- create the wrappings in a new directory (e.g. "teem-wrap"), where the XML and Python output will be
Status/Progress
Month | Week # | Start Date - End Date | Done | Date Done | |
---|---|---|---|---|---|
Try to compile teem with levmar (= Levenberg-Marquardt algorithm) | x | ||||
Week 48 | 24.11 - 30.11 | ||||
document the results of the two-tensor tractography given a tensor volume | x | ||||
Try to do mutli trace tractography given a DWI volume | x | Mon Nov, 17th | |||
Week 47 | 17.11 - 23.11 | ||||
Working on Python tractography module for multi fiber tracing given a tensor volume | x | Mon Nov, 17th | |||
Week 46 | 10.11 - 16.11 | ||||
Get vertex data out of the nvert nrrd filled by the tractography back to Slicer | x | ||||
Try to pass image data from Python to Teem through nrrdWrap_nva function | x | ||||
Try to generate a list of point locations that were used as tractography seedpoints in the VTK tractography | x | Thu Nov, 13th | |||
Implement Python tractography module for single fiber tracing given a seeding starting point and a tensor volume | x | Fri, Nov, 7th | |||
Week 45 | 03.11 - 09.11 | ||||
Try to get image data from numpy (= Python package) to Teem nrrd struct | x | ||||
November | Week 44 | 27.10 - 02.11 | |||
Try to get image data from numpy (= Python package) to Teem nrrd struct | x | ||||
Week 43 | 20.10 - 26.10 | ||||
Try to access DWI volumes through Python | x | Fri Oct, 17th | |||
Get Teem wrapped in Python | x | Fri Oct, 19th | |||
Week 42 | 13.10 - 19.10 | ||||
Try to implement the seeding part of the (VTK) one-tensor tractography module in Python | x | Tue Oct, 14th | |||
Week 41 | 06.10 - 12.10 | ||||
Try to implement the seeding part of the (VTK) one-tensor tractography module in Python | x | Tue Oct, 14th | |||
October | Week 40 | 29.09 - 5.10 | |||
Totally understand existing Python modules in Slicer | x | ||||
understand existing one-tensor streamline tractography in Slicer (VTK) | x | Tue Sep, 23rd | |||
Totally understand existing Python modules in Slicer | x | Tue Sep, 23rd | |||
Week 39 | 22.09 - 28.09 | ||||
Slicer & Python Tutorials | x | ||||
Enable Python in Slicer | x | Mon Sep, 22nd | |||
September | Week 38 | 14.09 - 21.09 |
Information
- Diffusion Tensor Analysis in Slicer: http://www.na-mic.org/Wiki/images/0/04/Slicer3diffusionTutorial7.pdf
- Building a Slicer 3 Module GUI: http://www.slicer.org/pages/Building_a_Slicer_3_Module_GUI
Python:
- SlicerWiki about Python: http://www.slicer.org/slicerWiki/index.php/Slicer3::Python
- Python example modules in Slicer: http://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation:Python