Hi Albert,

In your special case, you can also use a NodePredicate to search for node that have this name, something like:

dataStorage->GetSubset(mitk::NodePredicateProperty::New("name", mitk::StringProperty::New("the name you are looking for")));

And then test is the result is empty or not

Yann

Pollen Metrology
        Pollen Metrology
        Yann Zimmermann – Project Manager
9 rue du Rocher de Lorzier – 38430 Moirans – France
Office: +33 (0)476657121

www.pollen-metrology.com <http://www.pollen-metrology.com/> youtube <https://www.youtube.com/watch?v=pCj_L4ucxGk>linked-in <https://www.linkedin.com/company/pollen-technology>

Le 01/08/2016 à 15:22, Albert Alises a écrit :
Hi Dr. Maleike,

I finally solved it by calling it.Value()->GetName() inside my loop.

Cheers,
Albert.

2016-08-01 15:13 GMT+02:00 Daniel Maleike <d.male...@mint-medical.de <mailto:d.male...@mint-medical.de>>:

    Hi Albert,


    have you tried calling "it->GetName()" inside your loop? Unless
    there are syntax errors (perhaps it would be "(*it)->GetName()"),
    this should work and give you the name for each object.


    Regards,
    Daniel


--
    Dr. Daniel Maleike, Mint Medical GmbH

    Friedrich-Ebert-Straße 2, 69221 Dossenheim/Heidelberg
    Geschäftsführer: Dr. Matthias Baumhauer, Registergericht Mannheim,
    HRB 709351
    ------------------------------------------------------------------------
    *From:* Albert Alises <ironicpsy...@gmail.com
    <mailto:ironicpsy...@gmail.com>>
    *Sent:* Monday, August 1, 2016 2:35 PM
    *To:* mitk-users@lists.sourceforge.net
    <mailto:mitk-users@lists.sourceforge.net>
    *Subject:* [mitk-users] Iterate through nodes of the data Storage
    Hello,

    I want to check if a node with a certain name is already on the
    data Storage. So far, I retrieve all the nodes on the data storage
    using:

    mitk::DataStorage::SetOfObjects::ConstPointer allNodes =
    this->GetDataStorage()->GetAll();


    However, I do not know how to iterate through the set of objects.
    I have tried creating a loop with a constant iterator, like:

     for ( mitk::DataStorage::SetOfObjects::ConstIterator it =
    allNodes->Begin(); it != allNodes->End(); ++it){


    }


    I do not know how to iterathe through the different names of the
    objects and compare with a string, given the iterator. How could I
    do it?

    Cheers,
    Albert.

    
------------------------------------------------------------------------------

    _______________________________________________
    mitk-users mailing list
    mitk-users@lists.sourceforge.net
    <mailto:mitk-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/mitk-users




------------------------------------------------------------------------------


_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

<<attachment: yann_zimmermann.vcf>>

------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to