#include "vvAnimatedGIFWriter.h"
#include "clitkDD.h"
-#include "ximagif.h"
-
+#include <vtkVersion.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkInformation.h>
#include <vtkImageData.h>
#include <vtkImageQuantizeRGBToIndex.h>
#include <vtkImageAppend.h>
#include <vtkObjectFactory.h>
#include <vtkLookupTable.h>
+#include "ximagif.h"
+
//---------------------------------------------------------------------------
vtkStandardNewMacro(vvAnimatedGIFWriter);
void vvAnimatedGIFWriter::Write()
{
// get the data
+#if VTK_MAJOR_VERSION <= 5
this->GetInput()->UpdateInformation();
int *wExtent = this->GetInput()->GetWholeExtent();
this->GetInput()->SetUpdateExtent(wExtent);
this->GetInput()->Update();
+#elif VTK_MAJOR_VERSION >= 8 || (VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION >= 1)
+ this->UpdateInformation();
+ int *wExtent = this->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
+ this->UpdateExtent(wExtent);
+ this->Update();
+#else
+ this->UpdateInformation();
+ int *wExtent = this->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT());
+ this->SetUpdateExtent(wExtent);
+ this->Update();
+#endif
RGBslices.push_back( vtkSmartPointer<vtkImageData>::New() );
RGBslices.back()->ShallowCopy(this->GetInput());
+#if VTK_MAJOR_VERSION <= 5
RGBvolume->AddInput(RGBslices.back());
+#else
+ RGBvolume->AddInputData(RGBslices.back());
+#endif
}
//---------------------------------------------------------------------------
// Quantize to 8 bit colors
vtkSmartPointer<vtkImageQuantizeRGBToIndex> quant = vtkSmartPointer<vtkImageQuantizeRGBToIndex>::New();
quant->SetNumberOfColors(256);
+#if VTK_MAJOR_VERSION <= 5
quant->SetInput(RGBvolume->GetOutput());
+#else
+ quant->SetInputConnection(RGBvolume->GetOutputPort());
+#endif
quant->Update();
// Convert to 8 bit image
vtkSmartPointer<vtkImageCast> cast = vtkSmartPointer<vtkImageCast>::New();
+#if VTK_MAJOR_VERSION <= 5
cast->SetInput( quant->GetOutput() );
+#else
+ cast->SetInputConnection( quant->GetOutputPort() );
+#endif
cast->SetOutputScalarTypeToUnsignedChar();
cast->Update();