[Insight-users] CovariantVector image in SimpleITK

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Apr 25 11:25:42 EDT 2012


Hello Aditya,

There are a couple of things you should know about SimpleITK:

1) Almost all of the filter documentation in SimpleITK is taken from ITK. So some time it needs to be taken with a grain of thought and adapted from the templated ITK world to SimpleITK. Looking at the original ITK documentation can be helpful at time.

2) The SimpleITK Image class contains a variety of ITK images inside using the pimpl idiom to encapsulate.The these are listed as PixelIDs in a a couple different spots, sitkPixelIDValues.h, for example. So we have chosen to use the itk::Image class with large number of scalar type. In ITK there are many types of multi-component pixel type, RGB, RGBA, FixedArray, Vector, and CovariantVector, to name just a few. Because there are too many combinations of these specific fixed length types, we have chosen to go with the more general VectorImage where the number of components can be chosen at run-time. So For the EdgePotentialImageFilter, it is expecting an SimpleITK Image which holds a VectorImage, or an image a type of vector pixelIDs.

So embarrassingly, we haven't wrapped either of the GradientImage filters yet. However, I thought it should be easily enough to compute the derivatives and compose them into a VectorImage. Unfortunately, the Compose filter was not there. So I have just added, it to SimpleITK's experimental next development branch. With this patch you can use the filter as follows in python:

import SimpleITK as sitk

img = sitk.ReadImage("cthead1-Float.mha" ) # note that this is a floating point pixel type
D = [sitk.Derivative( img, 0 ), sitk.Derivative( img, 1 ) ]
grad = sitk.Compose( D )
sitk.Show( sitk.EdgePotential( grad ), "EdgePotential" )

Looking at the equation in the ITK code you could also try the more flexible but less efficient:

e =  sitk.Exp( - sitk.Sqrt( (D[0]**2+D[1]**2) )
sitk.Show( e, "ManualEdgePotential" )


I am not sure what I think of the results of the filter, likely some aggressive de-noising may be needed before taking the EdgePotential.

This should get you up and running. I am going to work on getting the Gradient filters directly working on SimpleITK, however this will require a couple of changes to ITK do to  some issues related to the CovariantVector.

Hope this help,
Brad

On Apr 24, 2012, at 5:39 PM, aptea at mskcc.org wrote:

> I am trying out the EdgePotentialImageFilter in SimpleITK. It mentions that the input should be a CovariantVector image. But I do no find any class in SimpleITK which implements the CovariantVector image. Any pointers to create a CovariantVector image in SimpleITK would be great.
> 
> Thanks,
> Aditya
> 
>  
>      =====================================================================
>      
>      Please note that this e-mail and any files transmitted from
>      Memorial Sloan-Kettering Cancer Center may be privileged, confidential,
>      and protected from disclosure under applicable law. If the reader of
>      this message is not the intended recipient, or an employee or agent
>      responsible for delivering this message to the intended recipient,
>      you are hereby notified that any reading, dissemination, distribution, 
>      copying, or other use of this communication or any of its attachments
>      is strictly prohibited.  If you have received this communication in 
>      error, please notify the sender immediately by replying to this message
>      and deleting this message, any attachments, and all copies and backups
>      from your computer.
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120425/55c642d8/attachment.htm>


More information about the Insight-users mailing list