[vtkusers] VS: Rewirte vtkImageData

Hämäläinen Janne Janne.Hamalainen at hus.fi
Fri Aug 15 03:33:38 EDT 2003


No, if you want the pipeline to update you need to have all the objects
along the pipeline available. If you remove the original image, the pipeline
will break down. On the other hand, if you are concerned about the memory
usage, you can remove the intermediate results by setting
ReleaseDataFlagOn() (method in vtkImageData) for your self.image. Look more
info at:

http://public.kitware.com/cgi-bin/vtkfaq?req=show&file=faq03.007.htp

this way the pipeline will release the memory used by self.image after the
pipeline has executed. I'm not exactly sure, if this is what you are
concerned about...

-Janne

> ----------
> Lähettäjä: 	Yi-Yu Chou[SMTP:chouyiyu at hotmail.com]
> Lähetetty: 	14. elokuuta 2003 18:13
> Vastaanottaja: 	Janne.Hamalainen at hus.fi
> Kopio: 	vtkusers at vtk.org
> Aihe:  	Re: Rewirte vtkImageData
> 
> Hi Janne,
> 
> Thanks for your suggestions.
> For the second model, is it possible to "clean" self.image before
> rewriting 
> 
> self.reslice to it ? Therefore, my code would be like :
>                 ..................................(skip)
>  	        img_reslice.SetInput(self.image)
>                 ..................................(skip)
>          	img_reslice.SetResliceTransform(img_transform)
>                 clean_img(self.image)   ????    
>                 .................................. 
>         	self.image = img_reslice.GetOutput()    
> If possible, how to set "clean_img" ?
> thanks !!!!
> 
> YY
> 
> >
> >As I understand (someone can correct, if I'm wrong), if you deepcopy the
> >contents of your reslice output to your original vtkImageData:
> >
> >	1.	        self.image.DeepCopy(img_reslice.GetOutput())
> >
> >the vtkImageReslice doesn't update, because the visualization pipeline
> >doesn't have any knowledge about it (it has only reference to the object
> >that lies before reslice, and that is passed to display). On the other 
> hand,
> >if you copy a reference of the output to your original image:
> >
> >	2.	#	self.image = img_reslice.GetOutput()      # doesn't
> >work either
> >
> >you have an infinite loop
> >(self.image->img_reslice->self.image->img_reslice...); I don't remember 
> what
> >vtk does in this kind of situation.
> >
> >So, my suggestion is to use the second model (2.), but make an own object
> >for the transformed image instead of copying it to self.image. That way,
> >your pipeline will be complete. Hope this helps,
> >
> >-Janne
> >
> >
> >--
> >Janne H???nen
> >Research Assistant
> >Helsinki University Central Hospital
> >X-ray Department
> >
> >email   janne.hamalainen at hus.fi
> >
> >
> > > ----------
> > > L?ett?�: 	Yi-Yu Chou[SMTP:chouyiyu at hotmail.com]
> > > L?etetty: 	13. elokuuta 2003 23:56
> > > Vastaanottaja: 	vtkusers at vtk.org
> > > Aihe:  	?tkusers� Rewirte vtkImageData
> > >
> > > Hi all,
> > >
> > > I tried to rewrite the transformed image back into the original
> > > vtkImageData, but
> > > nothing happened after transform. ( the image was unchanged)
> > > My code :
> > > 		img_transform = vtkTransform()
> > > 		img_transform.RotateX(-10)
> > > 		img_reslice = vtkImageReslice()
> > > 		img_reslice.SetInput(self.image)
> > >
> > > img_reslice.SetOutputSpacing(img_reslice.GetInput().GetSpacing())
> > >
> > > img_reslice.SetOutputOrigin(img_reslice.GetInput().GetOrigin())
> > >
> > > img_reslice.SetOutputExtent(img_reslice.GetInput().GetWholeExtent())
> > > 		img_reslice.SetResliceTransform(img_transform)
> > > 		img_reslice.SetInterpolationModeToCubic()
> > > 		img_reslice.Update()
> > > 	#	self.image = img_reslice.GetOutput()      # doesn't work
> > > either
> > > 	        self.image.DeepCopy(img_reslice.GetOutput())
> > > 		self.Update_Display()    # update the scene
> > >
> > > Any suggestions ?????
> > > Thanks !!!!
> > >
> > > YY
> > >
> > > _________________________________________________________________
> > > ?? MSN ??:?????????????????
> > > http://groups.msn.com?pgmarket=zh-tw
> > >
> > > _______________________________________________
> > > This is the private VTK discussion list.
> > > Please keep messages on-topic. Check the FAQ at:
> > > <http://public.kitware.com/cgi-bin/vtkfaq>
> > > Follow this link to subscribe/unsubscribe:
> > > http://www.vtk.org/mailman/listinfo/vtkusers
> > >
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
> 
> _________________________________________________________________
> ???? MSN ????:?????????? http://www.msn.com.tw/english/ 
> 



More information about the vtkusers mailing list