[vtkusers] problem withvtkWin32OpenGLRenderWindow

Renaud Isabelle renauisa at yahoo.fr
Fri Jun 10 09:54:10 EDT 2005


Hi again,
 
Ok, my problem is maybe due to something else. And I hope someone could tell me what I'm really missing in all my procedure. 
 
Actually, I'm using ImageSliceViewer class to display a 3D image made of 2D slices got at different times (my 3rd dimension is the time and not Z coordinates). To select a 2D slice at one time, I use the SelectSlice method of ImageSliceViewer class. Here is a part of my code:
 
void SelectSlice( int slice )
{
  if ( ! m_Actor->GetInput() ) return;  //no image is loaded yet
 
  int MinMaxSlice[6];
  m_Actor->GetInput()->GetExtent( MinMaxSlice );
 
  if ((slice>=MinMaxSlice[4]) && (slice<=MinMaxSlice[5]))
   {
         MinMaxSlice[4] = MinMaxSlice[5] = slice;
   }
   else //here is the problem because I'm falling in this case
   {
    CString s;
    s.Format("extent: %d %d %d %d %d %d, slice=%d\n",
       MinMaxSlice[0],MinMaxSlice[1],MinMaxSlice[2],
      MinMaxSlice[3],MinMaxSlice[4],MinMaxSlice[5],
     slice);
    AfxMessageBox(s);
   }
   
m_Actor->SetDisplayExtent(MinMaxSlice);
}
 
My 3D image is of dimensions 1552*128*167.
The first slice choosen to display is the first frame. However, when I'm triing to change the slice to display, always the first slice is displayed. That'why I check the value of m_Actor->GetInput()
->GetExtent( MinMaxSlice ); 
 
Here is the result: 0 1551 0 127 0 0. !!!!!!!!!!!!!!!!!!!
 
So it seems that m_Actor->SetDisplayExtent(MinMaxSlice) change the extent of my m_Actor->GetInput() definitivly.
 
When I'm calling Render(), the input shouldn't call again, so that m_Actor->GetInput()->GetExtent() will always return me 0 1551 0 127 0 167 ?
 
Maybe there's really something wrong when I'm calling Render()
 
Please help
Isa

Goodwin Lawlor <goodwin.lawlor at ucd.ie> a écrit :
Try this before you call a Write()

renSrc->Modified();

hth

Goodwin


"Renaud Isabelle" wrote in message
news:20050609203658.51819.qmail at web26105.mail.ukl.yahoo.com...
Don't anyone have a solution? I really don't manage to solve this.

Why just this 2 lines added could change something?

Please
Isa

Renaud Isabelle a écrit :
Hi,

I read your code example and I think this could help me because this seems
to be right.

- When I display directly on screen, the image "essai.bmp" saved is the
exact copy of what is rendered on screen: here is my code where everything
is fine:

// render to memory with m_pRenderWindow as a vtkWin32OpenGLRenderWindow.
m_pRenderWindow->Render();

vtkWindowToImageFilter* renSrc = vtkWindowToImageFilter::New();
renSrc->SetInput(m_pRenderer);
vtkBMPWriter* writer = vtkBMPWriter::New();
writer->SetInput(renSrc->GetOutput());
writer->SetFileName("essai.bmp");
writer->Write();

- However, to avoid flickering on screen, I want to render off screen by
double buffering. Here is the new code. Just is added the line

// render to memory with m_pRenderWindow as a vtkWin32OpenGLRenderWindow.
int *size = m_pRenderWindow->GetSize();
m_pRenderWindow->SetupMemoryRendering(size[0], size[1],
GetDC() ->GetSafeHdc());
m_pRenderWindow->Render();

vtkWindowToImageFilter* renSrc = vtkWindowToImageFilter::New();
renSrc->SetInput(m_pRenderer);
vtkBMPWriter* writer = vtkBMPWriter::New();
writer->SetInput(renSrc->GetOutput());
writer->SetFileName("essai.bmp");
writer->Write();

m_pRenderWindow->ResumeScreenRendering();

Problem: The image saved in essai.bmp is white. How could this be? I really
don't understand.I check class vtkWin32OpenGLRenderWindow and I am stuck on
this problem for 3 days.

Please help
Isa


Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici ! _______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici !



_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users



_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

		
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050610/bde1ba40/attachment.htm>


More information about the vtkusers mailing list