[Insight-users] ITK, VTK and Python

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Mon Mar 5 16:39:17 EST 2007


Le Mon, 05 Mar 2007 21:57:07 +0100, Erik Anderson <eranders at sci.utah.edu>  
a écrit:

> Gaetan,
>     Sending it seems that the problem is that I have full DICOM volumes  
> and not simple 2-D DICOM images.  At least, that's the feeling I get  
> from the last comment from Carl Botha.  If the translation from a 3D ITK  
> Image to a VTK dataset is not possible, I will consider figuring out an  
> offline process to do this as it is an essential piece of my project.

It would be great - no, it would be normal - to have access to all the  
methods with the standard wrapping system, but sadely, for some tehcnical  
reasons, that's not always the case.
However, you can always create a custom class which do exactly what you  
want, and wrap it with an external project. There is no need to do  
anything outside python. Please look at the code in  
Wrapping/WrapITK/ExternalProjects, or at one of my contributions to the  
insight journal for an example.

>
>     As for getting a working example to you, I think this would be very  
> difficult.  I am working on a project called VisTrails  
> (www.vistrails.org) creating a visual programming like environment.  We  
> have full VTK functionality, but because of ITK's templating issues, we  
> cannot figure out a way to appropriately and automatically wrap ITK  
> filters and classes so we have to do it all by hand.  My short term goal  
> is to provide a mechanism to view DICOM volumes (or Analyze or whatever  
> format it can be done in) as a collection of slices with an interactive  
> 3D representation as well.
>
> Thanks,
> Erik
>
> Gaëtan Lehmann wrote:
>>
>> Hi Erik,
>>
>> Le Mon, 05 Mar 2007 18:28:34 +0100, Erik Anderson  
>> <eranders at sci.utah.edu> a écrit:
>>
>>> Hi all,
>>>     Sorry for posing several questions in a single email, but it  
>>> appears I'm stuck on multiple fronts.  Firstly, I have gotten DICOM  
>>> series read into my Python-based ITK build (using WrapITK).  I would  
>>> like to extract a slice (any principle axis would be fine) but I  
>>> cannot seem to figure out the proper way to do this.  Currently, I  
>>> have the following high-level flow set up:
>>>
>>> f = itk.RegionOfInterestImageFilter[itkImage[itk.US,3]].New()
>>> f.SetInput(dicomReader.GetOutput())
>>>
>>> roi = itk.Region[3]()
>>> roi.SetIndex(startIndex)
>>> roi.SetSize(regionSize)
>>>
>>> f.SetRegionOfInterest(roi)
>>> f.Update()
>>>
>>> where startIndex and regionSize are itkIndex3 and itkImageRegion  
>>> respectively.  I get output, but it is generally a pattern of lines on  
>>> a black background.  Am I doing something wrong here?
>>
>> maybe the index or the size are not properly set ? Can you send a full  
>> example to reproduce the problem ?
>>
>>>
>>> Also, I would like to take the entire DICOM volume and view it using  
>>> vtk.  Is this possible given the current state of WrapITK and VTKs  
>>> Python bindings?
>>
>> I'm not usign dicom, but here is what Carl P Botha said about that a  
>> few month ago:
>>
>> The last time I tried, you could read single DICOM files.  However,
>> reading lists of files (with our without the gdcm filename helper) was
>> not really possible due to the version of Swig in CableSwig getting
>> confused with basic_string and string, thus resulting in the inability
>> to read or pass any strings from WrapITK / Python.
>>
>> Gaetan
>>
>>
>> --Gaëtan Lehmann
>> Biologie du Développement et de la Reproduction
>> INRA de Jouy-en-Josas (France)
>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>> http://voxel.jouy.inra.fr
>



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-users mailing list