Hi guys,I am working with unstructured grids at the moment and there was a change in vtk 6.1.0 which allows unstructured grids with arbitrary memory layouts to be integrated into VTK (i.e. given your representation, there's no need to create a fully fledged vtkUnstructuredGrid, but rather create an adaptor class to implement the vtkUnstructuredGridBase interface - see http://www.vtk.org/Wiki/VTK/InSituDataStructures). This is really convenient and changing all the references in MITK from vtkUnstructuredGrid to vtkUnstructuredGridBase this also works for MITK.
The patch is attached. I think it makes sense to integrate it with MITK and it would take very little time to do so.
All best, Rostislav. PS: also added a bug for this: http://bugs.mitk.org/show_bug.cgi?id=18930
From 9a1f1b7a047c40b2a2370c2e305e80959af2f01c Mon Sep 17 00:00:00 2001 From: Rostislav Khlebnikov <r.khlebni...@gmail.com> Date: Mon, 6 Apr 2015 13:37:30 +0100 Subject: [PATCH] Change vtkUnstructuredGrid to vtkUnstructuredGridBase --- .../AlgorithmsExt/mitkSimpleUnstructuredGridHistogram.cpp | 2 +- Modules/DataTypesExt/mitkUnstructuredGrid.cpp | 14 +++++++------- Modules/DataTypesExt/mitkUnstructuredGrid.h | 8 ++++---- Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.cpp | 1 + Modules/MapperExt/mitkUnstructuredGridVtkMapper3D.cpp | 4 ++-- Modules/MapperExt/vtkUnstructuredGridMapper.cpp | 10 +++++----- Modules/MapperExt/vtkUnstructuredGridMapper.h | 6 +++--- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Modules/AlgorithmsExt/mitkSimpleUnstructuredGridHistogram.cpp b/Modules/AlgorithmsExt/mitkSimpleUnstructuredGridHistogram.cpp index 4407ad5..bf88098 100644 --- a/Modules/AlgorithmsExt/mitkSimpleUnstructuredGridHistogram.cpp +++ b/Modules/AlgorithmsExt/mitkSimpleUnstructuredGridHistogram.cpp @@ -47,7 +47,7 @@ void SimpleUnstructuredGridHistogram::ComputeFromBaseData( BaseData* source ) UnstructuredGrid* grid = dynamic_cast<UnstructuredGrid*>(source); //m_UGHistogram->Initialize(grid); - vtkUnstructuredGrid* vtkUGrid = grid->GetVtkUnstructuredGrid(); + vtkUnstructuredGridBase* vtkUGrid = grid->GetVtkUnstructuredGrid(); ListSampleType::Pointer listSample = ListSampleType::New(); listSample->SetMeasurementVectorSize(1); diff --git a/Modules/DataTypesExt/mitkUnstructuredGrid.cpp b/Modules/DataTypesExt/mitkUnstructuredGrid.cpp index 8dfe297..b78f914 100644 --- a/Modules/DataTypesExt/mitkUnstructuredGrid.cpp +++ b/Modules/DataTypesExt/mitkUnstructuredGrid.cpp @@ -17,9 +17,9 @@ See LICENSE.txt or http://www.mitk.org for details. #include "mitkUnstructuredGrid.h" -#include <vtkUnstructuredGrid.h> +#include <vtkUnstructuredGridBase.h> -void mitk::UnstructuredGrid::SetVtkUnstructuredGrid( vtkUnstructuredGrid* grid, unsigned int t ) +void mitk::UnstructuredGrid::SetVtkUnstructuredGrid(vtkUnstructuredGridBase* grid, unsigned int t) { this->Expand(t); @@ -46,7 +46,7 @@ void mitk::UnstructuredGrid::Expand(unsigned int timeSteps) if(timeSteps > m_GridSeries.size()) { Superclass::Expand(timeSteps); - vtkUnstructuredGrid* pdnull = 0; + vtkUnstructuredGridBase* pdnull = 0; m_GridSeries.resize( timeSteps, pdnull ); m_CalculateBoundingBox = true; } @@ -66,18 +66,18 @@ void mitk::UnstructuredGrid::ClearData() void mitk::UnstructuredGrid::InitializeEmpty() { - vtkUnstructuredGrid* pdnull = 0; + vtkUnstructuredGridBase* pdnull = 0; m_GridSeries.resize( 1, pdnull ); Superclass::InitializeTimeGeometry(1); m_Initialized = true; } -vtkUnstructuredGrid* mitk::UnstructuredGrid::GetVtkUnstructuredGrid(unsigned int t) +vtkUnstructuredGridBase* mitk::UnstructuredGrid::GetVtkUnstructuredGrid(unsigned int t) { if ( t < m_GridSeries.size() ) { - vtkUnstructuredGrid* grid = m_GridSeries[ t ]; + vtkUnstructuredGridBase* grid = m_GridSeries[t]; if((grid == 0) && (GetSource().GetPointer() != 0)) { RegionType requestedregion; @@ -150,7 +150,7 @@ void mitk::UnstructuredGrid::CalculateBoundingBox() // for ( unsigned int i = 0 ; i < m_GridSeries.size() ; ++i ) { - vtkUnstructuredGrid* grid = m_GridSeries[ i ]; + vtkUnstructuredGridBase* grid = m_GridSeries[i]; double bounds[ ] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; if ( ( grid != 0 ) && ( grid->GetNumberOfCells() > 0 ) ) { diff --git a/Modules/DataTypesExt/mitkUnstructuredGrid.h b/Modules/DataTypesExt/mitkUnstructuredGrid.h index c027fd7..3cb399f 100644 --- a/Modules/DataTypesExt/mitkUnstructuredGrid.h +++ b/Modules/DataTypesExt/mitkUnstructuredGrid.h @@ -22,7 +22,7 @@ See LICENSE.txt or http://www.mitk.org for details. #include "MitkDataTypesExtExports.h" #include "itkImageRegion.h" -class vtkUnstructuredGrid; +class vtkUnstructuredGridBase; namespace mitk { @@ -41,9 +41,9 @@ public: itkFactorylessNewMacro(Self) itkCloneMacro(Self) - virtual void SetVtkUnstructuredGrid(vtkUnstructuredGrid* grid, unsigned int t = 0); + virtual void SetVtkUnstructuredGrid(vtkUnstructuredGridBase* grid, unsigned int t = 0); - virtual vtkUnstructuredGrid* GetVtkUnstructuredGrid(unsigned int t = 0); + virtual vtkUnstructuredGridBase* GetVtkUnstructuredGrid(unsigned int t = 0); virtual void UpdateOutputInformation(); @@ -86,7 +86,7 @@ public: protected: mitkCloneMacro(Self); - typedef std::vector< vtkUnstructuredGrid* > VTKUnstructuredGridSeries; + typedef std::vector< vtkUnstructuredGridBase* > VTKUnstructuredGridSeries; UnstructuredGrid(); diff --git a/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.cpp b/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.cpp index ad44d57..881ea63 100644 --- a/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.cpp +++ b/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.cpp @@ -18,6 +18,7 @@ See LICENSE.txt or http://www.mitk.org for details. #include <vtkDataReader.h> #include <vtkUnstructuredGridReader.h> #include <vtkXMLUnstructuredGridReader.h> +#include <vtkUnstructuredGrid.h> #include <itksys/SystemTools.hxx> diff --git a/Modules/MapperExt/mitkUnstructuredGridVtkMapper3D.cpp b/Modules/MapperExt/mitkUnstructuredGridVtkMapper3D.cpp index ff252b0..a854f20 100644 --- a/Modules/MapperExt/mitkUnstructuredGridVtkMapper3D.cpp +++ b/Modules/MapperExt/mitkUnstructuredGridVtkMapper3D.cpp @@ -147,7 +147,7 @@ void mitk::UnstructuredGridVtkMapper3D::GenerateDataForRenderer(mitk::BaseRender mitk::UnstructuredGrid::Pointer input = const_cast< mitk::UnstructuredGrid* >(this->GetInput()); if (input.IsNull()) return; - vtkUnstructuredGrid * grid = input->GetVtkUnstructuredGrid(this->GetTimestep()); + vtkUnstructuredGridBase * grid = input->GetVtkUnstructuredGrid(this->GetTimestep()); if (grid == 0) return; double* scalarRange = grid->GetScalarRange(); @@ -177,7 +177,7 @@ void mitk::UnstructuredGridVtkMapper3D::GenerateDataForRenderer(mitk::BaseRender // // set the input-object at time t for the mapper // - vtkUnstructuredGrid * grid = input->GetVtkUnstructuredGrid( this->GetTimestep() ); + vtkUnstructuredGridBase * grid = input->GetVtkUnstructuredGrid( this->GetTimestep() ); if(grid == 0) { m_Assembly->VisibilityOff(); diff --git a/Modules/MapperExt/vtkUnstructuredGridMapper.cpp b/Modules/MapperExt/vtkUnstructuredGridMapper.cpp index 58b0222..fef5f06 100644 --- a/Modules/MapperExt/vtkUnstructuredGridMapper.cpp +++ b/Modules/MapperExt/vtkUnstructuredGridMapper.cpp @@ -22,7 +22,7 @@ See LICENSE.txt or http://www.mitk.org for details. #include "vtkObjectFactory.h" #include "vtkPolyData.h" #include "vtkPolyDataMapper.h" -#include "vtkUnstructuredGrid.h" +#include "vtkUnstructuredGridBase.h" vtkStandardNewMacro(vtkUnstructuredGridMapper); @@ -54,16 +54,16 @@ void vtkUnstructuredGridMapper::SetBoundingObject(mitk::BoundingObject* bo) } //---------------------------------------------------------------------------- -void vtkUnstructuredGridMapper::SetInput(vtkUnstructuredGrid *input) +void vtkUnstructuredGridMapper::SetInput(vtkUnstructuredGridBase *input) { this->SetInputDataObject(input); } //---------------------------------------------------------------------------- -vtkUnstructuredGrid *vtkUnstructuredGridMapper::GetInput() +vtkUnstructuredGridBase *vtkUnstructuredGridMapper::GetInput() { //return this->Superclass::GetInputAsDataSet(); - return vtkUnstructuredGrid::SafeDownCast( + return vtkUnstructuredGridBase::SafeDownCast( this->GetExecutive()->GetInputData(0, 0)); } @@ -213,7 +213,7 @@ unsigned long vtkUnstructuredGridMapper::GetMTime() int vtkUnstructuredGridMapper::FillInputPortInformation( int vtkNotUsed(port), vtkInformation* info) { - info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGrid"); + info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGridBase"); return 1; } diff --git a/Modules/MapperExt/vtkUnstructuredGridMapper.h b/Modules/MapperExt/vtkUnstructuredGridMapper.h index 202e59f..4117180 100644 --- a/Modules/MapperExt/vtkUnstructuredGridMapper.h +++ b/Modules/MapperExt/vtkUnstructuredGridMapper.h @@ -26,7 +26,7 @@ See LICENSE.txt or http://www.mitk.org for details. class vtkPolyDataMapper; class vtkGeometryFilter; -class vtkUnstructuredGrid; +class vtkUnstructuredGridBase; class MitkMapperExt_EXPORT vtkUnstructuredGridMapper : public vtkMapper { @@ -61,8 +61,8 @@ public: // Description: // Set the Input of this mapper. - void SetInput(vtkUnstructuredGrid *input); - vtkUnstructuredGrid *GetInput(); + void SetInput(vtkUnstructuredGridBase *input); + vtkUnstructuredGridBase *GetInput(); void SetBoundingObject(mitk::BoundingObject* bo); -- 1.8.4.msysgit.0
------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users