[vtkusers] Better way for image display

Jesse C Cronce croncejc at mrctr.upmc.edu
Fri Nov 11 12:49:34 EST 2005


All,

    I am currently using the following method to display images - what I
really need to do is display multiple images in their own windows with a 
name at the top of each window (which I can do already). I do not want the
windows to accept mouse events to change display parameters. I want to
have the program set those values, and then that's what is used.

I couldn't find another way to do this, so the hacked version is here, but
for obvious reasons this method really stinks (in fact, this is probably *the
worst* possible way to do this). I know there is a correct
way to do this, I just can't find a better way to do so on the net.

Any suggestions or pointers to examples would be greatly appreciated.

Thanks in advance,
JCC


    // HACK ALERT - using fork for this - ugh

    connector->SetInput( slice );
    vtkImageViewer *viewer = vtkImageViewer::New();
    vtkRenderWindowInteractor *inter = vtkRenderWindowInteractor::New();

    viewer->SetupInteractor( inter );
    viewer->SetInput( connector->GetOutput() );

    vtkRenderWindow *renwin = viewer->GetRenderWindow();
    //renwin->SetWindowName( const_cast< char * >(name) );
    renwin->SetWindowName( (name) );

    viewer->Render();
    viewer->SetColorWindow( 255 );
    viewer->SetColorLevel( 5 );

    pid_t me = getpid();

    fork();

    pid_t you = getpid();

    while( me != you )
    {

        inter->Render();
        sleep( 5 );

    }





More information about the vtkusers mailing list