[Insight-users] Bug in SphereMeshSource

Luis Ibanez luis.ibanez@kitware.com
Sun, 01 Dec 2002 15:19:46 -0500


Hi Thomas,


Thanks for pointing this out.

These are actually two redundant classes.

There seems to be no reason for keeping both
the itkSphereSource and itkSphereMeshSource.

The code from itkSphereMeshSource has been fixed
and the class itkSphereSource has been removed.

The tests that were previously using SphereSource
have been updated to use the itkSphereMeshSource.

The name SphereMeshSource is preferable over
SphereSource to maintain the style of ImageSource
classes.

Please let us know if you find any problems,

Thanks


Luis


================================

Th. Boettger wrote:

> Hi everybody,
> 
> at first I am asking what the exact difference is between SphereSource 
> and SphereMeshSource are and why exist two classes which both - thats at 
> least what I'm thinking - do the same. I used SphereSource for creating 
> my mesh and reported a bug in SphereSource which already got fixed. I 
> found the similar bug in SphereMeshSource. At first please check if the 
> class SphereMeshSource is necessary or if it can be removed. 
> SphereSource creates a SphereMesh and works...
> 
> Here's the bug and my thoughts of how to fix it:
> 
> The bug's in SphereMeshSource.h line 77 where Pointer should be replaced 
> by CellAutoPointer:
> 
> 77: typedef typename TriCellType::Pointer           TriCellPointer;
>                               ^^^^^^^^^^^^
> 
> Otherwise it won't compile. The Problem is now that fixing this produces 
> other errors first thing is in SphereMeshSource.txx:
> 
> 65: OutputMeshPointer outputMesh = this->GetOutput().GetPointer();
> 
> I thought this->GetOutpu() would already return the mesh pointer. So why 
> the GetPointer() method? This can't work.
> 
> the second error occurs during mesh creation. SphereMeshSource.txx lines 
>  147,154,168 and 181. Its the same thing four times:
> 
> 147: cells->SetElement(p, testCell);
> 
> This doesn't work with CellAutoPointer anymore (testCell is of type 
> TriCellPointer). In my code I add cells to the meshes by calling:
> 
>     mesh->SetCell(cellId, newCell );
>     mesh->SetCellData(cellId, (OPixelType)3);
> 
> 
> 
> Is this the intended way? And isn't it the way of fixing those bugs as 
> well?
> 
> Bye
> Thomas
> 
> 
>