diff --git a/Rendering/vtkFreeTypeUtilities.cxx b/Rendering/vtkFreeTypeUtilities.cxx index 01befe9996862a07488f9f99f446a7a0242c5c03..e31c93942fa1ba6ad843121bea59945ad3448b11 100644 --- a/Rendering/vtkFreeTypeUtilities.cxx +++ b/Rendering/vtkFreeTypeUtilities.cxx @@ -1291,12 +1291,6 @@ int vtkFreeTypeUtilities::RenderString(vtkTextProperty *tprop, return 0; } - if (data->GetNumberOfScalarComponents() > 4) - { - vtkErrorMacro("The image data must have a maximum of four components"); - return 0; - } - // Prepare the ImageData to receive the text int x = 0; int y = 0; @@ -1786,8 +1780,6 @@ void vtkFreeTypeUtilities::PrepareImageData(vtkImageData *data, // If the RGBA image data is too small, resize it to the next power of 2 // WARNING: at this point, since this image is going to be a texture // we should limit its size or query the hardware - data->SetScalarTypeToUnsignedChar(); - data->SetNumberOfScalarComponents(4); data->SetSpacing(1.0, 1.0, 1.0); // If the current image data is too small to render the text, @@ -1795,7 +1787,9 @@ void vtkFreeTypeUtilities::PrepareImageData(vtkImageData *data, int img_dims[3], new_img_dims[3]; data->GetDimensions(img_dims); - if (img_dims[0] < text_size[0] || img_dims[1] < text_size[1] || + if (data->GetScalarType() != VTK_UNSIGNED_CHAR || + data->GetNumberOfScalarComponents() != 4 || + img_dims[0] < text_size[0] || img_dims[1] < text_size[1] || text_size[0] * 2 < img_dims[0] || text_size[1] * 2 < img_dims[0]) { new_img_dims[0] = 1 << static_cast<int>(ceil(log(static_cast<double>(text_size[0])) / log(2.0))); @@ -1816,10 +1810,7 @@ void vtkFreeTypeUtilities::PrepareImageData(vtkImageData *data, new_img_dims[2] != img_dims[2]) { data->SetDimensions(new_img_dims); - data->AllocateScalars(); - data->UpdateInformation(); - data->SetUpdateExtent(data->GetWholeExtent()); - data->PropagateUpdateExtent(); + data->AllocateScalars(VTK_UNSIGNED_CHAR, 4); } } diff --git a/Rendering/vtkIVExporter.cxx b/Rendering/vtkIVExporter.cxx index 6af2d4bfd0e967a3f53a0bb3d7266f30517c880e..bc619d1efe69ce284764ee8d30224fb900e94c51 100644 --- a/Rendering/vtkIVExporter.cxx +++ b/Rendering/vtkIVExporter.cxx @@ -298,7 +298,7 @@ void vtkIVExporter::WriteAnActor(vtkActor *anActor, FILE *fp) } else { - ds->Update(); + anActor->GetMapper()->GetInputAlgorithm()->Update(); pd = static_cast<vtkPolyData *>(ds); } @@ -354,7 +354,7 @@ void vtkIVExporter::WriteAnActor(vtkActor *anActor, FILE *fp) vtkErrorMacro(<< "texture has no input!\n"); return; } - aTexture->GetInput()->Update(); + aTexture->GetInputAlgorithm()->Update(); size = aTexture->GetInput()->GetDimensions(); scalars = aTexture->GetInput()->GetPointData()->GetScalars(); diff --git a/Rendering/vtkImageActor.cxx b/Rendering/vtkImageActor.cxx index b3a8d32b2ee13f8516b91fee95890b2d39491434..8cb3b00941700b45310358f19656ddd6851b41c4 100644 --- a/Rendering/vtkImageActor.cxx +++ b/Rendering/vtkImageActor.cxx @@ -21,6 +21,8 @@ #include "vtkRenderer.h" #include "vtkImageProperty.h" #include "vtkImageSliceMapper.h" +#include "vtkInformation.h" +#include "vtkStreamingDemandDrivenPipeline.h" vtkStandardNewMacro(vtkImageActor); @@ -74,6 +76,17 @@ void vtkImageActor::SetInput(vtkImageData *input) } } +//---------------------------------------------------------------------------- +vtkAlgorithm *vtkImageActor::GetInputAlgorithm() +{ + if (!this->Mapper) + { + return 0; + } + + return this->Mapper->GetInputAlgorithm(); +} + //---------------------------------------------------------------------------- vtkImageData *vtkImageActor::GetInput() { @@ -240,23 +253,33 @@ void vtkImageActor::GetDisplayExtent(int extent[6]) // Get the bounds for this Volume as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax). double *vtkImageActor::GetDisplayBounds() { - vtkImageData *input = 0; + vtkAlgorithm* inputAlg = this->Mapper->GetInputAlgorithm(); if (this->Mapper) { - input = this->Mapper->GetInput(); + inputAlg = this->Mapper->GetInputAlgorithm(); } - if (!this->Mapper || !input) + if (!this->Mapper || !inputAlg) { return this->DisplayBounds; } - input->UpdateInformation(); + inputAlg->UpdateInformation(); int extent[6]; - input->GetWholeExtent(extent); - double *spacing = input->GetSpacing(); - double *origin = input->GetOrigin(); + vtkInformation* inputInfo = + this->Mapper->GetInputInformation(); + inputInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), extent); + double spacing[3] = {1, 1, 1}; + if (inputInfo->Has(vtkDataObject::SPACING())) + { + inputInfo->Get(vtkDataObject::SPACING(), spacing); + } + double origin[3] = {0, 0, 0}; + if (inputInfo->Has(vtkDataObject::ORIGIN())) + { + inputInfo->Get(vtkDataObject::ORIGIN(), origin); + } // if the display extent has not been set, use first slice extent[5] = extent[4]; @@ -419,12 +442,13 @@ int vtkImageActor::GetWholeZMin() { int *extent; - if ( ! this->GetInput()) + if ( ! this->GetInputAlgorithm()) { return 0; } - this->GetInput()->UpdateInformation(); - extent = this->GetInput()->GetWholeExtent(); + this->GetInputAlgorithm()->UpdateInformation(); + extent = this->Mapper->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); return extent[4]; } @@ -433,12 +457,13 @@ int vtkImageActor::GetWholeZMax() { int *extent; - if ( ! this->GetInput()) + if ( ! this->GetInputAlgorithm()) { return 0; } - this->GetInput()->UpdateInformation(); - extent = this->GetInput()->GetWholeExtent(); + this->GetInputAlgorithm()->UpdateInformation(); + extent = this->Mapper->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); return extent[5]; } diff --git a/Rendering/vtkImageActor.h b/Rendering/vtkImageActor.h index f332a29ab50088989b131077275124264e766f02..852c8984b48426b9219c0b6add9ada7a741e7538 100644 --- a/Rendering/vtkImageActor.h +++ b/Rendering/vtkImageActor.h @@ -30,6 +30,7 @@ #include "vtkImageSlice.h" +class vtkAlgorithm; class vtkPropCollection; class vtkRenderer; class vtkImageData; @@ -132,6 +133,9 @@ protected: int DisplayExtent[6]; double DisplayBounds[6]; + // Convenience function that returns the input of the mapper + vtkAlgorithm *GetInputAlgorithm(); + private: vtkImageActor(const vtkImageActor&); // Not implemented. void operator=(const vtkImageActor&); // Not implemented. diff --git a/Rendering/vtkImageMapper.cxx b/Rendering/vtkImageMapper.cxx index d58e8253e548f0f9ce7a0b0b3ebf4823fb52e758..ec6461c81166caba3ea1f50cfcba8eb789cfaf89 100644 --- a/Rendering/vtkImageMapper.cxx +++ b/Rendering/vtkImageMapper.cxx @@ -20,6 +20,7 @@ #include "vtkImageData.h" #include "vtkImagingFactory.h" #include "vtkInformation.h" +#include "vtkStreamingDemandDrivenPipeline.h" #include "vtkViewport.h" #include "vtkWindow.h" @@ -140,21 +141,22 @@ void vtkImageMapper::RenderStart(vtkViewport* viewport, vtkActor2D* actor) } - if (!this->GetInput()) + if (!this->GetInputAlgorithm()) { vtkDebugMacro(<< "vtkImageMapper::Render - Please Set the input."); return; } - this->GetInput()->UpdateInformation(); + this->GetInputAlgorithm()->UpdateInformation(); + + vtkInformation* inInfo = this->GetInputInformation(); if (!this->UseCustomExtents) { // start with the wholeExtent int wholeExtent[6]; - memcpy(wholeExtent,this->GetInput()->GetWholeExtent(),6*sizeof(int)); - memcpy(this->DisplayExtent, - this->GetInput()->GetWholeExtent(),6*sizeof(int)); + inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wholeExtent); + inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), this->DisplayExtent); // Set The z values to the zslice this->DisplayExtent[4] = this->ZSlice; this->DisplayExtent[5] = this->ZSlice; @@ -211,7 +213,8 @@ void vtkImageMapper::RenderStart(vtkViewport* viewport, vtkActor2D* actor) return; } - this->GetInput()->SetUpdateExtent(this->DisplayExtent); + vtkStreamingDemandDrivenPipeline::SetUpdateExtent( + this->GetInputInformation(), this->DisplayExtent); // set the position adjustment this->PositionAdjustment[0] = this->DisplayExtent[0]; @@ -226,14 +229,15 @@ void vtkImageMapper::RenderStart(vtkViewport* viewport, vtkActor2D* actor) this->DisplayExtent[4] = this->ZSlice; this->DisplayExtent[5] = this->ZSlice; // - this->GetInput()->SetUpdateExtentToWholeExtent(); + vtkStreamingDemandDrivenPipeline::SetUpdateExtentToWholeExtent( + this->GetInputInformation()); // clear the position adjustment this->PositionAdjustment[0] = 0; this->PositionAdjustment[1] = 0; } // Get the region from the input - this->GetInput()->Update(); + this->GetInputAlgorithm()->Update(); data = this->GetInput(); if ( !data) { @@ -253,8 +257,9 @@ int vtkImageMapper::GetWholeZMin() { return 0; } - this->GetInput()->UpdateInformation(); - extent = this->GetInput()->GetWholeExtent(); + this->GetInputAlgorithm()->UpdateInformation(); + extent = this->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); return extent[4]; } @@ -267,8 +272,9 @@ int vtkImageMapper::GetWholeZMax() { return 0; } - this->GetInput()->UpdateInformation(); - extent = this->GetInput()->GetWholeExtent(); + this->GetInputAlgorithm()->UpdateInformation(); + extent = this->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); return extent[5]; } diff --git a/Rendering/vtkImageSlice.cxx b/Rendering/vtkImageSlice.cxx index 498e14570c8a94d7aff9b3aab62c045cb043e9f9..2cd858f433511a23765c9f3048346b1fdd2e53ae 100644 --- a/Rendering/vtkImageSlice.cxx +++ b/Rendering/vtkImageSlice.cxx @@ -411,9 +411,9 @@ unsigned long vtkImageSlice::GetRedrawMTime() { time = this->Mapper->GetMTime(); mTime = ( time > mTime ? time : mTime ); - if (this->GetMapper()->GetInput() != NULL) + if (this->GetMapper()->GetInputAlgorithm() != NULL) { - this->GetMapper()->GetInput()->Update(); + this->GetMapper()->GetInputAlgorithm()->Update(); time = this->Mapper->GetInput()->GetMTime(); mTime = ( time > mTime ? time : mTime ); } diff --git a/Rendering/vtkImageViewer.cxx b/Rendering/vtkImageViewer.cxx index 4a0d3b2cc1e4906468f8b280c22a8abaa8d48006..848de0a224b5e3fc8bfb98f124b4c8eb2cb2b3a7 100644 --- a/Rendering/vtkImageViewer.cxx +++ b/Rendering/vtkImageViewer.cxx @@ -17,10 +17,12 @@ #include "vtkActor2D.h" #include "vtkCommand.h" #include "vtkImageData.h" +#include "vtkInformation.h" #include "vtkInteractorStyleImage.h" #include "vtkObjectFactory.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" +#include "vtkStreamingDemandDrivenPipeline.h" vtkStandardNewMacro(vtkImageViewer); @@ -108,10 +110,12 @@ public: if (event == vtkCommand::ResetWindowLevelEvent) { - this->IV->GetInput()->UpdateInformation(); - this->IV->GetInput()->SetUpdateExtent - (this->IV->GetInput()->GetWholeExtent()); - this->IV->GetInput()->Update(); + this->IV->GetInputAlgorithm()->UpdateInformation(); + vtkStreamingDemandDrivenPipeline::SetUpdateExtent( + this->IV->GetInputAlgorithm()->GetOutputInformation(0), + vtkStreamingDemandDrivenPipeline::GetWholeExtent( + this->IV->GetInputAlgorithm()->GetOutputInformation(0))); + this->IV->GetInputAlgorithm()->Update(); double *range = this->IV->GetInput()->GetScalarRange(); this->IV->SetColorWindow(range[1] - range[0]); this->IV->SetColorLevel(0.5 * (range[1] + range[0])); @@ -237,8 +241,9 @@ void vtkImageViewer::Render() if (this->RenderWindow->GetSize()[0] == 0 && this->ImageMapper->GetInput()) { // get the size from the mappers input - this->ImageMapper->GetInput()->UpdateInformation(); - int *ext = this->ImageMapper->GetInput()->GetWholeExtent(); + this->ImageMapper->GetInputAlgorithm()->UpdateInformation(); + int *ext = this->ImageMapper->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); // if it would be smaller than 150 by 100 then limit to 150 by 100 int xs = ext[1] - ext[0] + 1; int ys = ext[3] - ext[2] + 1; @@ -274,6 +279,12 @@ void vtkImageViewer::OffScreenRenderingOff() this->SetOffScreenRendering(0); } +//---------------------------------------------------------------------------- +vtkAlgorithm* vtkImageViewer::GetInputAlgorithm() +{ + return this->ImageMapper->GetInputAlgorithm(); +} + #ifndef VTK_LEGACY_REMOVE int vtkImageViewer::GetGrayScaleHint() { diff --git a/Rendering/vtkImageViewer.h b/Rendering/vtkImageViewer.h index 2b84a167e7fadd2b5039ffa3a1a547dae20acfdb..19e9bd6dc95ad2fcc250723bdd27d33156069585 100644 --- a/Rendering/vtkImageViewer.h +++ b/Rendering/vtkImageViewer.h @@ -131,6 +131,9 @@ protected: vtkRenderWindowInteractor *Interactor; vtkInteractorStyleImage *InteractorStyle; + friend class vtkImageViewerCallback; + vtkAlgorithm* GetInputAlgorithm(); + private: vtkImageViewer(const vtkImageViewer&); // Not implemented. void operator=(const vtkImageViewer&); // Not implemented. diff --git a/Rendering/vtkImageViewer2.cxx b/Rendering/vtkImageViewer2.cxx index f46fa18aad9ddcd59bf576210e3b5e2fdb3edd18..7969acbe698640bec55d51363229a2bf9b2f8779 100644 --- a/Rendering/vtkImageViewer2.cxx +++ b/Rendering/vtkImageViewer2.cxx @@ -20,11 +20,13 @@ #include "vtkImageData.h" #include "vtkImageData.h" #include "vtkImageMapToWindowLevelColors.h" +#include "vtkInformation.h" #include "vtkInteractorStyleImage.h" #include "vtkObjectFactory.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" +#include "vtkStreamingDemandDrivenPipeline.h" vtkStandardNewMacro(vtkImageViewer2); @@ -191,11 +193,12 @@ int* vtkImageViewer2::GetSize() //---------------------------------------------------------------------------- void vtkImageViewer2::GetSliceRange(int &min, int &max) { - vtkImageData *input = this->GetInput(); + vtkAlgorithm *input = this->GetInputAlgorithm(); if (input) { input->UpdateInformation(); - int *w_ext = input->GetWholeExtent(); + int *w_ext = input->GetOutputInformation(0)->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); min = w_ext[this->SliceOrientation * 2]; max = w_ext[this->SliceOrientation * 2 + 1]; } @@ -204,11 +207,13 @@ void vtkImageViewer2::GetSliceRange(int &min, int &max) //---------------------------------------------------------------------------- int* vtkImageViewer2::GetSliceRange() { - vtkImageData *input = this->GetInput(); + vtkAlgorithm *input = this->GetInputAlgorithm(); if (input) { input->UpdateInformation(); - return input->GetWholeExtent() + this->SliceOrientation * 2; + return input->GetOutputInformation(0)->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()) + + this->SliceOrientation * 2; } return NULL; } @@ -335,14 +340,16 @@ void vtkImageViewer2::UpdateOrientation() //---------------------------------------------------------------------------- void vtkImageViewer2::UpdateDisplayExtent() { - vtkImageData *input = this->GetInput(); + vtkAlgorithm *input = this->GetInputAlgorithm(); if (!input || !this->ImageActor) { return; } input->UpdateInformation(); - int *w_ext = input->GetWholeExtent(); + vtkInformation* outInfo = input->GetOutputInformation(0); + int *w_ext = outInfo->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); // Is the slice in range ? If not, fix it @@ -392,7 +399,7 @@ void vtkImageViewer2::UpdateDisplayExtent() double spos = bounds[this->SliceOrientation * 2]; double cpos = cam->GetPosition()[this->SliceOrientation]; double range = fabs(spos - cpos); - double *spacing = input->GetSpacing(); + double *spacing = outInfo->Get(vtkDataObject::SPACING()); double avg_spacing = (spacing[0] + spacing[1] + spacing[2]) / 3.0; cam->SetClippingRange( @@ -475,10 +482,12 @@ public: if (event == vtkCommand::ResetWindowLevelEvent) { - this->IV->GetInput()->UpdateInformation(); - this->IV->GetInput()->SetUpdateExtent - (this->IV->GetInput()->GetWholeExtent()); - this->IV->GetInput()->Update(); + this->IV->GetInputAlgorithm()->UpdateInformation(); + vtkStreamingDemandDrivenPipeline::SetUpdateExtent( + this->IV->GetInputInformation(), + vtkStreamingDemandDrivenPipeline::GetWholeExtent( + this->IV->GetInputInformation())); + this->IV->GetInputAlgorithm()->Update(); double *range = this->IV->GetInput()->GetScalarRange(); this->IV->SetColorWindow(range[1] - range[0]); this->IV->SetColorLevel(0.5 * (range[1] + range[0])); @@ -641,11 +650,12 @@ void vtkImageViewer2::Render() { // Initialize the size if not set yet - vtkImageData *input = this->GetInput(); + vtkAlgorithm *input = this->GetInputAlgorithm(); if (input) { input->UpdateInformation(); - int *w_ext = input->GetWholeExtent(); + int *w_ext = this->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); int xs = 0, ys = 0; switch (this->SliceOrientation) @@ -718,6 +728,16 @@ vtkImageData* vtkImageViewer2::GetInput() { return vtkImageData::SafeDownCast(this->WindowLevel->GetInput()); } +//---------------------------------------------------------------------------- +vtkInformation* vtkImageViewer2::GetInputInformation() +{ + return this->WindowLevel->GetInputInformation(); +} +//---------------------------------------------------------------------------- +vtkAlgorithm* vtkImageViewer2::GetInputAlgorithm() +{ + return this->WindowLevel->GetInputAlgorithm(); +} //---------------------------------------------------------------------------- void vtkImageViewer2::SetInputConnection(vtkAlgorithmOutput* input) diff --git a/Rendering/vtkImageViewer2.h b/Rendering/vtkImageViewer2.h index 2732d6f642fba0969cb5919d8cdbfb1e5dcbe245..aba327d18185d5c9b0c66595453e567f2370d176 100644 --- a/Rendering/vtkImageViewer2.h +++ b/Rendering/vtkImageViewer2.h @@ -56,10 +56,12 @@ #include "vtkObject.h" +class vtkAlgorithm; class vtkAlgorithmOutput; class vtkImageActor; class vtkImageData; class vtkImageMapToWindowLevelColors; +class vtkInformation; class vtkInteractorStyleImage; class vtkRenderWindow; class vtkRenderer; @@ -221,6 +223,11 @@ protected: virtual void UpdateOrientation(); + vtkAlgorithm* GetInputAlgorithm(); + vtkInformation* GetInputInformation(); + + friend class vtkImageViewer2Callback; + private: vtkImageViewer2(const vtkImageViewer2&); // Not implemented. void operator=(const vtkImageViewer2&); // Not implemented. diff --git a/Rendering/vtkLabeledTreeMapDataMapper.cxx b/Rendering/vtkLabeledTreeMapDataMapper.cxx index f0686bbf56d52cc14e58eb06619327f4e3d5836a..1d4fb9e1b561800aa0821e44fa7474a41b7b4f36 100644 --- a/Rendering/vtkLabeledTreeMapDataMapper.cxx +++ b/Rendering/vtkLabeledTreeMapDataMapper.cxx @@ -334,7 +334,7 @@ void vtkLabeledTreeMapDataMapper::RenderOpaqueGeometry(vtkViewport *viewport, return; } - input->Update(); + this->GetInputAlgorithm()->Update(); // Input might have changed input = this->GetInputTree(); diff --git a/Rendering/vtkMapper.cxx b/Rendering/vtkMapper.cxx index ec89e3bdeb58ca691429c69ff20987c30711b2de..bac5260a172503d63990d317372ed7a30f4825f9 100644 --- a/Rendering/vtkMapper.cxx +++ b/Rendering/vtkMapper.cxx @@ -608,8 +608,6 @@ void vtkMapper::MapScalarsToTexture(vtkDataArray* scalars, double alpha) this->ColorTextureMap = vtkImageData::New(); this->ColorTextureMap->SetExtent(0,ColorTextureMapSize-1, 0,0, 0,0); - this->ColorTextureMap->SetNumberOfScalarComponents(4); - this->ColorTextureMap->SetScalarTypeToUnsignedChar(); this->ColorTextureMap->GetPointData()->SetScalars( this->LookupTable->MapScalars(tmp, this->ColorMode, 0)); this->LookupTable->SetAlpha(orig_alpha); diff --git a/Rendering/vtkOBJExporter.cxx b/Rendering/vtkOBJExporter.cxx index c12a5d2faa141468bf668ee39a7bacc5f5c1d806..555f789a8d158e80ef0c608ca50988af92212dbd 100644 --- a/Rendering/vtkOBJExporter.cxx +++ b/Rendering/vtkOBJExporter.cxx @@ -164,7 +164,7 @@ void vtkOBJExporter::WriteAnActor(vtkActor *anActor, FILE *fpObj, FILE *fpMtl, { return; } - ds->Update(); + anActor->GetMapper()->GetInputAlgorithm()->Update(); trans->SetMatrix(anActor->vtkProp3D::GetMatrix()); // we really want polydata diff --git a/Rendering/vtkOOGLExporter.cxx b/Rendering/vtkOOGLExporter.cxx index 138e32f529b9cd02128db9e8984b13010cdc84bd..5855fede5d746036242afc607e630958aaeb9d3c 100644 --- a/Rendering/vtkOOGLExporter.cxx +++ b/Rendering/vtkOOGLExporter.cxx @@ -303,7 +303,7 @@ void vtkOOGLExporter::WriteAnActor(vtkActor *anActor, FILE *fp, int count) } else { - ds->Update(); + anActor->GetMapper()->GetInputAlgorithm()->Update(); pd = static_cast<vtkPolyData *>(ds); } @@ -337,7 +337,7 @@ void vtkOOGLExporter::WriteAnActor(vtkActor *anActor, FILE *fp, int count) vtkErrorMacro(<< "texture has no input!\n"); return; } - aTexture->GetInput()->Update(); + aTexture->GetInputAlgorithm()->Update(); size = aTexture->GetInput()->GetDimensions(); scalars = aTexture->GetInput()->GetPointData()->GetScalars(); diff --git a/Rendering/vtkPOVExporter.cxx b/Rendering/vtkPOVExporter.cxx index 2273dcf14e515396988679757ac6f7ccfe172b37..e0a66b51224a3e7e1a26e001c0e91a2d9b7d8911 100644 --- a/Rendering/vtkPOVExporter.cxx +++ b/Rendering/vtkPOVExporter.cxx @@ -341,7 +341,7 @@ void vtkPOVExporter::WriteActor(vtkActor *actor) { return; } - dataset->Update(); + actor->GetMapper()->GetInputAlgorithm()->Update(); // convert non polygon data to polygon data if needed vtkGeometryFilter *geometryFilter = NULL; diff --git a/Rendering/vtkPainterPolyDataMapper.cxx b/Rendering/vtkPainterPolyDataMapper.cxx index b4be3c108b2b1b9027a0a1e2cb89d8c9998d9afc..89e883d258cb0be3a11d32e3807438714a2b3bcd 100644 --- a/Rendering/vtkPainterPolyDataMapper.cxx +++ b/Rendering/vtkPainterPolyDataMapper.cxx @@ -314,7 +314,7 @@ void vtkPainterPolyDataMapper::RenderPiece(vtkRenderer* ren, vtkActor* act) this->InvokeEvent(vtkCommand::StartEvent,NULL); if (!this->Static) { - input->Update(); + this->GetInputAlgorithm()->Update(); } this->InvokeEvent(vtkCommand::EndEvent,NULL); diff --git a/Rendering/vtkParallelCoordinatesActor.cxx b/Rendering/vtkParallelCoordinatesActor.cxx index 47a586a6ab76579f78bec76253de230aa484929b..2042b633500f75521d3ba967455d5aa215fd1838 100644 --- a/Rendering/vtkParallelCoordinatesActor.cxx +++ b/Rendering/vtkParallelCoordinatesActor.cxx @@ -229,8 +229,6 @@ int vtkParallelCoordinatesActor::RenderOpaqueGeometry(vtkViewport *viewport) // Check modified time to see whether we have to rebuild. - this->Input->Update(); - if (positionsHaveChanged || this->GetMTime() > this->BuildTime || this->Input->GetMTime() > this->BuildTime || diff --git a/Rendering/vtkPolyDataMapper.cxx b/Rendering/vtkPolyDataMapper.cxx index 9cb44dac31d60b1dd4d9302251a3f93b3085017f..0913088388f8848cd4413519239332c517e9a601 100644 --- a/Rendering/vtkPolyDataMapper.cxx +++ b/Rendering/vtkPolyDataMapper.cxx @@ -20,6 +20,7 @@ #include "vtkMath.h" #include "vtkPolyData.h" #include "vtkRenderWindow.h" +#include "vtkStreamingDemandDrivenPipeline.h" //---------------------------------------------------------------------------- @@ -54,9 +55,9 @@ void vtkPolyDataMapper::Render(vtkRenderer *ren, vtkActor *act) } int currentPiece, nPieces; - vtkDataObject *input = this->GetInputDataObject(0, 0); + vtkInformation *inInfo = this->GetInputInformation(); - if (input == NULL) + if (inInfo == NULL) { vtkErrorMacro("Mapper has no input."); return; @@ -68,7 +69,9 @@ void vtkPolyDataMapper::Render(vtkRenderer *ren, vtkActor *act) { // If more than one pieces, render in loop. currentPiece = this->NumberOfSubPieces * this->Piece + i; - input->SetUpdateExtent(currentPiece, nPieces, this->GhostLevel); + vtkStreamingDemandDrivenPipeline::SetUpdateExtent( + inInfo, + currentPiece, nPieces, this->GhostLevel); this->RenderPiece(ren, act); } } @@ -104,15 +107,18 @@ void vtkPolyDataMapper::Update() } int currentPiece, nPieces = this->NumberOfPieces; - vtkPolyData* input = this->GetInput(); + vtkInformation* inInfo = this->GetInputInformation(); // If the estimated pipeline memory usage is larger than // the memory limit, break the current piece into sub-pieces. - if (input) + if (inInfo) { currentPiece = this->NumberOfSubPieces * this->Piece; - input->SetUpdateExtent(currentPiece, this->NumberOfSubPieces*nPieces, - this->GhostLevel); + vtkStreamingDemandDrivenPipeline::SetUpdateExtent( + inInfo, + currentPiece, + this->NumberOfSubPieces*nPieces, + this->GhostLevel); } this->vtkMapper::Update(); diff --git a/Rendering/vtkRendererSource.cxx b/Rendering/vtkRendererSource.cxx index cfafd44a348ae319c7eb37dffcabf8e830b70a19..717de402d2d015ea574ac40ff5b410d7f245967e 100644 --- a/Rendering/vtkRendererSource.cxx +++ b/Rendering/vtkRendererSource.cxx @@ -264,14 +264,15 @@ unsigned long vtkRendererSource::GetMTime() data = mapper->GetInput(); if (data) { - data->UpdateInformation(); + mapper->GetInputAlgorithm()->UpdateInformation(); } t2 = data->GetMTime(); if (t2 > t1) { t1 = t2; } - t2 = data->GetPipelineMTime(); + t2 = vtkDemandDrivenPipeline::SafeDownCast( + mapper->GetInputExecutive())->GetPipelineMTime(); if (t2 > t1) { t1 = t2; diff --git a/Rendering/vtkScalarBarActor.cxx b/Rendering/vtkScalarBarActor.cxx index 73064c5022308dedffc8204a967f335a9df6ef84..cba3887dfe103caab43b9ca0ee4a147b35315733 100644 --- a/Rendering/vtkScalarBarActor.cxx +++ b/Rendering/vtkScalarBarActor.cxx @@ -133,8 +133,7 @@ vtkScalarBarActor::vtkScalarBarActor() const unsigned int dim = 128; vtkImageData *image = vtkImageData::New(); image->SetDimensions(dim, dim, 1); - image->SetScalarTypeToUnsignedChar(); - image->AllocateScalars(); + image->AllocateScalars(VTK_UNSIGNED_CHAR, 1); for (unsigned int y = 0; y < dim; y++) { diff --git a/Rendering/vtkScalarsToColorsPainter.cxx b/Rendering/vtkScalarsToColorsPainter.cxx index 4239deba491cc2e77a28f05f51b87bac5c8382a5..15c5df97c3874e425a0deba4e1d152876d2017b1 100644 --- a/Rendering/vtkScalarsToColorsPainter.cxx +++ b/Rendering/vtkScalarsToColorsPainter.cxx @@ -503,8 +503,6 @@ void vtkScalarsToColorsPainter::UpdateColorTextureMap(double alpha, this->ColorTextureMap = vtkSmartPointer<vtkImageData>::New(); this->ColorTextureMap->SetExtent(0,numberOfColors-1, 0,1, 0,0); - this->ColorTextureMap->SetNumberOfScalarComponents(4); - this->ColorTextureMap->SetScalarTypeToUnsignedChar(); vtkSmartPointer<vtkDataArray> colors; colors.TakeReference(this->LookupTable->MapScalars(scalarTable, this->ColorMode, 0)); diff --git a/Rendering/vtkTesting.cxx b/Rendering/vtkTesting.cxx index 2299eb09f68304b723935e8b9d8f482eb68aaa57..20977232fd262b4afe51a7693b6df68ef9d1dbdd 100644 --- a/Rendering/vtkTesting.cxx +++ b/Rendering/vtkTesting.cxx @@ -34,6 +34,8 @@ #include "vtkDataArray.h" #include "vtkDoubleArray.h" #include "vtkFloatArray.h" +#include "vtkStreamingDemandDrivenPipeline.h" +#include "vtkInformation.h" #include "vtkSmartPointer.h" #define VTK_CREATE(type, name) \ @@ -423,7 +425,7 @@ int vtkTesting::RegressionTest(vtkImageData* image, double thresh, ostream& os) VTK_CREATE(vtkPNGReader, rt_png); rt_png->SetFileName(this->ValidImageFileName); rt_png->Update(); - image->Update(); + // image->Update(); VTK_CREATE(vtkImageDifference, rt_id); @@ -435,8 +437,10 @@ int vtkTesting::RegressionTest(vtkImageData* image, double thresh, ostream& os) ic2->SetClipData(1); ic2->SetInput(rt_png->GetOutput()); - int* wExt1 = ic1->GetInput()->GetWholeExtent(); - int* wExt2 = ic2->GetInput()->GetWholeExtent(); + int* wExt1 = ic1->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); + int* wExt2 = ic2->GetInputInformation()->Get( + vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); ic1->SetOutputWholeExtent(wExt1[0] + this->BorderOffset, wExt1[1] - this->BorderOffset, wExt1[2] + this->BorderOffset, diff --git a/Rendering/vtkTextActor3D.cxx b/Rendering/vtkTextActor3D.cxx index 925ae859f6d963d53a4bcbaa6d54988d6cdaaeb4..0658d8ec2d7a3588d13a5d421dccc480c383d309 100644 --- a/Rendering/vtkTextActor3D.cxx +++ b/Rendering/vtkTextActor3D.cxx @@ -231,8 +231,6 @@ int vtkTextActor3D::UpdateImageActor() if (!this->ImageData) { this->ImageData = vtkImageData::New(); - this->ImageData->SetScalarTypeToUnsignedChar(); - this->ImageData->SetNumberOfScalarComponents(4); this->ImageData->SetSpacing(1.0, 1.0, 1.0); } @@ -254,7 +252,7 @@ int vtkTextActor3D::UpdateImageActor() if (this->ImageActor) { this->ImageActor->SetInput(this->ImageData); - this->ImageActor->SetDisplayExtent(this->ImageData->GetWholeExtent()); + this->ImageActor->SetDisplayExtent(this->ImageData->GetExtent()); } } // if (this->GetMTime() ... diff --git a/Rendering/vtkTexture.cxx b/Rendering/vtkTexture.cxx index 27b7008bd1d6effecf81768e7b799b49c8b4147d..d58621b4c84c2726c41362a451b80bb1b7268c08 100644 --- a/Rendering/vtkTexture.cxx +++ b/Rendering/vtkTexture.cxx @@ -18,11 +18,13 @@ #include "vtkExecutive.h" #include "vtkGraphicsFactory.h" #include "vtkImageData.h" +#include "vtkInformation.h" #include "vtkLookupTable.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkTransform.h" #include "vtkPointData.h" +#include "vtkStreamingDemandDrivenPipeline.h" vtkCxxSetObjectMacro(vtkTexture, LookupTable, vtkScalarsToColors); @@ -249,17 +251,20 @@ unsigned char *vtkTexture::MapScalarsToColors (vtkDataArray *scalars) //---------------------------------------------------------------------------- void vtkTexture::Render(vtkRenderer *ren) { - vtkImageData *input = this->GetInput(); - - if (input) //load texture map + vtkAlgorithm* inputAlg = this->GetInputAlgorithm(); + + if (inputAlg) //load texture map { + vtkInformation* inInfo = this->GetInputInformation(); // We do not want more than requested. - input->RequestExactExtentOn(); - + inInfo->Set( + vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1); + // Updating the whole extent may not be necessary. - input->UpdateInformation(); - input->SetUpdateExtentToWholeExtent(); - input->Update(); + inputAlg->UpdateInformation(); + vtkStreamingDemandDrivenPipeline::SetUpdateExtentToWholeExtent( + inInfo); + inputAlg->Update(); this->Load(ren); } } @@ -272,14 +277,14 @@ int vtkTexture::IsTranslucent() (this->GetInput()->GetMTime() <= this->TranslucentComputationTime))) return this->TranslucentCachedResult; - if(this->GetInput()) + if(this->GetInputAlgorithm()) { - this->GetInput()->UpdateInformation(); - this->GetInput()->SetUpdateExtent( - this->GetInput()->GetWholeExtent()); - this->GetInput()->PropagateUpdateExtent(); - this->GetInput()->TriggerAsynchronousUpdate(); - this->GetInput()->UpdateData(); + vtkAlgorithm* inpAlg = this->GetInputAlgorithm(); + vtkInformation* inInfo = this->GetInputInformation(); + inpAlg->UpdateInformation(); + vtkStreamingDemandDrivenPipeline::SetUpdateExtentToWholeExtent( + inInfo); + inpAlg->Update(); } if(this->GetInput() == NULL ||