[Insight-users] VectorContainer, removing element

Laurent Mundeleer lmundele at ulb.ac.be
Thu, 05 Feb 2004 16:39:58 +0100


in fact I think I didn't gave you enough information, here's some code :
...

    typedef itk::FastMarchingImageFilter<Image2DType, Image2DType> 
fastMarchingType;
    typedef fastMarchingType::NodeContainer NodeContainer;
    typedef fastMarchingType::NodeType NodeType;

...
    NodeContainer::Pointer seeds[128];
...
void levelSetITK::addSeed(float *pos, float ratio)
{   
    typedef NodeType::IndexType IndexType;
    IndexType point;

    float ratio0 = ratio*0.969;
    float ratio1 = ratio*0.98;

    point[0] = static_cast<IndexType::IndexValueType>( pos[0]*ratio0 );
    point[1] = static_cast<IndexType::IndexValueType>( pos[1]*ratio1 );
   
    NodeType node;

    node.SetValue( -25.0 );
    node.SetIndex( point );

    int p = (int) pos[2];
    seeds[p]->InsertElement( nbreSeed[p], node );
    nbreSeed[p]++;
}

and I'd like to remove some element from seeds.

Thanks

Laurent

Brad King wrote:

> Laurent Mundeleer wrote:
>
>> Hi all,
>>
>> I can't figure how to remove an element anywhere in a VectorContainer 
>> (like erase(pos) in stl) ??
>
>
> The class derives from std::vector, so the same methods should be 
> available.  However, you should know that itk::VectorContainer is used 
> by itk::Image to manage memory for pixel buffers.  It is not intended 
> to be used as a general-purpose container by user code.
>
> -Brad
>
>

-- 
********************************************
Laurent Mundeleer
Université Libre de Bruxelles (ULB)
Service des Systèmes Logiques et Numériques (SLN) CP165/57
50, Av. F.Roosevelt
1050 Bruxelles
Belgium
tel : ++32.2.650.22.97
fax : ++32.2.650.22.98
e-mail : lmundele at ulb.ac.be
********************************************