[Insight-developers] mesh data structure problem.

Lorensen, William E (CRD) lorensen@crd.ge.com
Fri, 2 Mar 2001 07:08:59 -0500


I believe I introduced that problem when purging some signed/unsigned mis matches.

I checked in the fix.

Bill


-----Original Message-----
From: Lydia Ng [mailto:lng@insightful.com]
Sent: Friday, March 02, 2001 3:09 AM
To: Luis Ibanez
Cc: insight-developers@public.kitware.com
Subject: Re: [Insight-developers] mesh data structure problem.


Hi,

The problem seems to be with VectorContainer::GetElementIfIndexExists()
it thinks id = 0 is invalid and fails ( see code below ).

Hence the bogus result when you call
    mesh->GetPoint( 0, &point )

Can someone from GE/Kitware look into this?

Cheers,
Lydia

--------------- from itkVectorContainer.txx -------------------------
template <typename TElementIdentifier, typename TElement>
bool
VectorContainer< TElementIdentifier , TElement >
::GetElementIfIndexExists(ElementIdentifier id, Element* element) const
{
  if((id > 0) && (id < this->VectorType::size()))
    {
    if(element)
      {
      *element = this->VectorType::operator[](id);
      }
    return true;
    }
  return false;
}



----- Original Message -----
From: "Ting Chen" <chenting@graphics.cis.upenn.edu>
To: "Luis Ibanez" <ibanez@cs.unc.edu>
Cc: "Insight toolkit" <Insight-developers@public.kitware.com>
Sent: Thursday, March 01, 2001 2:01 PM
Subject: Re: [Insight-developers] mesh data structure problem.


> Hi! I have tried to add the memory allocation code before I do anything to
> the pointcontainer, but I still cannot get the correct answer,
> and by the way, did you try to add that piece of code into itkMeshTest and
> run it?
> ting
> -----Original Message-----
> From: Luis Ibanez <ibanez@cs.unc.edu>
> To: Ting Chen <chenting@graphics.cis.upenn.edu>
> Cc: Insight toolkit <Insight-developers@public.kitware.com>
> Date: Thursday, March 01, 2001 8:17 AM
> Subject: Re: [Insight-developers] mesh data structure problem.
>
>
> >Hi Ting,
> >
> >my mistake, I should have said:
> >
> >    point.Value() = p;
> >
> >for the iterator,
> >intead of :
> >
> >     point.Value( p )
> >
> >In any case, that will only help you
> >with the speed of access.
> >
> >I think that the real problem in you
> >code could be the allocation.
> >Did you add a line like:
> >
> >   GetPoints()->Reserve( 1000 );
> >
> >before starting to get access to the
> >points ?
> >
> >This line will allocate a number of
> >points (1000 in this case ) for you.
> >
> >
> >Hope that helps,
> >
> >Luis
> >
> >
> >----------------------------------------
> >
> >On Wed, 28 Feb 2001, Ting Chen wrote:
> >
> >> but point.value take no parameter and just return the value stored at
the
> >> location, any other suggestion?
> >>
> >> >
> >> >PointsContainerPointer      myPoints = GetPoints();
> >> >PointsContainer::Iterator   point    = myPoints->Begin();
> >> >PointType p;
> >> >p = 0,0,0;
> >> >while(  point != myPoints->End() )
> >> >{
> >> >    point.Value( p );
> >> >    ++point;
> >> >}
> >> >
> >> >
> >> >
> >> >Luis
> >> >
> >> >
> >>
>-----------------------------------------------------------------------
> >> >
> >> >Ting Chen wrote:
> >> >
> >> >> I write the following code in my itkDeformableMesh class:
> >> >>
> >> >> ....
> >> >>   float ds[3], d[3]={0, 0, 0};
> >> >>   SetPoint(1, (PointType)d);
> >> >>   GetPoint(1, (PointType*)ds);
> >> >> ....
> >> >>
> >> >> but I found out that ds={-1.074e+008, 0, 0} after the operation.
> >> >>
> >> >> if I do
> >> >> ....
> >> >>   float ds[3], d[3]={0, 0, 0};
> >> >>   SetPoint(0, (PointType)d);
> >> >>   GetPoint(0, (PointType*)ds);
> >> >> ....
> >> >>
> >> >> ds = {-1.074e+008, -1.074e+008, -1.074e+008}
> >> >>
> >> >> it seems the first element in the container has problems here. what
is
> >> the
> >> >> problem here?
> >> >> thanks
> >> >> ting
> >> >>
> >> >> _______________________________________________
> >> >> Insight-developers mailing list
> >> >> Insight-developers@public.kitware.com
> >> >> http://public.kitware.com/mailman/listinfo/insight-developers
> >> >
> >> >--
> >> >______________________________________________________________________
> >> >
> >> >Luis Ibanez
> >> >Research Assistant Professor - Division of Neurosurgery
> >> >University of North Carolina at Chapel Hill
> >> >CB# 7060, Chapel Hill, NC 27599
> >> >email : ibanez@cs.unc.edu       home  : http://www.cs.unc.edu/~ibanez
> >> >phone : (919)-843-9961          fax   : (919)-966-6627
> >> >______________________________________________________________________
> >>
> >>
> >
> >--
> >-----------------------------------------------------------
> >Luis Ibanez
> >Research Assistant Professor - Division of NeuroSurgery
> >University of North Carolina at Chapel Hill
> >Chapel Hill, NC, 27599   http://www.cs.unc.edu/~ibanez
> >------------------------------------------------------------
> >
> >
> >
> >_______________________________________________
> >Insight-developers mailing list
> >Insight-developers@public.kitware.com
> >http://public.kitware.com/mailman/listinfo/insight-developers
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>


_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers