//=
+template<class T>
+class MEDFileVTKTraits
+{
+public:
+ typedef void VtkType;
+ typedef void MCType;
+};
+
+template<>
+class MEDFileVTKTraits<int>
+{
+public:
+ typedef vtkIntArray VtkType;
+ typedef MEDCoupling::DataArrayInt MCType;
+};
+
+template<>
+class MEDFileVTKTraits<double>
+{
+public:
+ typedef vtkDoubleArray VtkType;
+ typedef MEDCoupling::DataArrayDouble MCType;
+};
+
+template<class T>
+void AssignDataPointerToVTK(typename MEDFileVTKTraits<T>::VtkType *vtkTab, typename MEDFileVTKTraits<T>::MCType *mcTab, bool noCpyNumNodes)
+{
+ if(noCpyNumNodes)
+ vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),1,vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE);
+ else
+ { vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),0,vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE); mcTab->accessToMemArray().setSpecificDeallocator(0); }
+}
+
+// here copy is always assumed.
+template<class VTKT, class MCT>
+void AssignDataPointerOther(VTKT *vtkTab, MCT *mcTab, int nbElems)
+{
+ vtkTab->SetVoidArray(reinterpret_cast<unsigned char *>(mcTab->getPointer()),nbElems,0,VTKT::VTK_DATA_ARRAY_FREE);
+ mcTab->accessToMemArray().setSpecificDeallocator(0);
+}
+
+//=
+
MEDFileFieldRepresentationLeavesArrays::MEDFileFieldRepresentationLeavesArrays():_id(-1)
{
}
void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshStruct *mst, vtkDataSet *ds) const
{
- const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
tr->setNumberOfTS((operator->())->getNumberOfTS());
tr->initIterator();
vtkd->SetNumberOfComponents(vd->getNumberOfComponents());
for(int i=0;i<vd->getNumberOfComponents();i++)
vtkd->SetComponentName(i,vd->getInfoOnComponent(i).c_str());
- if(postProcessedArr!=crudeArr)
- {
- vtkd->SetArray(vd->getPointer(),vd->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); vd->accessToMemArray().setSpecificDeallocator(0);
- }
- else
- {
- vtkd->SetArray(vd->getPointer(),vd->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- }
+ AssignDataPointerToVTK<double>(vtkd,vd,postProcessedArr==crudeArr);
std::string name(tr->buildName(f1ts->getName()));
vtkd->SetName(name.c_str());
att->AddArray(vtkd);
vtkd->SetNumberOfComponents(vi->getNumberOfComponents());
for(int i=0;i<vi->getNumberOfComponents();i++)
vtkd->SetComponentName(i,vi->getVarOnComponent(i).c_str());
- if(postProcessedArr!=crudeArr)
- {
- vtkd->SetArray(vi->getPointer(),vi->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); vi->accessToMemArray().setSpecificDeallocator(0);
- }
- else
- {
- vtkd->SetArray(vi->getPointer(),vi->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- }
+ AssignDataPointerToVTK<int>(vtkd,vi,postProcessedArr==crudeArr);
std::string name(tr->buildName(f1ts->getName()));
vtkd->SetName(name.c_str());
att->AddArray(vtkd);
vtkUnstructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolationUnstructured(MEDUMeshMultiLev *mm) const
{
- const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
DataArrayDouble *coordsMC(0);
DataArrayByte *typesMC(0);
DataArrayInt *cellLocationsMC(0),*cellsMC(0),*faceLocationsMC(0),*facesMC(0);
int nbOfCells(typesSafe->getNbOfElems());
vtkUnstructuredGrid *ret(vtkUnstructuredGrid::New());
vtkUnsignedCharArray *cellTypes(vtkUnsignedCharArray::New());
- cellTypes->SetArray(reinterpret_cast<unsigned char *>(typesSafe->getPointer()),nbOfCells,0,VTK_DATA_ARRAY_FREE); typesSafe->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerOther<vtkUnsignedCharArray,DataArrayByte>(cellTypes,typesSafe,nbOfCells);
vtkIdTypeArray *cellLocations(vtkIdTypeArray::New());
- cellLocations->SetVoidArray(cellLocationsSafe->getPointer(),nbOfCells,0,VTK_DATA_ARRAY_FREE); cellLocationsSafe->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(cellLocations,cellLocationsSafe,nbOfCells);
vtkCellArray *cells(vtkCellArray::New());
vtkIdTypeArray *cells2(vtkIdTypeArray::New());
- cells2->SetVoidArray(cellsSafe->getPointer(),cellsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); cellsSafe->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(cells2,cellsSafe,cellsSafe->getNbOfElems());
cells->SetCells(nbOfCells,cells2);
cells2->Delete();
if(faceLocationsMC!=0 && facesMC!=0)
{
vtkIdTypeArray *faces(vtkIdTypeArray::New());
- faces->SetVoidArray(facesSafe->getPointer(),facesSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); facesSafe->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(faces,facesSafe,facesSafe->getNbOfElems());
vtkIdTypeArray *faceLocations(vtkIdTypeArray::New());
- faceLocations->SetVoidArray(faceLocationsSafe->getPointer(),faceLocationsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); faceLocationsSafe->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(faceLocations,faceLocationsSafe,faceLocationsSafe->getNbOfElems());
ret->SetCells(cellTypes,cellLocations,cells,faceLocations,faces);
faceLocations->Delete();
faces->Delete();
vtkPoints *pts(vtkPoints::New());
vtkDoubleArray *pts2(vtkDoubleArray::New());
pts2->SetNumberOfComponents(3);
- if(!statusOfCoords)
- {
- pts2->SetArray(coordsSafe->getPointer(),coordsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE);
- coordsSafe->accessToMemArray().setSpecificDeallocator(0);
- }
- else
- pts2->SetArray(coordsSafe->getPointer(),coordsSafe->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
+ AssignDataPointerToVTK<double>(pts2,coordsSafe,statusOfCoords);
pts->SetData(pts2);
pts2->Delete();
ret->SetPoints(pts);
vtkRectilinearGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolationCartesian(MEDCoupling::MEDCMeshMultiLev *mm) const
{
- const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
bool isInternal;
std::vector< DataArrayDouble * > arrs(mm->buildVTUArrays(isInternal));
vtkDoubleArray *vtkTmp(0);
ret->SetDimensions(sizePerAxe[0],sizePerAxe[1],sizePerAxe[2]);
vtkTmp=vtkDoubleArray::New();
vtkTmp->SetNumberOfComponents(1);
- if(isInternal)
- vtkTmp->SetArray(arrs[0]->getPointer(),arrs[0]->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTmp->SetArray(arrs[0]->getPointer(),arrs[0]->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); arrs[0]->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<double>(vtkTmp,arrs[0],isInternal);
ret->SetXCoordinates(vtkTmp);
vtkTmp->Delete();
arrs[0]->decrRef();
{
vtkTmp=vtkDoubleArray::New();
vtkTmp->SetNumberOfComponents(1);
- if(isInternal)
- vtkTmp->SetArray(arrs[1]->getPointer(),arrs[1]->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTmp->SetArray(arrs[1]->getPointer(),arrs[1]->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); arrs[1]->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<double>(vtkTmp,arrs[1],isInternal);
ret->SetYCoordinates(vtkTmp);
vtkTmp->Delete();
arrs[1]->decrRef();
{
vtkTmp=vtkDoubleArray::New();
vtkTmp->SetNumberOfComponents(1);
- if(isInternal)
- vtkTmp->SetArray(arrs[2]->getPointer(),arrs[2]->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTmp->SetArray(arrs[2]->getPointer(),arrs[2]->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); arrs[2]->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<double>(vtkTmp,arrs[2],isInternal);
ret->SetZCoordinates(vtkTmp);
vtkTmp->Delete();
arrs[2]->decrRef();
vtkStructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolationCurveLinear(MEDCoupling::MEDCurveLinearMeshMultiLev *mm) const
{
- const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
int meshStr[3]={1,1,1};
DataArrayDouble *coords(0);
std::vector<int> nodeStrct;
vtkDoubleArray *da(vtkDoubleArray::New());
da->SetNumberOfComponents(3);
if(coords->getNumberOfComponents()==3)
- {
- if(isInternal)
- da->SetArray(coords->getPointer(),coords->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);//VTK has not the ownership of double * because MEDLoader main struct has it !
- else
- { da->SetArray(coords->getPointer(),coords->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); coords->accessToMemArray().setSpecificDeallocator(0); }
- }
+ AssignDataPointerToVTK<double>(da,coords,isInternal);//if isIntenal==True VTK has not the ownership of double * because MEDLoader main struct has it !
else
{
MCAuto<DataArrayDouble> coords2(coords->changeNbOfComponents(3,0.));
- da->SetArray(coords2->getPointer(),coords2->getNbOfElems(),0,VTK_DATA_ARRAY_FREE);//let VTK deal with double *
- coords2->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerToVTK<double>(da,coords2,false);//let VTK deal with double *
}
coords->decrRef();
vtkPoints *points=vtkPoints::New();
vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDFileMeshes *meshes) const
{
- const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
vtkDataSet *ret(0);
//_fsp->isDataSetSupportEqualToThePreviousOne(i,globs);
MCAuto<MEDMeshMultiLev> mml(_fsp->buildFromScratchDataSetSupport(0,globs));//0=timestep Id. Make the hypothesis that support does not change
vtkIntArray *vtkTab(vtkIntArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_CELL_NAME);
- if(noCpyFamCells)
- vtkTab->SetArray(famCells->getPointer(),famCells->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTab->SetArray(famCells->getPointer(),famCells->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); famCells->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<int>(vtkTab,famCells,noCpyFamCells);
ret->GetCellData()->AddArray(vtkTab);
vtkTab->Delete();
famCells->decrRef();
vtkIntArray *vtkTab(vtkIntArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::NUM_ID_CELL_NAME);
- if(noCpyNumCells)
- vtkTab->SetArray(numCells->getPointer(),numCells->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTab->SetArray(numCells->getPointer(),numCells->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); numCells->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<int>(vtkTab,numCells,noCpyNumCells);
ret->GetCellData()->AddArray(vtkTab);
vtkTab->Delete();
numCells->decrRef();
vtkIntArray *vtkTab(vtkIntArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_NODE_NAME);
- if(noCpyFamNodes)
- vtkTab->SetArray(famNodes->getPointer(),famNodes->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTab->SetArray(famNodes->getPointer(),famNodes->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); famNodes->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<int>(vtkTab,famNodes,noCpyFamNodes);
ret->GetPointData()->AddArray(vtkTab);
vtkTab->Delete();
famNodes->decrRef();
vtkIntArray *vtkTab(vtkIntArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::NUM_ID_NODE_NAME);
- if(noCpyNumNodes)
- vtkTab->SetArray(numNodes->getPointer(),numNodes->getNbOfElems(),1,VTK_DATA_ARRAY_FREE);
- else
- { vtkTab->SetArray(numNodes->getPointer(),numNodes->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); numNodes->accessToMemArray().setSpecificDeallocator(0); }
+ AssignDataPointerToVTK<int>(vtkTab,numNodes,noCpyNumNodes);
ret->GetPointData()->AddArray(vtkTab);
vtkTab->Delete();
numNodes->decrRef();
vtkIntArray *vtkTab(vtkIntArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::GLOBAL_NODE_ID_NAME);
- vtkTab->SetArray(gni->getPointer(),gni->getNbOfElems(),0,VTK_DATA_ARRAY_FREE);
- gni->accessToMemArray().setSpecificDeallocator(0);
+ AssignDataPointerToVTK<int>(vtkTab,gni,false);
+ ret->GetPointData()->AddArray(vtkTab);
+ vtkTab->Delete();
gni->decrRef();
}
return ret;
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author : Anthony Geay (EDF R&D)
+
+# non regression test that emulates https://ageay@git.salome-platform.org/gitpub/samples/datafiles.git Med/ResOK_0000.med
+# This test point error during commit efd9331a9455785d0f04b75 in PARAVIS
+
+from MEDLoader import *
+fname="testMEDReader20.med"
+png="testMEDReader20.png"
+nb=10
+arrX=DataArrayDouble(nb+1) ; arrX.iota()
+arrY=DataArrayDouble([0.,1.])
+m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY) ; m=m.buildUnstructured(); m.setName("mesh") ; m.simplexize(0)
+mm=MEDFileUMesh() ; mm[0]=m
+m1=m.computeSkin() ; mm[-1]=m1
+#
+f0=DataArrayInt(m1.getNumberOfCells()) ; f0.iota() ; mm.setFamilyFieldArr(-1,f0)
+f1=DataArrayInt(m1.getNumberOfNodes()) ; f1.iota() ; mm.setFamilyFieldArr(1,f1) # <- very important the bug can be shown here
+#
+nbCells=m1.getNumberOfCells() ; nbNodes=m.getNumberOfNodes()
+mm.write(fname,2)
+for i in range(5):
+ f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m)
+ f.setName("Field")
+ arr=DataArrayInt(2*nb) ; arr.iota(i) ; arr%=nb ; arr=arr.convertToDblArr()
+ f.setArray(arr) ; f.setTime(float(i),i,0)
+ WriteFieldUsingAlreadyWrittenMesh(fname,f)
+ #
+ f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m1)
+ f.setName("Field")
+ arr=DataArrayInt(nbCells) ; arr.iota(i) ; arr%=nbCells ; arr=arr.convertToDblArr()
+ f.setArray(arr) ; f.setTime(float(i),i,0)
+ WriteFieldUsingAlreadyWrittenMesh(fname,f)
+ #
+ f=MEDCouplingFieldDouble(ON_NODES) ; f.setMesh(m)
+ f.setName("FieldNode")
+ arr=DataArrayDouble(nbNodes) ; arr[:]=float(i)
+ f.setArray(arr) ; f.setTime(float(i),i,0)
+ WriteFieldUsingAlreadyWrittenMesh(fname,f)
+ pass
+#####################
+from paraview.simple import *
+#### disable automatic camera reset on 'Show'
+paraview.simple._DisableFirstRenderCameraReset()
+
+# create a new 'MED Reader'
+testMEDReader20med = MEDReader(FileName=fname)
+testMEDReader20med.AllArrays = ['TS0/mesh/ComSup0/Field@@][@@P0']
+testMEDReader20med.AllTimeSteps = ['0000', '0001', '0002', '0003', '0004']
+
+# get animation scene
+animationScene1 = GetAnimationScene()
+
+# update animation scene based on data timesteps
+animationScene1.UpdateAnimationUsingDataTimeSteps()
+
+# get active view
+renderView1 = GetActiveViewOrCreate('RenderView')
+# uncomment following to set a specific view size
+# renderView1.ViewSize = [610, 477]
+
+# show data in view
+testMEDReader20medDisplay = Show(testMEDReader20med, renderView1)
+# trace defaults for the display properties.
+testMEDReader20medDisplay.ColorArrayName = [None, '']
+testMEDReader20medDisplay.GlyphType = 'Arrow'
+testMEDReader20medDisplay.ScalarOpacityUnitDistance = 4.664739046219201
+testMEDReader20medDisplay.SelectUncertaintyArray = [None, '']
+testMEDReader20medDisplay.UncertaintyTransferFunction = 'PiecewiseFunction'
+testMEDReader20medDisplay.OpacityArray = [None, '']
+testMEDReader20medDisplay.RadiusArray = [None, '']
+testMEDReader20medDisplay.RadiusRange = [0.0, 10.0]
+testMEDReader20medDisplay.ConstantRadius = 10.0
+testMEDReader20medDisplay.PointSpriteDefaultsInitialized = 1
+testMEDReader20medDisplay.SelectInputVectors = [None, '']
+testMEDReader20medDisplay.WriteLog = ''
+
+# reset view to fit data
+renderView1.ResetCamera()
+
+#changing interaction mode based on data extents
+renderView1.InteractionMode = '2D'
+renderView1.CameraPosition = [5.0, 0.5, 10000.0]
+renderView1.CameraFocalPoint = [5.0, 0.5, 0.0]
+
+# set scalar coloring
+ColorBy(testMEDReader20medDisplay, ('FIELD', 'vtkBlockColors'))
+
+# show color bar/color legend
+testMEDReader20medDisplay.SetScalarBarVisibility(renderView1, True)
+
+# get color transfer function/color map for 'vtkBlockColors'
+vtkBlockColorsLUT = GetColorTransferFunction('vtkBlockColors')
+
+# get opacity transfer function/opacity map for 'vtkBlockColors'
+vtkBlockColorsPWF = GetOpacityTransferFunction('vtkBlockColors')
+
+# set scalar coloring
+ColorBy(testMEDReader20medDisplay, ('CELLS', 'Field'))
+
+# rescale color and/or opacity maps used to include current data range
+testMEDReader20medDisplay.RescaleTransferFunctionToDataRange(True)
+
+# show color bar/color legend
+testMEDReader20medDisplay.SetScalarBarVisibility(renderView1, True)
+
+# get color transfer function/color map for 'Field'
+fieldLUT = GetColorTransferFunction('Field')
+
+# get opacity transfer function/opacity map for 'Field'
+fieldPWF = GetOpacityTransferFunction('Field')
+
+animationScene1.GoToNext() # <- very important to see the bug play with time steps...
+animationScene1.GoToNext()
+animationScene1.GoToNext()
+animationScene1.GoToNext()
+animationScene1.GoToPrevious()
+animationScene1.GoToPrevious()
+
+# current camera placement for renderView1
+renderView1.InteractionMode = '2D'
+renderView1.CameraPosition = [5.0, 0.5, 10000.0]
+renderView1.CameraFocalPoint = [5.0, 0.5, 0.0]
+renderView1.CameraParallelScale = 5.024937810560445
+
+#
+
+renderView1.ViewSize =[300,300]
+Render()
+#WriteImage(png)
+
+#### saving camera placements for all active views
+
+# current camera placement for renderView1
+renderView1.InteractionMode = '2D'
+renderView1.CameraPosition = [5.0, 0.5, 10000.0]
+renderView1.CameraFocalPoint = [5.0, 0.5, 0.0]
+renderView1.CameraParallelScale = 5.024937810560445
+# compare with baseline image
+import os
+import sys
+try:
+ baselineIndex = sys.argv.index('-B')+1
+ baselinePath = sys.argv[baselineIndex]
+except:
+ print "Could not get baseline directory. Test failed."
+ exit(1)
+baseline_file = os.path.join(baselinePath,png)
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=25)
+vtk.test.Testing.interact()