Difference between revisions of "Projects/Slicer3/2007 Project Week Slicer Matlab Pipeline for scalars and tensors"

From NAMIC Wiki
Jump to: navigation, search
Line 23: Line 23:
 
<h1>Approach, Plan</h1>
 
<h1>Approach, Plan</h1>
  
* Pipe data from running Slicer3 to Matlab and back to do quick prototyping with Matlab
+
* Provide tools to pipe tensor data from Slicer3 memory to Matlab and back
  
 
* Provide matlab tools for tensor transformation from IJK space to gradient space and the other way around
 
* Provide matlab tools for tensor transformation from IJK space to gradient space and the other way around
Line 29: Line 29:
 
** Quantify numerical error when transformation from ijk space to gradient space and back to ijk space is done.  
 
** Quantify numerical error when transformation from ijk space to gradient space and back to ijk space is done.  
  
* Application testing
+
* Application testing: who has a nice matlab script that needs tensor data as input?
 
</div>
 
</div>
  
Line 36: Line 36:
 
<h1>Progress</h1>
 
<h1>Progress</h1>
  
 +
* Pipeline tools for scalar data are ready to use
 
</div>
 
</div>
  
Line 47: Line 48:
 
=Additional Information=
 
=Additional Information=
  
When Slicer is started with the "--daemon" flag, a server socket is created that is listening and waiting for new connections. This network service can be used to connect to an instance of Slicer and access the MRML scene or other objects in Slicer memory.
+
When Slicer is started with the "--daemon" flag, a server socket is created that is listening and waiting for new connections. This network service can be used to access the MRML scene or other objects in Slicer memory.
 
Several clients have been written or are beeing worked on at the moment:
 
Several clients have been written or are beeing worked on at the moment:
* Tcl scripts that reads out volumes to stdout or writes to stdin  
+
* Tcl scripts that read out volumes to stdout or write to stdin  
 
* Python based clients
 
* Python based clients
 
* Matlab clients
 
* Matlab clients
Line 55: Line 56:
  
 
===The Matlab client===
 
===The Matlab client===
 +
 +
* Matlab scripts: getSlicerVolume.m and putSlicerVolume.m use Matlab extention [http://labrosa.ee.columbia.edu/matlab/popenrw.html popen] to connect to stdout(stdin) of the tcl client slicerget.tcl (slicerput.tcl respectively). The tcl client establishes a channel to the SlicerDaemon socket and requests(sends) data.
 +
* flag in these scripts can be set to do/undo gradientSpace->IJKspace transformation.
  
 
===Motivation===
 
===Motivation===
Line 70: Line 74:
 
====Tensor transformation issues====
 
====Tensor transformation issues====
  
When tensors are loaded into Slicer, the vtkNRRDReader performs transformation from diffusion gradient space into image space (IJK space). This is done to improve performance since most itk-filters need the data to be in ijk space.  
+
When tensors are loaded into Slicer, vtkNRRDReader performs transformation from diffusion gradient space into image space (IJK space). This is done to improve performance since most itk-filters require data in ijk coordinates.
Tensors that are piped to The decision has been made toSlicer
+
Tensors piped to Matlab will live in IJK-space, since this is where they are in Slicer memory. Assuming the dataset will be sent back to Slicer after processing in Matlab, no such transformations need to be done. To apply this transformation and afterwards the inverse transformation will introduce numberical errors due to matrix inversion.
 +
 
 +
However, the Matlab user might wish to transform the data back to gradient space. Matlab tools are provided to perform transformations needed.
 +
 
 +
  
 
----
 
----
  
 
[[2007_Programming/Project_Week_MIT|Back to Project week]]
 
[[2007_Programming/Project_Week_MIT|Back to Project week]]

Revision as of 00:21, 21 June 2007

Home < Projects < Slicer3 < 2007 Project Week Slicer Matlab Pipeline for scalars and tensors


Key Investigators

  • BWH: Katharina Quintus
  • Isomics: Steve Pieper
  • BWH: Sylvain Bouix


Objective

To extend and test Matlab client for reading and writing tensor data from/to Slicer.


Approach, Plan

  • Provide tools to pipe tensor data from Slicer3 memory to Matlab and back
  • Provide matlab tools for tensor transformation from IJK space to gradient space and the other way around
    • Test if these transformations in matlab are consistent with vtkNRRDReader
    • Quantify numerical error when transformation from ijk space to gradient space and back to ijk space is done.
  • Application testing: who has a nice matlab script that needs tensor data as input?

Progress

  • Pipeline tools for scalar data are ready to use


References

Slicer Deamon Wiki page

Additional Information

When Slicer is started with the "--daemon" flag, a server socket is created that is listening and waiting for new connections. This network service can be used to access the MRML scene or other objects in Slicer memory. Several clients have been written or are beeing worked on at the moment:

  • Tcl scripts that read out volumes to stdout or write to stdin
  • Python based clients
  • Matlab clients

The Slicer Deamon Wiki page provides more details.

The Matlab client

  • Matlab scripts: getSlicerVolume.m and putSlicerVolume.m use Matlab extention popen to connect to stdout(stdin) of the tcl client slicerget.tcl (slicerput.tcl respectively). The tcl client establishes a channel to the SlicerDaemon socket and requests(sends) data.
  • flag in these scripts can be set to do/undo gradientSpace->IJKspace transformation.

Motivation

Matlab pipeline client can be used to send data from a running slicer to Matlab, where the data can be used as input for whatever great algorithms you have implemented in matlab. The data can then be sent back to slicer for visualisations or further processing. No file I/O is necessary. Can be very useful since a lot of methods or algorithms are first prototyped in Matlab. Ideas what can be done easily in matlab while Slicer does not have the functionality yet:

  • Tensors:
    • Thresholding
    • Do tensor statistics after masking tensor with labelmap
    • Average two tensors
    • smoothing of tensor field (Marco's algorithm?)
  • Scalars:
    • plot histogram (that allows to quantify, at the moment slicer-histograms are not associated with numbers )

Tensor transformation issues

When tensors are loaded into Slicer, vtkNRRDReader performs transformation from diffusion gradient space into image space (IJK space). This is done to improve performance since most itk-filters require data in ijk coordinates. Tensors piped to Matlab will live in IJK-space, since this is where they are in Slicer memory. Assuming the dataset will be sent back to Slicer after processing in Matlab, no such transformations need to be done. To apply this transformation and afterwards the inverse transformation will introduce numberical errors due to matrix inversion.

However, the Matlab user might wish to transform the data back to gradient space. Matlab tools are provided to perform transformations needed.



Back to Project week