Commit c46925a8 authored by Ken Martin's avatar Ken Martin
Browse files

now uses new cached pipeline executive

parent 6a81cbc5
......@@ -17,8 +17,9 @@
#include "vtkImageData.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkCachedStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkImageCacheFilter, "1.21");
vtkCxxRevisionMacro(vtkImageCacheFilter, "1.22");
vtkStandardNewMacro(vtkImageCacheFilter);
//----------------------------------------------------------------------------
......@@ -29,6 +30,8 @@ vtkImageCacheFilter::vtkImageCacheFilter()
this->Times = NULL;
this->SetCacheSize(10);
this->SetExecutive(this->CreateDefaultExecutive());
this->vtkSource::SetNthOutput(0,vtkImageData::New());
}
//----------------------------------------------------------------------------
......@@ -37,6 +40,11 @@ vtkImageCacheFilter::~vtkImageCacheFilter()
this->SetCacheSize(0);
}
//----------------------------------------------------------------------------
vtkExecutive* vtkImageCacheFilter::CreateDefaultExecutive()
{
return vtkCachedStreamingDemandDrivenPipeline::New();
}
//----------------------------------------------------------------------------
void vtkImageCacheFilter::PrintSelf(ostream& os, vtkIndent indent)
......@@ -63,6 +71,14 @@ void vtkImageCacheFilter::PrintSelf(ostream& os, vtkIndent indent)
//----------------------------------------------------------------------------
void vtkImageCacheFilter::SetCacheSize(int size)
{
#ifdef VTK_USE_EXECUTIVES
vtkCachedStreamingDemandDrivenPipeline *csddp =
vtkCachedStreamingDemandDrivenPipeline::SafeDownCast(this->GetExecutive());
if (csddp)
{
csddp->SetCacheSize(size);
}
#else
int idx;
if (size == this->CacheSize)
......@@ -106,8 +122,16 @@ void vtkImageCacheFilter::SetCacheSize(int size)
this->Data[idx] = NULL;
this->Times[idx] = 0;
}
#endif
}
#ifdef VTK_USE_EXECUTIVES
//----------------------------------------------------------------------------
// This method simply copies by reference the input data to the output.
void vtkImageCacheFilter::ExecuteData(vtkDataObject *outObject)
{
}
#else
//----------------------------------------------------------------------------
// This method simply copies by reference the input data to the output.
void vtkImageCacheFilter::UpdateData(vtkDataObject *outObject)
......@@ -216,6 +240,4 @@ void vtkImageCacheFilter::UpdateData(vtkDataObject *outObject)
}
}
}
#endif
......@@ -13,19 +13,20 @@
=========================================================================*/
// .NAME vtkImageCacheFilter - Caches multiple vtkImageData objects.
// .SECTION Description
// vtkImageCacheFilter keep a number of vtkImageDataObjects from previous updates
// to satisfy future updates without needing to update the input.
// It does not change the data at all.
// It just makes the pipeline more efficient at the expense of using extra memory.
// .SECTION Description
// vtkImageCacheFilter keep a number of vtkImageDataObjects from previous
// updates to satisfy future updates without needing to update the input. It
// does not change the data at all. It just makes the pipeline more
// efficient at the expense of using extra memory.
#ifndef __vtkImageCacheFilter_h
#define __vtkImageCacheFilter_h
#include "vtkImageToImageFilter.h"
class vtkExecutive;
class VTK_IMAGING_EXPORT vtkImageCacheFilter : public vtkImageToImageFilter
{
public:
......@@ -39,15 +40,24 @@ public:
void SetCacheSize(int size);
vtkGetMacro(CacheSize, int);
#ifndef VTK_USE_EXECUTIVES
// Description:
// This is an internal method that you should not call.
void UpdateData(vtkDataObject *outData);
#endif
protected:
vtkImageCacheFilter();
~vtkImageCacheFilter();
int CacheSize;
// Create a default executive.
virtual vtkExecutive* CreateDefaultExecutive();
#ifdef VTK_USE_EXECUTIVES
virtual void ExecuteData(vtkDataObject *);
#endif
vtkImageData **Data;
// I do not have write access to UpdateTime.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment