[vtkusers] Extend Imagestack dynamically

Andreas Klos aklos at outlook.de
Mon Mar 14 03:58:23 EDT 2016


Hello David,


Thank you for your fast reply. I have tried your recommendations. You were right, i do not need vtkImageStack for my purposes and the hint with InsertNextValue() was also really helpful. But this recommended changes of my code does not solve my problem. I think the issue lies in the combined usage of Qt and VTK. Because i try to extend my „imagestack“ out of a SLOT. Could that cause my issue? Or is there something else which i am doing wrong?

Nonetheless i solved the problem through the usage of ITK. At the moment i am loading my imagestack through itk::ImageSeriesReader and export my imagedata to VTK.

 

Best regards,
Andreas

 

Von: David Gobbi [mailto:david.gobbi at gmail.com] 
Gesendet: Freitag, 11. März 2016 15:15
An: Andreas Klos
Cc: vtkusers at vtk.org
Betreff: Re: [vtkusers] Extend Imagestack dynamically

 

Hi Andreas,

 

You are correct that vtkStringArray is causing problems.  Do not use InsertValue().  Use InsertNextValue() instead:

 

  filenameArray->InsertNextValue(_firstFilename.c_str());

 

Do not call filenameArray->SetNumberOfValues(1) in your constructor. And do not use a "counter" variable: if you want to know how many files are in the array, use filenameArray->GetNumberOfValues();

 

I do not think your program needs vtkImageStack.  If you remove it from your program, and add vtkImageSlice directly to your renderer, you will probably get what you need.  The following wiki page describes the purpose of vtkImageStack:

http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes

 

 - David

 

On Fri, Mar 11, 2016 at 3:53 AM, Andreas Klos <aklos at outlook.de <mailto:aklos at outlook.de> > wrote:

 Dear great VTK-Comunity,
I am actually trying to use vtkImageStack to create a imagestack of .png-Images. This seems to be very easy through VTK but it seem to be a bit harder when the Imagestack becomes extended dynamically. I'm working with Qt-plugin for visualstudio and VTK Version 7.0. When an Image is in the folder for visualisation purposes my Qt- GUI emits a Signal and transmit the full filename(path+filename) to a SLOT of my QVTK widget. If the SIGNAL is emitted the first time, my QVTK widget becomes created. The QVTK widget contains a Object of my visualisation pipeline  and executes the visualisation  pipeline through the call of the construtor. Till there, everything seems to work fine. The First Image is represented well. In Addition i should mention that the object of my visualisation pipeline has a method which should extend my imagestack. So if the SIGNAL is emitted again the SLOT of my QVTK widget should call this method. this is also well done. But it seems that the vtkStringArray of my visualisation pipline is not Extended with the new filename. so i can still just visualize the first Image. The Code of my visualisation Pipeline is shown below.

It would be greatful if somebody can help me or give me a hint if i had coded something wrong or if there is a better Approach of how to extend the imagestack dynamically.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160314/63f7da10/attachment.html>


More information about the vtkusers mailing list