[vtkusers] Input to/output from vtkRencerLaargeImage apparently not refreshing

Steve Chall stevec at renci.org
Thu Apr 3 13:44:58 EDT 2008


Fred,

Thanks for your reply.  Your suggestion to force update by calling Update()
makes excellent sense, but unfortunately it didn’t seem to visibly change
program behavior.  However, it inspired me to try an even more brute-force
approach that did work.  Since the problem was apparently that I couldn’t
get the vtkRenderLargeImage object to respond to new input data after the
0th loop iteration, perhaps I could force the issue by deleting the object
after each iteration and creating a new one for the next.   Thus, the new
object would be forced to access the new input data because it simply
wouldn’t have any previous data available.  It’s crude but it does the job,
and the system resource hit for the per-loop-iteration New() and Delete()
isn’t big enough in my little app to impinge noticeably on performance.  So
thanks again for kickstarting me to a solution.

 

-Steve 

 

  _____  

From: Frederic DANESI [mailto:frederic.danesi at dinccs.com] 
Sent: Thursday, April 03, 2008 3:24 AM
To: 'Steve Chall'
Subject: RE: [vtkusers] Input to/output from vtkRencerLaargeImage apparently
not refreshing

 

Hi Steve

 

I guess that the difference is that you use the input/output scheme for
bigRender and not for WindowToImage 
By the way, I suggest you to try this :

Simply call manually the Update() method before trying to write the
bigRender :

 

                


sprintf(fileName, “big%d.png”, i);

bigRender->Update();

            pngWriter->SetInput(bigRender->GetOutput());

            pngWriter->SetFileName(fileName);

            pngWriter->Write(); // Uh-oh:  every image is just big0.png over
again for all i.

                
.

 

Fred.

 

De : vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] De la part
de Steve Chall
Envoyé : mercredi 2 avril 2008 23:02
À : vtkusers at vtk.org
Cc : 'Theresa-Marie Rhyne'
Objet : [vtkusers] Input to/output from vtkRencerLaargeImage apparently not
refreshing

 

Fellow VTK fans,

I’ve written an app that generates a sequence of images in a loop, taking
progressive slices through a sampled volume of data.  That part is working
just fine using a vtkWindowToImageFilter as input to a vtkPNGWriter.
However, when I try to generate a sequence of images alongside that first
sequence, each of which is identical to its corresponding image in the first
sequence except much bigger (this second sequence uses vtkRenderLargeImage,
instead of vtkWindowToImageFilter, as an input to vtkPNGWriter), then the
0th big image is just fine but all subsequent big images are just the 0th
image repeated over again.  

 

I’ve tried lots of variants on this scheme, like using different objects
(vtkPNGWriter, etc.) for each, and hooking them up using
SetInput(xxx->SetOutput) vs. SetInputConnection(xxx->GetOutputPort()) with
no change.  I’d appreciate it if someone more familiar with
vtkRenderLargeImage could look at the following – extracted from actual code
and adapted to highlight this specific problem, hopefully without fatal
typos or omissions – and tell me what might be wrong.  Thanks very much.

 

-Steve

 

//  
general C++/VTK setup and boilerplate above this point

 

pngWriter = vtkPNGWriter::New();

windowToImageFilter = vtkWindowToImageFilter::New();

bigRender = vtkRenderLargeImage::New();

renWin = vtkRenderWindow::New();

ren = vtkRenderer::New();

char fileName[255];

 

renWin->AddRenderer(ren);

renWin->SetSize(640, 480);

 

bigRender->SetInput(ren);

bigRender->SetMagnification(5);

 

for (int i = 0; i < numSlices; i++)

{

SetUpNextImage(i);  // prepare the image for rendering.  This works fine for
small<i>.png.

 

pngWriter->SetInput(windowToImageFilter->GetOutput());

 

sprintf(fileName, “small%d.png”, i);

pngWriter->SetFileName(fileName);

windowToImageFilter->SetInput(renWin);

diskRenWin->Render();

pngWriter->Write(); // Beautiful:  small<i>.png just as I’d expect.

 

sprintf(fileName, “big%d.png”, i);

            pngWriter->SetInput(bigRender->GetOutput());

            pngWriter->SetFileName(fileName);

            pngWriter->Write(); // Uh-oh:  every image is just big0.png over
again for all i.

}

 

 

-Steve Chall

 Senior Research Software Developer

 Renaissance Computing Institute

 Phone: 919-515-0051

 Email: stevec at renci.org

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080403/d30a29c7/attachment.htm>


More information about the vtkusers mailing list