Commit 2522acca authored by Ken Martin's avatar Ken Martin
Browse files

Create VTK 3.1.2 release

The VTK 3.1 release tag in CVS was moved file-wise as fixes were made.
Therefore the true history of the 'branch' is gone.  This commit was
manufactured during conversion from CVS to represent the version as a
merge from all the commits whose files have the tag.
......@@ -29,7 +29,7 @@ Welcome To The Visualization Toolkit
<HR>
<h1><A NAME="Copyright">Copyright Notice</h1>
<pre>
Copyright (c) 1993-2000 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
......@@ -60,7 +60,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<p>
</pre>
<HR>
<h1><A NAME="Introduction">Introduction</h1>
......
......@@ -98,6 +98,7 @@ vtkDataObject::vtkDataObject()
this->MaximumNumberOfPieces = 1;
this->PipelineMTime = 0;
this->LastUpdateExtentWasOutsideOfTheExtent = 0;
}
//----------------------------------------------------------------------------
......@@ -223,37 +224,37 @@ void vtkDataObject::UpdateInformation()
}
break;
}
this->LastUpdateExtentWasOutsideOfTheExtent = 0;
}
//----------------------------------------------------------------------------
void vtkDataObject::PropagateUpdateExtent()
{
// Release data if update extent does not lie within extent
this->ModifyExtentForUpdateExtent();
// If we need to update due to PipelineMTime, or the fact that our
// data was released, then propagate the update extent to the source
// if there is one.
if ( this->UpdateTime < this->PipelineMTime || this->DataReleased )
if ( this->UpdateTime < this->PipelineMTime || this->DataReleased ||
this->UpdateExtentIsOutsideOfTheExtent() ||
this->LastUpdateExtentWasOutsideOfTheExtent)
{
if (this->Source)
{
this->Source->PropagateUpdateExtent(this);
}
}
// update the value of this ivar
this->LastUpdateExtentWasOutsideOfTheExtent =
this->UpdateExtentIsOutsideOfTheExtent();
// Check that the update extent lies within the whole extent
if ( ! this->VerifyUpdateExtent() )
{
// invalid update piece - this should not occur!
return;
}
// Release data if update extent does not lie within extent
// We have to do it again because the source may have modified our
// UpdateExtent during propagation.
this->ModifyExtentForUpdateExtent();
}
//----------------------------------------------------------------------------
......@@ -263,7 +264,8 @@ void vtkDataObject::TriggerAsynchronousUpdate()
// If we need to update due to PipelineMTime, or the fact that our
// data was released, then propagate the trigger to the source
// if there is one.
if ( this->UpdateTime < this->PipelineMTime || this->DataReleased )
if ( this->UpdateTime < this->PipelineMTime || this->DataReleased ||
this->UpdateExtentIsOutsideOfTheExtent())
{
if (this->Source)
{
......@@ -279,7 +281,8 @@ void vtkDataObject::UpdateData()
// If we need to update due to PipelineMTime, or the fact that our
// data was released, then propagate the UpdateData to the source
// if there is one.
if ( this->UpdateTime < this->PipelineMTime || this->DataReleased )
if ( this->UpdateTime < this->PipelineMTime || this->DataReleased ||
this->UpdateExtentIsOutsideOfTheExtent())
{
if (this->Source)
{
......@@ -485,6 +488,40 @@ int vtkDataObject::VerifyUpdateExtent()
return retval;
}
int vtkDataObject::UpdateExtentIsOutsideOfTheExtent()
{
switch ( this->GetExtentType() )
{
case VTK_PIECES_EXTENT:
if ( this->UpdatePiece != this->Piece ||
this->UpdateNumberOfPieces != this->NumberOfPieces )
{
return 1;
}
break;
case VTK_3D_EXTENT:
if ( this->UpdateExtent[0] < this->Extent[0] ||
this->UpdateExtent[1] > this->Extent[1] ||
this->UpdateExtent[2] < this->Extent[2] ||
this->UpdateExtent[3] > this->Extent[3] ||
this->UpdateExtent[4] < this->Extent[4] ||
this->UpdateExtent[5] > this->Extent[5] )
{
return 1;
}
break;
// We should never have this case occur
default:
vtkErrorMacro( << "Internal error - invalid extent type!" );
break;
}
return 0;
}
//----------------------------------------------------------------------------
void vtkDataObject::ModifyExtentForUpdateExtent()
......@@ -546,6 +583,7 @@ void vtkDataObject::CopyInformation( vtkDataObject *data )
}
}
//----------------------------------------------------------------------------
void vtkDataObject::PrintSelf(ostream& os, vtkIndent indent)
......@@ -588,4 +626,7 @@ void vtkDataObject::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Field Data:\n";
this->FieldData->PrintSelf(os,indent.GetNextIndent());
os << indent << "LastUpdateExtentWasOutsideOfTheExtent: " <<
this->LastUpdateExtentWasOutsideOfTheExtent << endl;
}
......@@ -286,6 +286,15 @@ public:
// It sets the DataReleased flag to 0, and sets a new UpdateTime.
void DataHasBeenGenerated();
// Description:
// Return non zero if the UpdateExtent is outside of the Extent
virtual int UpdateExtentIsOutsideOfTheExtent();
// Description:
// make the output data ready for new data to be inserted. For most
// objects we just call Initialize. But for imagedata we leave the old
// data in case the memory can be reused.
virtual void PrepareForNewData() {this->Initialize();};
protected:
......@@ -364,6 +373,9 @@ protected:
// This does not include the MTime of this data object.
unsigned long PipelineMTime;
// Was the update extent propogated down the pipeline
int LastUpdateExtentWasOutsideOfTheExtent;
// How many upstream filters are local to the process.
// This will have to change to a float for Kens definition of locality.
float Locality;
......
......@@ -139,6 +139,23 @@ void vtkImageData::CopyStructure(vtkDataSet *ds)
this->CopyInformation(sPts);
}
void vtkImageData::PrepareForNewData()
{
// free everything but the scalars
vtkScalars *scalars = this->GetPointData()->GetScalars();
if (scalars)
{
scalars->Register(this);
}
this->Initialize();
if (scalars)
{
this->GetPointData()->SetScalars(scalars);
scalars->UnRegister(this);
}
}
//----------------------------------------------------------------------------
// The input data object must be of type vtkImageData or a subclass!
......@@ -1601,6 +1618,22 @@ void vtkImageData::SetExtent(int *extent)
//----------------------------------------------------------------------------
int vtkImageData::UpdateExtentIsOutsideOfTheExtent()
{
if ( this->UpdateExtent[0] < this->Extent[0] ||
this->UpdateExtent[1] > this->Extent[1] ||
this->UpdateExtent[2] < this->Extent[2] ||
this->UpdateExtent[3] > this->Extent[3] ||
this->UpdateExtent[4] < this->Extent[4] ||
this->UpdateExtent[5] > this->Extent[5] )
{
return 1;
}
return 0;
}
//----------------------------------------------------------------------------
void vtkImageData::ModifyExtentForUpdateExtent()
{
if ( this->UpdateExtent[0] < this->Extent[0] ||
......
......@@ -298,11 +298,21 @@ public:
// Must only be called with vtkImageData (or subclass) as input
void CopyTypeSpecificInformation( vtkDataObject *image );
// Description:
// Return non zero if the UpdateExtent is outside of the Extent
virtual int UpdateExtentIsOutsideOfTheExtent();
// Description:
// Needs to be overridden from vtkDataObject so that we can call
// the correct version of SetExtent rather than just doing a memcpy.
virtual void ModifyExtentForUpdateExtent();
// Description:
// make the output data ready for new data to be inserted. For most
// objects we just call Initialize. But for imagedata we leave the old
// data in case the memory can be reused.
virtual void PrepareForNewData();
void SetMemoryLimit( int vtkNotUsed(x) )
{ vtkErrorMacro( << "Memory limit no longer supported - use streamer" ); };
......
......@@ -71,6 +71,7 @@ vtkProperty2D::vtkProperty2D()
this->Color[0] = 1.0;
this->Color[1] = 1.0;
this->Color[2] = 1.0;
this->DisplayLocation = VTK_FOREGROUND_LOCATION;
}
vtkProperty2D::~vtkProperty2D()
......@@ -89,7 +90,19 @@ void vtkProperty2D::PrintSelf(ostream& os, vtkIndent indent)
<< this->Color[2] << ")\n";
os << indent << "Point size: " << this->PointSize << "\n";
os << indent << "Line width: " << this->LineWidth << "\n";
switch ( this->DisplayLocation )
{
case VTK_FOREGROUND_LOCATION:
os << indent << "Display location: foreground\n";
break;
case VTK_BACKGROUND_LOCATION:
os << indent << "Display location: background\n";
break;
default:
os << indent << "Display location: invalid\n";
break;
}
}
......
......@@ -54,6 +54,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class vtkViewport;
#define VTK_BACKGROUND_LOCATION 0
#define VTK_FOREGROUND_LOCATION 1
class VTK_EXPORT vtkProperty2D : public vtkObject
{
public:
......@@ -87,6 +90,23 @@ public:
vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
vtkGetMacro(LineWidth,float);
// Description:
// The DisplayLocation is either background or foreground.
// If it is background, then this 2D actor will be drawn
// behind all 3D props or foreground 2D actors. If it is
// background, then this 2D actor will be drawn in front of
// all 3D props and background 2D actors. Within 2D actors
// of the same DisplayLocation type, order is determined by
// the order in which the 2D actors were added to the viewport.
vtkSetClampMacro( DisplayLocation, int,
VTK_BACKGROUND_LOCATION, VTK_FOREGROUND_LOCATION );
vtkGetMacro( DisplayLocation, int );
void SetDisplayLocationToBackground()
{this->DisplayLocation = VTK_BACKGROUND_LOCATION;};
void SetDisplayLocationToForeground()
{this->DisplayLocation = VTK_FOREGROUND_LOCATION;};
// Description:
// Have the device specific subclass render this property.
virtual void Render (vtkViewport* vtkNotUsed(viewport)) {}
......@@ -101,6 +121,7 @@ protected:
float Opacity;
float PointSize;
float LineWidth;
int DisplayLocation;
};
......
......@@ -347,7 +347,7 @@ void vtkSource::UpdateData(vtkDataObject *vtkNotUsed(output))
{
if (this->Outputs[idx])
{
this->Outputs[idx]->Initialize();
this->Outputs[idx]->PrepareForNewData();
}
}
......
......@@ -173,7 +173,21 @@ void vtkStructuredGrid::Initialize()
this->Blanking = 0;
}
//----------------------------------------------------------------------------
int vtkStructuredGrid::UpdateExtentIsOutsideOfTheExtent()
{
if ( this->UpdateExtent[0] < this->Extent[0] ||
this->UpdateExtent[1] > this->Extent[1] ||
this->UpdateExtent[2] < this->Extent[2] ||
this->UpdateExtent[3] > this->Extent[3] ||
this->UpdateExtent[4] < this->Extent[4] ||
this->UpdateExtent[5] > this->Extent[5] )
{
return 1;
}
return 0;
}
void vtkStructuredGrid::ModifyExtentForUpdateExtent()
{
......
......@@ -158,6 +158,10 @@ public:
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
vtkGetVector6Macro(Extent,int);
// Description:
// Return non zero if the UpdateExtent is outside of the Extent
virtual int UpdateExtentIsOutsideOfTheExtent();
// Description:
// Return the actual size of the data in kilobytes. This number
// is valid only after the pipeline has updated. The memory size
......
......@@ -70,6 +70,13 @@ void vtkStructuredPoints::ModifyExtentForUpdateExtent()
this->SetUpdateExtent( this->WholeExtent );
}
void vtkStructuredPoints::PropagateUpdateExtent()
{
// Make sure the extent is the whole extent
this->SetUpdateExtent( this->WholeExtent );
this->vtkImageData::PropagateUpdateExtent();
}
......
......@@ -75,6 +75,10 @@ public:
// vtkStructuredPoints data object.
virtual void ModifyExtentForUpdateExtent();
// Description:
// Internal method in a class we hope to remove
virtual void PropagateUpdateExtent();
protected:
vtkStructuredPoints();
~vtkStructuredPoints() {};
......
......@@ -58,8 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define VTK_VERSION "3.1.1"
#define VTK_MAJOR_VERSION 3
#define VTK_MINOR_VERSION 1
#define VTK_BUILD_VERSION 1
#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.434 $, $Date: 2000-02-21 20:31:36 $ (GMT)"
#define VTK_BUILD_VERSION 2
#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.476 $, $Date: 2000-04-03 14:51:38 $ (GMT)"
class VTK_EXPORT vtkVersion : public vtkObject {
......
# Test the vtkThinPlateSplineMeshWarp class
# Class contributed by Tim Hutton
#
catch {load vtktcl}
if { [catch {set VTK_TCL $env(VTK_TCL)}] != 0} { set VTK_TCL "../../examplesTcl" }
if { [catch {set VTK_DATA $env(VTK_DATA)}] != 0} { set VTK_DATA "../../../vtkdata" }
# this is a tcl version of the Mace example
# get the interactor ui
source $VTK_TCL/vtkInt.tcl
source $VTK_TCL/colors.tcl
# create a sphere source and actor
#
vtkSphereSource original
original SetThetaResolution 100
original SetPhiResolution 100
vtkPoints spoints
spoints SetNumberOfPoints 6
vtkPoints tpoints
tpoints SetNumberOfPoints 6
spoints SetPoint 0 0 0 0
tpoints SetPoint 0 0 0 0
spoints SetPoint 1 1 0 0
tpoints SetPoint 1 1 0 0
spoints SetPoint 2 0 1 0
tpoints SetPoint 2 0 1 0
spoints SetPoint 3 1 1 1
tpoints SetPoint 3 1 1 0.5
spoints SetPoint 4 -1 1 0.5
tpoints SetPoint 4 -1 1 3
spoints SetPoint 5 0.5 0.5 2
tpoints SetPoint 5 0.5 0.5 -0.5
vtkThinPlateSplineMeshWarp warp
warp SetInput [original GetOutput]
warp SetSourceLandmarks spoints
warp SetTargetLandmarks tpoints
vtkPolyDataMapper mapper
mapper SetInput [warp GetOutput]
vtkProperty backProp
eval backProp SetDiffuseColor $tomato
vtkActor actor
actor SetMapper mapper
eval [actor GetProperty] SetColor $peacock
actor SetBackfaceProperty backProp
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
renWin SetSize 100 250
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background and size
#
ren1 AddActor actor
ren1 SetBackground 1 1 1
renWin SetSize 200 300
# render the image
#
iren SetUserMethod {wm deiconify .vtkInteract}
iren Initialize
set cam1 [ren1 GetActiveCamera]
$cam1 SetClippingRange 1.87 3.9
$cam1 SetFocalPoint 0 0 0.254605
$cam1 SetPosition 0.571764 2.8232 0.537528
$cam1 ComputeViewPlaneNormal
$cam1 SetViewUp 0.5188 -0.0194195 -0.854674
renWin Render
renWin SetFileName "thinPlate.tcl.ppm"
#renWin SaveImageAsPPM
# prevent the tk window from showing up then start the event loop
wm withdraw .
/*=========================================================================
Program: Visualization Toolkit
Module: vtkThinPlateSplineMeshWarp.cxx
Language: C++
Date: $Date$
Version: $Revision$
Thanks: Thanks to Tim Hutton (MINORI Project, Dental and Medical
Informatics, Eastman Dental Institute, London, UK) who
developed and contributed this class.
Copyright (c) 1993-2000 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
of any contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
* Modified source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "vtkThinPlateSplineMeshWarp.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
//------------------------------------------------------------------------------
vtkThinPlateSplineMeshWarp* vtkThinPlateSplineMeshWarp::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkThinPlateSplineMeshWarp");
if(ret)
{
return (vtkThinPlateSplineMeshWarp*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkThinPlateSplineMeshWarp;
}
vtkThinPlateSplineMeshWarp::vtkThinPlateSplineMeshWarp()
{
this->SourceLandmarks=NULL;
this->TargetLandmarks=NULL;
this->Sigma=1.0;
this->GenerateDisplacementVectors = 0;
}
vtkThinPlateSplineMeshWarp::~vtkThinPlateSplineMeshWarp()
{
if (this->SourceLandmarks)
{
this->SourceLandmarks->Delete();
}
if (this->TargetLandmarks)
{
this->TargetLandmarks->Delete();
}
}
//------------------------------------------------------------------------
// some dull matrix things
inline double** NewMatrix(int x,int y)
{
double** m = new double*[x];
for(int i=0;i<x;i++)
{
m[i] = new double[y];
}
return m;
}
inline void DeleteMatrix(double** m,int x,int vtkNotUsed(y))
{
for(int i=0;i<x;i++)
{
delete [] m[i]; // OK, we don't actually need y
}
delete [] m;
}
inline void FillMatrixWithZeros(double** m,int x,int y)
{
int i,j;
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
m[i][j]=0.0;
}
}
}
inline void TransposeMatrix(double*** m,int x,int y)
{
double swap,*a,*b;
int r,c;
if(x==y)
{
// matrix is square, can just swap values over the diagonal (fast)
for(c=1;c<x;c++)
{
for(r=0;r<c;r++)
{
a = &((*m)[r][c]); // (what a mess)