[vmtk-users] R: R: Removing an object
Brought to you by:
davidsteinman,
lucantiga
From: Zampini S. <sam...@ep...> - 2009-10-30 08:52:49
|
Dear Luca, actually what you suggested is not exactly what I wanted to do. I solved my problem like this: def VOI(self, input_filename, output_filename): self.vmtkImageVOISelector = vmtkimagevoiselector.vmtkImageVOISelector() self.vmtkImageVOISelector.Image = self.vmtkImageViewer.Image self.vmtkImageVOISelector.vmtkRenderer = self.vmtkImageViewer.vmtkRenderer self.vmtkImageVOISelector.Interactive = 1 self.vmtkImageViewer.PlaneWidgetX.Off() self.vmtkImageViewer.PlaneWidgetY.Off() self.vmtkImageViewer.PlaneWidgetZ.Off() # self.vmtkImageWriter = vmtkimagewriter.vmtkImageWriter() # self.vmtkImageWriter.OutputFileName = self.subdir + "/" + output_filename + "_VoI.vti" # self.vmtkImageWriter.Input = input_filename + ".vti" # self.vmtkImageWriter.OutputFileName = output_filename + "_VoI.vti" # print "Il file di output e': " + self.vmtkImageWriter.OutputFileName # self.vmtkImageWriter.Execute() print "Press i to activate the volume selector and q (twice) when you have done" print " " self.vmtkImageVOISelector.Execute() So that when I select a VoI the "old" image (that I had from the vmtkimageviewer command) disappers. The problem I am facing now, instead, is on how to use the vmtkimagewriter function... The commented line do not work... Could anyone help with this? Thanks a lot, Samuele. ________________________________________ Da: Luca Antiga [luc...@gm...] Inviato: giovedì 29 ottobre 2009 11.50 A: Zampini Samuele Cc: vmt...@li... Oggetto: Re: [vmtk-users] R: Removing an object Dear Samuele, you should call the DeepCopy only after self.vmtkImageVOISelector.Execute() since only after that call you'll have the new VOI volume ready to render. Regards Luca On Oct 29, 2009, at 11:39 AM, Zampini Samuele wrote: Dear Luca, I think that 2nd option is the way. Actually, I do have to fix the code, but I am following that path. What do you think about doing: ## function that allows us to view the .vti image just created # @param self The object pointer # @param input_filename The name of the .vti file we want to view (inserted from the user) def imageviewer(self, input_filename): self.vmtkImageReader = vmtkimagereader.vmtkImageReader() self.vmtkImageReader.InputFileName = self.subdir + "/" + input_filename + ".vti" self.vmtkImageReader.Execute() self.vmtkImageViewer = vmtkimageviewer.vmtkImageViewer() self.vmtkImageViewer.Image = self.vmtkImageReader.Image self.vmtkImageViewer.vmtkRenderer = self.vmtkRenderer print " " print " " print "Press q to re-activate the interaction with the GUI" print " " self.vmtkImageViewer.Execute() def DICOMinteract(self): if self.vmtkImageViewer: self.vmtkImageViewer.Execute() else: print "Image not loaded yet" ## function that allows us to select a volume of interest # @param self The object pointer # @param input_filename The name of the .vti file we want to use # @param output_filename The name we want to give to the output file (after having selected a VoI) def VOI(self, input_filename, output_filename): # self.vmtk.vmtkImageViewer.vmtkRenderer.RemoveAllViewProps() # vmtkImageReader = vmtkimagereader.vmtkImageReader() # vmtkImageReader.InputFileName = self.subdir + "/" + input_filename + ".vti" # vmtkImageReader.Execute() self.vmtkImageVOISelector = vmtkimagevoiselector.vmtkImageVOISelector() self.vmtkImageViewer.Image.DeepCopy(self.vmtkImageVOISelector.Image) #self.vmtkImageVOISelector.Image = self.vmtkImageReader.Image self.vmtkImageVOISelector.vmtkRenderer = self.vmtkRenderer print "Presso i to activate the volume selector and q (twice) when you have done" print " " self.vmtkImageVOISelector.Execute() It what I did, what you meant? Thanks a lot, Samuele ________________________________________ Da: Luca Antiga [luc...@gm...<mailto:luc...@gm...>] Inviato: giovedì 29 ottobre 2009 11.29 A: Zampini Samuele Cc: vmt...@li...<mailto:vmt...@li...> Oggetto: Re: [vmtk-users] Removing an object Hi Samuele, to replace the original image with the new image, just assign the new image to vmtkImageViewer.Image, for example self.vmtkImageViewer.Image = voiImage and then call vmtkImageViewer.Execute() Alternatively, if it's ok for you to lose the original image and get rid of it for memory efficiency purposes, just do self.vmtkImageViewer.Image.DeepCopy(voiImage) Let me know if either of the above solve your problem. Regards Luca On Oct 29, 2009, at 10:29 AM, Zampini Samuele wrote: Dear all, I have a question for you. I am trying to use vmtk in a GUI that I created. After having used the vmtkimageviewer I would like to do the selection of a volume of interest. The very problem is that when I press the "Select VoI" button I got in my window 2 images (better, two copies of the same image)... The code is the following: ## function that allows us to view the .vti image just created # @param self The object pointer # @param input_filename The name of the .vti file we want to view (inserted from the user) def imageviewer(self, input_filename): self.vmtkImageReader = vmtkimagereader.vmtkImageReader() self.vmtkImageReader.InputFileName = self.subdir + "/" + input_filename + ".vti" self.vmtkImageReader.Execute() self.vmtkImageViewer = vmtkimageviewer.vmtkImageViewer() self.vmtkImageViewer.Image = self.vmtkImageReader.Image self.vmtkImageViewer.vmtkRenderer = self.vmtkRenderer print " " print " " print "Press q to re-activate the interaction with the GUI" print " " self.vmtkImageViewer.Execute() def DICOMinteract(self): if self.vmtkImageViewer: self.vmtkImageViewer.Execute() else: print "Image not loaded yet" ## function that allows us to select a volume of interest # @param self The object pointer # @param input_filename The name of the .vti file we want to use # @param output_filename The name we want to give to the output file (after having selected a VoI) def VOI(self, input_filename, output_filename): # vmtkImageReader = vmtkimagereader.vmtkImageReader() # vmtkImageReader.InputFileName = self.subdir + "/" + input_filename + ".vti" # vmtkImageReader.Execute() self.vmtkImageVOISelector = vmtkimagevoiselector.vmtkImageVOISelector() self.vmtkImageVOISelector.Image = self.vmtkImageReader.Image self.vmtkImageVOISelector.vmtkRenderer = self.vmtkRenderer print "Presso i to activate the volume selector and q (twice) when you have done" print " " self.vmtkImageVOISelector.Execute() Well, the question is: how can I remove the former image? Thanks a lot, Samuele ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ vmtk-users mailing list vmt...@li... https://lists.sourceforge.net/lists/listinfo/vmtk-users -- Luca Antiga, PhD Head, Medical Imaging Unit, Biomedical Engineering Department, Mario Negri Institute. mail: Villa Camozzi, 24020, Ranica (BG), Italy phone: +39 035 4535-381 email: an...@ma...<mailto:an...@ma...> web: http://villacamozzi.marionegri.it/~luca ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ vmtk-users mailing list vmt...@li... https://lists.sourceforge.net/lists/listinfo/vmtk-users -- Luca Antiga, PhD Head, Medical Imaging Unit, Biomedical Engineering Department, Mario Negri Institute. mail: Villa Camozzi, 24020, Ranica (BG), Italy phone: +39 035 4535-381 email: an...@ma...<mailto:an...@ma...> web: http://villacamozzi.marionegri.it/~luca |