[Insight-users] about itk and python

Mario Ceresa mario.ceresa at torrescalla.it
Thu Jun 25 12:47:51 EDT 2009


Hola José!
I usually read a dicom serie from a directory this way with (the wonderful)
WrapITK:

def load_serie(serie_dir,image_type):
        import itk
        reader = itk.ImageSeriesReader[image_type].New()
        gdcmIO = itk.GDCMImageIO.New()
        reader.SetImageIO(gdcmIO.GetPointer())
        namesGenerator = itk.GDCMSeriesFileNames.New()
        namesGenerator.SetDirectory(serie_dir)
        reader.SetFileNames(namesGenerator.GetInputFileNames())
        return itk.output(reader)

As far as I know you have to know the image_type (SS3,US3...) BEFORE reading
the files, but maybe someone else knows a better way! (in this case plz let
me know too :) )

HTH

Mario

On Tue, Jun 16, 2009 at 10:39 PM, Lic. José M. Rodriguez Bacallao <
jmrbcu at gmail.com> wrote:

> hi folks, I am new to vtk and itk and I begining to love all the
> goodies of itk, right now, I'm triying to develop a dicom viewer with
> itk, vtk and python (my preferred language) so, I have a couple of
> questions to make.
>
> 1- How about the quality of wrappers (WrapITK vs standard)
> 2- How about memory consumption and load times of the wrappers.
> 3- I need to read several DICOM files, from various modalities, how do
> I read all of them if I need to now the image type first, for example:
>
> import itk
> image_type = itk.Image[itk.SS, 2]
> file_name = 'IM66,dcm' #this is a CT image
> reader = itk.ImageFileReader[image_type].New()
> reader.SetFileName( file_name )
> reader.Update()
>
> what if I need to read a RGB dicom image?
>
> PS: sorry for my english, it's not so good.
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -----------------------------------------------------------------
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
> mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -----------------------------------------------------------------
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090625/998c5c90/attachment.htm>


More information about the Insight-users mailing list