Difference between revisions of "Slicer3:UIDesign:WorkingProblems:BCAnalysis:Dynamic"

From Slicer Wiki
Jump to: navigation, search
Line 27: Line 27:
 
Below is a screenshot of first perfusion dataset. The dataset contains upward of 900 volumes. Loading the original DICOM images took a very long time; Junichi converted these images to nrrd format, but the loading still takes prohibitively long, and interacting is also very slow.  
 
Below is a screenshot of first perfusion dataset. The dataset contains upward of 900 volumes. Loading the original DICOM images took a very long time; Junichi converted these images to nrrd format, but the loading still takes prohibitively long, and interacting is also very slow.  
  
=== ideas: ===
 
* can we create a VOI and apply to each volume in the timeseries?
 
* Alternatively, for a first demo we can use a smaller dataset?
 
  
 
=== 08/20/2009 meeting with Ron: Jeff will provide: ===
 
=== 08/20/2009 meeting with Ron: Jeff will provide: ===
Line 95: Line 92:
  
 
Started slicer, opened python console, typed import numpy and import scipy and seemed to get the right behavior.
 
Started slicer, opened python console, typed import numpy and import scipy and seemed to get the right behavior.
 +
 +
 +
== First experiment ==
 +
 +
* Load pre-treatment perfusion.
 +
* Save scene PreTreatmentPerfusion.mrml
 +
* Reload & see if volumeBundleNode reloads properly.
 +
* Segment tumor & bloodpool
 +
* Save scene PreTreatmentPerfusionWithSegmentation.mrml
 +
* Load just post-treatment perfusion
 +
* Segment tumor & bloodpool
 +
* Save scene PostTreatmentPerfusionWithSegmentation.mrml
 +
* Reload PreTreatmentPerfusionWithSegmentation.mrml
 +
* Perform plotting on pre-treatment
 +
* Perform Tofts Kinetic Model analysis on post-treatment
 +
 +
 +
Add PostTreatmentPerfusionWithSegmentation.mrml
 +
Save
 +
 +
Create a scene that includes both perfusion datasets....

Revision as of 16:37, 24 August 2009

Home < Slicer3:UIDesign:WorkingProblems:BCAnalysis:Dynamic

Back to Project Overview

Perfusion Analysis for Breast Cancer

Goal

Goal is to accommodate basic RECIST assessment for breast cancer (Response Evaluation Criteria In Solid Tumors). (RECIST is a set of published rules that define when cancer patients improve ("respond"), stay the same ("stable") or worsen ("progression") during treatments).

  • Determine features that currently exist in Slicer
  • Develop features that don't
  • Provide a framework that knits features together in a comfortable workflow.

Perfusion Analysis Workflow

  • Visualize the dataset dynamically
  • Specify an ROI that includes tumor and apply to all timepoints Question: ROI or VOI? (either -- if slice, must be same slice)
  • Plot contrast dilution curve
    • show time to peak in tumor
  • Specify an ROI that includes blood pool and apply to all timepoints Question: again, ROI or VOI?
  • Plot contrast dilution curve for this (on same graph)
    • show time to peak in blood pool
  • show transit time (distance between peaks in each plot)
  • save out timepoints ( Intensity(t) for each ROI -- include multiple tumors if desired)

First experiment

Below is a screenshot of first perfusion dataset. The dataset contains upward of 900 volumes. Loading the original DICOM images took a very long time; Junichi converted these images to nrrd format, but the loading still takes prohibitively long, and interacting is also very slow.


08/20/2009 meeting with Ron: Jeff will provide:

  • indication (screen shot) of the blood pool VOI to use
  • indication of the mapping between dicom files and slice, timepoint, channel to use during the load experiments
  • paper describing kinetic curve fitting, based on Toft's model extracellular volume fraction and permeability used by Kasia Macura at JHU.

building 4DImage and 4DAnalysis modules:

From Jeff -- first dataset contains 15 timepoints, each 256x256x63 -- so we've found a bug in either:

  • the timeseries loader in Slicer (probably in the thing that parses dicom header), or
  • we have a malformed DICOM header.

This is causing Slicer to load 63x15 volumes containing a single 256x256 slice. I'll dig in to this today and see what's going on. Shouldn't be too hard to find. Junichi has given me a DCE dataset that loads properly for comparison.

  • Fixed with changes to automatic parsing of DICOM data. Will stub out, check into svn today, and ask Junichi to test it on his datasets -- make sure it works for all cases before exposing in the repository.

The 4D Image analysis package is required for plotting -- need to expose this in Slicer3/Modules/CMakelists.txt file. Discussed with Junichi about possibility of having both 4DImage and 4DImageAnalysis modules exposed in the trunk for the demo; he sees no problem in this *without* the Scipy modeling part exposed. Too challenging now to build python/numpy/scipy by default.

