[vtkusers] about vtkGDCMImageReader
Lic. José M. Rodriguez Bacallao
jmrbcu at gmail.com
Fri Jan 29 13:44:10 EST 2010
no one?
On 1/28/10, Lic. José M. Rodriguez Bacallao <jmrbcu at gmail.com> wrote:
> well, digging around I have found vtkImageDataStreamer but it seems
> that doesn't work with vtkGDCMImageReader. Does vtkGDCMImageReader
> support streaming? How to do streaming with vtk and gdcm readers?
>
> this is a testing code, what is wrong here:
>
> import vtk, vtkgdcm
> from imagis.dicom.utils.series_scanner import SeriesScanner
> from imagis.dicom.utils.series_sorters import IPPSorter
> from imagis.vtk.utils import to_vtk_string_array
>
> scanner = SeriesScanner()
> scanner.scan('/home/jmrbcu/temp/dicom/BRAIN')
> files = scanner.series[0].files
>
> sorter = IPPSorter()
> sorted_files = sorter.sort(files)
>
> reader = vtkgdcm.vtkGDCMImageReader()
> reader.SetFileNames(to_vtk_string_array(sorted_files))
> reader.UpdateInformation()
>
> imageStreamer = vtk.vtkImageDataStreamer()
> imageStreamer.SetInputConnection(reader.GetOutputPort())
> imageStreamer.SetNumberOfStreamDivisions(8)
> imageStreamer.UpdateInformation()
> imageStreamer.GetExtentTranslator().SetSplitModeToBlock()
>
> color_mapper = vtkgdcm.vtkImageMapToWindowLevelColors2()
> color_mapper.SetInputConnection(imageStreamer.GetOutputPort())
>
> actor = vtk.vtkImageActor()
> actor.SetInput(color_mapper.GetOutput())
>
> renderer = vtk.vtkRenderer()
> renderer.AddActor(actor)
>
> rwi = vtk.vtkRenderWindowInteractor()
> rw = vtk.vtkRenderWindow()
> rwi.SetRenderWindow(rw)
>
> rw.AddRenderer(renderer)
> rw.Render()
>
> rwi.Initialize()
> rwi.Start()
>
> PS: changing the reader from the vtkGDCMImageReader to this it seems to
> work.
>
> reader = vtk.vtkImageReader()
> reader.SetDataByteOrderToLittleEndian()
> reader.SetDataExtent(0, 63, 0, 63, 1, 93)
> reader.SetDataSpacing(3.2, 3.2, 1.5)
> reader.SetFilePrefix("/home/jmrbcu/installs/development/c/vtk/5.4.2/VTKData/Data/headsq/quarter")
> reader.SetDataMask(0x7fff)
>
> On 1/28/10, Lic. José M. Rodriguez Bacallao <jmrbcu at gmail.com> wrote:
>> hi folks, right now I am using vtkGDCMImageReader to read series of
>> images, until now, everything is ok but one small problem (I think
>> this is an small problem). When I try to read a serie of images, the
>> reader load all of my images at one time and, if the serie is a big
>> one, it may take time to load, then I show the images using vtk. The
>> problem I am facing is that I need to show images even if the complete
>> serie is not completly loaded at that time(this is a user
>> requirement), I need to show the images already loaded by the reader,
>> something like a streamed reader that if has loaded one image, the
>> display it and continue loading the rest. Is this posible?
>>
>> PS: sorry for my english.
>>
>> --
>> 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
>> -----------------------------------------------------------------
>>
>
>
> --
> 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
> -----------------------------------------------------------------
>
--
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
-----------------------------------------------------------------
More information about the vtkusers
mailing list