[Insight-developers] Re: VectorContainer and MeshFilter

Brad King brad.king@kitware.com
Tue, 27 Feb 2001 15:29:35 -0500 (EST)


Luis,

> I'm ok with Reserve() and Squeeze(), because this is only called one
> for all at the beginning of the Mesh filter, as opposed to a lot of
> insertions of points and resizes.
Unfortunately, there is no standard way to get the stl vector to free
memory.  It always guesses that if a vector got up to a size once, it may
get there again.  The resize() method only causes re-allocation to occur
if the size increases beyond capacit(), and as far as I know, never causes
de-allocation of a part of its memory to occur.  Therefore, the
Squeeze() method on the itkVectorContainer does nothing.  It isn't a bad
idea to call it anyway, though, because the itkIndexedContainerInterface
states that Squeeze() MIGHT free memory.

> If you have a chance, could you please take a look at the
> GenerateMethod in itkAffineTransformMeshFilter, just to verify that
> the Mesh class is used properly,
Looks pretty much okay to me.  Just three minor details:
  InputMeshPointer    inputMesh      =  GetInput();
  OutputMeshPointer   outputMesh     =  GetOutput();
should be
  InputMeshPointer    inputMesh      =  this->GetInput();
  OutputMeshPointer   outputMesh     =  this->GetOutput();
according to the style guide.

outputMesh->SetBoundarieData(  inputMesh->GetBoundarieData() );
should be
outputMesh->SetBoundaryData(  inputMesh->GetBoundaryData() );
(spelling error)

and you forgot to copy over the "boundary assignments" containers:

for(unsigned int dim = 0;
    dim < TOutputMesh::MaxTopologicalDimension; ++dim)
  {
  outputMesh->SetBoundaryAssignments(dim,
    inputMesh->GetBoundaryAssignments(dim));
  }

Remember that since a cell boundary can be shared by multiple cells, the
"boundary assignments" containers are used to point (normally
implicit) cell features at explicit boundaries in the Boundaries
container.  These assignments must also be copied to the new mesh.

Good job.  I'm glad you picked up on the use of the "Value()" from the
itkIndexedContainerInterface::Iterator specification.

-Brad