#include "vtkVersion.h"
#include "vtkImageViewer.h"
#include "vtkImageMapper3D.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkImageActor.h"
#include "vtkInteractorStyleImage.h"
#include "vtkRenderer.h"
static void
static void
int
main()
{
CreateImage1(image1);
CreateImage2(image2);
subtractFilter->SetInput1(image1);
subtractFilter->SetInput2(image2);
subtractFilter->Update();
connector1->SetInput(image1);
#if VTK_MAJOR_VERSION <= 5
actor1->SetInput(connector1->GetOutput());
#else
connector1->Update();
actor1->GetMapper()->SetInputData(connector1->GetOutput());
#endif
connector2->SetInput(image2);
#if VTK_MAJOR_VERSION <= 5
actor2->SetInput(connector2->GetOutput());
#else
connector2->Update();
actor2->GetMapper()->SetInputData(connector2->GetOutput());
#endif
subtractConnector->SetInput(subtractFilter->GetOutput());
#if VTK_MAJOR_VERSION <= 5
subtractActor->SetInput(subtractConnector->GetOutput());
#else
subtractConnector->Update();
subtractActor->GetMapper()->SetInputData(subtractConnector->GetOutput());
#endif
renderWindow->SetSize(900, 300);
interactor->SetRenderWindow(renderWindow);
double leftViewport[4] = { 0.0, 0.0, 0.33, 1.0 };
double centerViewport[4] = { 0.33, 0.0, 0.66, 1.0 };
double rightViewport[4] = { 0.66, 0.0, 1.0, 1.0 };
renderWindow->AddRenderer(leftRenderer);
leftRenderer->SetViewport(leftViewport);
leftRenderer->SetBackground(.6, .5, .4);
renderWindow->AddRenderer(centerRenderer);
centerRenderer->SetViewport(centerViewport);
centerRenderer->SetBackground(.4, .5, .6);
renderWindow->AddRenderer(rightRenderer);
rightRenderer->SetViewport(rightViewport);
rightRenderer->SetBackground(.4, .5, .6);
leftRenderer->AddActor(actor1);
centerRenderer->AddActor(actor2);
rightRenderer->AddActor(subtractActor);
leftRenderer->ResetCamera();
centerRenderer->ResetCamera();
rightRenderer->ResetCamera();
renderWindow->Render();
interactor->SetInteractorStyle(style);
interactor->Start();
return EXIT_SUCCESS;
}
void
{
start[0] = 0;
start[1] = 0;
unsigned int NumRows = 200;
unsigned int NumCols = 300;
size[0] = NumRows;
size[1] = NumCols;
region.SetIndex(start);
image->SetRegions(region);
image->Allocate();
for (unsigned int r = 20; r < 80; ++r)
{
for (unsigned int c = 20; c < 80; ++c)
{
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 15);
}
}
}
void
{
start[0] = 0;
start[1] = 0;
unsigned int NumRows = 200;
unsigned int NumCols = 300;
size[0] = NumRows;
size[1] = NumCols;
region.SetIndex(start);
image->SetRegions(region);
image->Allocate();
for (unsigned int r = 40; r < 100; ++r)
{
for (unsigned int c = 40; c < 100; ++c)
{
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 15);
}
}
}