CHANGES TO CODE & BUILD INFRASTRUCTURE to get FourDImage and FourDAnalysis to compile

  • Exposed FourDImage and FourDAnalysis modules in Slicer3/Modules/CMakelists.txt
  • Changed the code in vtkKWPlotGraph.cxx: replaced finite() function is replaced code that conforms to ISO C++/2003 so it would compile on win32
  • Changed some code in vtkFourDAnalysisLogic.cxx because there is no equivalent to the isnormal() function. Instead, just used the same def for finite()... but this will not test for subnormal floats.
  • Had to move pyconfig.h to Slicer3-lib/python-build/Include so FourDAnalysis module could compile (couldn't find this file, included by <Python.h> for some reason (maybe something wrong with my python install on win32.
  • Building in Debug mode rather than release creates python25_d.dll. The compile in genlib only builds python in release mode. Try changing the mode to ::$VTK_BUILD_TYPE and copy the python25_d.dll (as well as python25.dll to the python-build/Lib dir) in genlib.tcl...
      • Something still looking to link with python25.dll (?) compiling python in debug mode does not generate the release libarary. So, next thing to try is running the python build twice, once in release, once in debug. Sloppy, but then we have both. made this change in genlib.tcl, and did the file copy of both the dlls.
      • then, in subsequent call in getbuildtest.tcl, had to put a catch around the python lib file copy -- and add a copy of the debug library too. I think the result is that both debug and release python libs will be present; the particular slicer build will just link with the required python lib. There's certainly a better way, but I'll leave that to experts to improve if this appears to work.
      • FourDAnalysis module still couldn't ind python25_d.lib. in Slicer_variables.tcl changed the way PYTHON_LIB is set:
       set ::PYTHON_TEST_FILE $::PYTHON_BIN_DIR/PCbuild/python.exe
       if { $::VTK_BUILD_TYPE == "Release" }  {
           set ::PYTHON_LIB $::PYTHON_BIN_DIR/PCbuild/python25.lib
       } elseif { $::VTK_BUILD_TYPE == "Debug" } {
           set ::PYTHON_LIB $::PYTHON_BIN_DIR/PCbuild/python25_d.lib
       } elseif { $::VTK_BUILD_TYPE == "RelWithDebInfo" } {
           set ::PYTHON_LIB $::PYTHON_BIN_DIR/PCbuild/python25.lib
       } else {
           puts stderr "Could not match build type to set python lib \"$::VTK_BUILD_TYPE\"."
       }
       puts "Set python lib = $::PYTHON_LIB"
       set ::PYTHON_INCLUDE $::PYTHON_BIN_DIR/include

SCIPY for Slicer on win32

  • Had to include scipy binary -- downloaded from here. Installed this library in my non-slicer python installation (the installer didn't give me option to put it anywhere else). Then did a copy of files to Slicer installation. This will take some debugging I think.
    • C:/Python25/Lib/site-packages/scipy --> (path to slicer)/Slicer3-lib/python-build/Lib/site-packages/.
    • C:/Python25/Lib/site-packages/README.txt --> (path to slicer)/Slicer3-lib/python-build/Lib/site-packages/.
    • C:/Python25/Lib/site-packages/scipy-0.6.0-py2.5.egg-info --> (path to slicer)/Slicer3-lib/python-build/Lib/site-packages/.
    • new files in C:/Python25/Lib/ --> (path to slicer)/Slicer3-lib/python-build/Lib/.
    • new files in C:/Python25/Lib/encodings --> (path to slicer)/Slicer3-lib/python-build/Lib/encodings/.

now let's see how that works.

Started slicer, opened python console, typed import scipy and got the following error:

Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "C:\Python25\Lib\site-packages\scipy\__init__.py", line 25, in <module>
   from numpy import show_config as show_numpy_config
ImportError: No module named numpy

Looks like numpy didn't install correctly for me using the genlib.tcl script.

NUMPY for Slicer on win32

So let's try grabbing the precompiled binary for numpy... from [ http://sourceforge.net/projects/numpy/files/NumPy/1.3.0/numpy-1.3.0-win32-superpack-python2.5.exe/download here ].

    • C:/Python25/Scripts/* --> (path to slicer)/Slicer3-lib/python-build/Lib/. (not sure about this one...)
    • C:/Python25/Lib/site-packages/numpy --> (path to slicer)/Slicer3-lib/python-build/Lib/site-packages/.
    • C:/Python25/Lib/site-packages/numpy-1.3.0-pyp2.5.egg-info --> (path to slicer)/Slicer3-lib/python-build/Lib/site-packages/.

Started slicer, opened python console, typed import numpy and import scipy and seemed to get the right behavior.


First experiment

  • Load pre-treatment perfusion.
  • Save scene PreTreatmentPerfusion.mrml
  • Reload & see if volumeBundleNode reloads properly.
  • Segment tumor & bloodpool
  • Save scene PreTreatmentPerfusionWithSegmentation.mrml
  • Load just post-treatment perfusion
  • Segment tumor & bloodpool
  • Save scene PostTreatmentPerfusionWithSegmentation.mrml
  • Reload PreTreatmentPerfusionWithSegmentation.mrml
  • Perform plotting on pre-treatment
  • Perform Tofts Kinetic Model analysis on post-treatment


Add PostTreatmentPerfusionWithSegmentation.mrml Save

Create a scene that includes both perfusion datasets....