[vtkusers] about vtkGDCMImageReader
Jérôme
jerome.velut at gmail.com
Mon Feb 1 03:23:41 EST 2010
Hi,
I don't know about streaming and GDCM, but one workaround to your problem
would:
- Instanciate one GDCM reader per file : so that you can visualize each file
with appropriate rendering pipeline
- Instanciate a vtkImageAppend with inputs being readers outputs. eg:
### loop over the gdcm readers
for reader in gdcmReadersList:
imageAppend.AddInputConnection( reader.GetOutputPort( ) )
### update imageAppend
imageAppend.Update( )
It implies that your readers' list is correctly sorted before you append
them, but it seems that it is your case (by reading your code).
HTH
Jerome
2010/1/29 Lic. José M. Rodriguez Bacallao <jmrbcu at gmail.com>
> 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
> -----------------------------------------------------------------
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100201/d380cd18/attachment.htm>
More information about the vtkusers
mailing list