[Insight-users] Re: AW: AW: AW: Visualizing a binary itk-Image
Luis Ibanez
luis.ibanez@kitware.com
Wed, 12 Mar 2003 12:05:25 -0500
Hi Zein,
Thanks for looking at the values.
Here is the problem:
You should not use the vtkRenderWindowInteractor
when you are building an application that has its own
GUI. The interactor is taking over the management of
events and not letting any event get to the FLTK
event manager.
Please use the class contributed by Charles P. Botha:
vtkFlRenderWindowInteractor
It attaches a VTK render window to a FL_GL_Window.
This class is in
InsightApplications/Auxiliary/VtkFltk.
You will have the same problem with any other GUI
system. (e.g. Qt, wxWindows....) Only one system
should take over the event loop.
--
Luis
---------------------------------------------
salah wrote:
> Hi Luis,
>
> The values are just correct. I always use this file and know it well. Is I comment the green code, the viewer works just fine.
>
>
> VolumeReaderType::Pointer in_Reader = VolumeReaderType::New();
> in_Reader->SetFileName( "/data/RawFiles/smallmastoid.mhd" );
> in_Reader->Update();
> this->ShowImage( in_Reader->GetOutput(), "Original Image" ); // Luis, this function just calls
> // a traditional FltkImageViewer
>
> ImageType::Pointer m_Image = in_Reader->GetOutput();
>
> //------------------------------------------------------------------------
> // ITK to VTK pipeline
> //------------------------------------------------------------------------
>
> typedef itk::ImageToVTKImageFilter<ImageType> Itk2VtkType;
> Itk2VtkType::Pointer m_Itk2Vtk = Itk2VtkType::New();
>
> m_Itk2Vtk->SetInput(m_Image); // m_Reader reads a binary image
>
>
>
> //------------------------------------------------------------------------
> // VTK pipeline.
> //------------------------------------------------------------------------
>
> // Create a vtkImageActor to help render the image.
> vtkImageActor* actor = vtkImageActor::New();
> actor->SetInput(m_Itk2Vtk->GetOutput());
> actor->SetZSlice(50);
>
> // Create a renderer, render window, and render window interactor to display the results.
> vtkRenderer* renderer = vtkRenderer::New();
> vtkRenderWindow* renWin = vtkRenderWindow::New();
> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
>
> renWin->SetSize(500, 500); // if I comment the code from now,
> renWin->AddRenderer(renderer); // the fltk viewer works fine
> iren->SetRenderWindow(renWin);
>
> // Add the vtkImageActor to the renderer for display.
> renderer->AddActor(actor);
> renderer->SetBackground(0.4392, 0.5020, 0.5647);
>
> // Bring up the render window and begin interaction.
> renWin->Render();
> iren->Start();
>
>
> // VTK does not use smart pointers, so we must clean up its pipeline
> // explicitly.
> iren->Delete();
> renWin->Delete();
> renderer->Delete();
> actor->Delete();
>
> Thanks,
>
> Zein
>
> -----Ursprüngliche Nachricht-----
> Von: Luis Ibanez [mailto:luis.ibanez@kitware.com]
> Gesendet: Mittwoch, 12. März 2003 17:26
> An: salah
> Cc: insight-users@public.kitware.com
> Betreff: Re: AW: AW: Visualizing a binary itk-Image
>
>
>
> Hi Zein,
>
> That just look like the viewer is receiving a volume
> which only has one slice. Please look at the orange
> letters that are printed on top of the image window.
>
> The image dimension (in pixels) and the pixel spacing
> are shown there.
>
> Please let us know what values you find
>
>
> Thanks
>
> Luis
>
>
> ---------------------------
>
> salah wrote:
>
>>Thanks Luis,
>>
>>ZES, I mean VTK 4.2. Sorry for the error.
>>
>>I am talking about the traditional FltkImageViewer, it does NOT hang.
>>When you press a buttom, it is pressed. When you move the slider,
>>it moves normally. BUT, the viewing window/Widget does not change, it
>>remains just frozen.
>>
>>Thanks,
>>
>>Zein
>>
>>
>
>
>