You may ignore the first increment (++iter) before the loop, it was a
copy / paste mistake.
On 08/05/2010 07:45 PM, Simon Eck wrote:
> Hi John,
>
> thanks again for your answer. I tested it with this piece of code:
>
> void PointSetEditorControl::testSwapping() {
> mitk::PointSet::PointsContainer::Pointer points =
> PointSet->GetPointSet()->GetPoints();
>
> mitk::PointSet::PointsIterator iter;
> iter = points->Begin();
> int currentId;
> mitk::PointSet::PointType currentPoint;
> int pos = 0;
> ++iter;
> while( iter != points->End() ) {
> currentId = iter->Index();
> currentPoint = iter->Value();
>
> std::cout<< pos<< ": "<< currentId<< "\t("<<
> currentPoint[0]<<
> ", "<< currentPoint[1]<< ", "<< currentPoint[2]<< ")"<< std::endl;
>
> ++iter;
> ++pos;
> }
> }
>
>
> The initial output of this method using my sample PointSet is the following:
>
> 0: 4 (-41.563, 7.705, -1090.180)
> 1: 11 (5.000, 23.510, -1056.090)
> 2: 19 (56.250, 56.429, -995.450)
> 3: 28 (31.594, 4.443, -946.793)
> 4: 33 (-24.375, -15.472, -962.531)
> 5: 42 (-52.914, -31.455, -1020.490)
>
> After pressing F2 on point with ID 19 (pos. 2), the output looks like that:
>
> 0: 4 (-41.563, 7.705, -1090.180)
> 1: 11 (56.250, 56.429, -995.450)
> 2: 19 (5.000, 23.510, -1056.090)
> 3: 28 (31.594, 4.443, -946.793)
> 4: 33 (-24.375, -15.472, -962.531)
> 5: 42 (-52.914, -31.455, -1020.490)
>
> When deselecting and reselecting the same PointSet from data storage,
> the output remains like that (like the one after swap) meaning that the
> changes are stored to the PointSet immediately (I can see the change at
> other positions in code where the PointSet is used, too).
>
> So if i understood you last posting right, i think you are wrong
> regarding the change of position. To me it seems like everything stays
> untouched but the coordinates. That said this is nothing bad at all, i
> can still achieve everything i need the PointSet for. :-)
>
>
> Best regards,
> Simon
>
>
>
> On 08/05/2010 11:56 AM, Johannes Gaa wrote:
>> Good Morning Simon,
>>
>> sorry for the late answer. Since I'm not an expert, I had to figure it out.
>> If I understood right, an iterator setup on a pointset like this
>>
>> mitk::PointSet::PointsContainer* pointsContainer =
>> pointSet->GetPointSet()->GetPoints();
>>
>> mitk::PointSet::PointsContainer::Iterator it;
>>
>> it = pointsContainer->Begin();
>>
>> (out of mitk::PointSetWriter::WriteXML())
>>
>> iterates based on the ID of the points. So if you swap the coordinates,
>> but not the ID you change the position in the pointset.
>> You can try it, by saving a PointSet before and after moving a point.
>> Please correct me, if I'm wrong.
>>
>> Greetings,
>> John
>>
>>
>>
>>
>> Datum: Tue, 03 Aug 2010 17:15:03 +0200
>>
>>
>>
>>
>>> -------- Original-Nachricht --------
>>>
>>> Von: Simon Eck<[email protected]>
>>> An: [email protected]
>>> Betreff: Re: [mitk-users] QmitkPointListWidget / QmitkPointListView
>>> behavior when modifying points by key press
>>>
>>> Hi John,
>>>
>>> thanks for your help. I will consider trying an observer then, although
>>> i think that using the signal and slot mechanism is a very convenient
>>> way to communicate with the Qmitk* classes.
>>>
>>> Just to make sure, when pressing F2/F3 the coordinates of 2 nearby
>>> points inside the PointSet are swapped, while their PointSet-ID and also
>>> their position (when iterating) remains the same.
>>> This means that the move up / move down slots of the underlying
>>> QmitkPointListModel are not made for changing the order of points inside
>>> a PointSet, but rather for exchanging their geometric position?!
>>>
>>> Regards,
>>> Simon
>>>
>>>
>>>
>>> On 08/03/2010 03:50 PM, Johannes Gaa wrote:
>>>> Hello Simon!
>>>>
>>>> The PointListChanged() signal is supposed to be emitted whenever the
>>>> PointSet gets cleared or a new PointSet is loaded. So changing the order
>>>> of the points - or more specific: changing the ID of two or more points
>>>> by swapping their PointSet IDs - won't emit this signal.
>>>> Maybe the name of the signal isn't the best.
>>>> Setup an observer on events like that may do it?
>>>>
>>>> As I mentioned, by pressing F3/F2 the user swaps the (PointSet-)IDs of
>>>> two nearby points. In your example the points only change their
>>>> positions within the ListView, not the PointSet.
>>>> I agree, that there should be a way to give a point a specific
>>>> PointSetID via the widget.
>>>>
>>>> Greetings,
>>>> John
>>>>>
>>>>> -------- Original-Nachricht --------
>>>>> Datum: Tue, 03 Aug 2010 09:56:37 +0200
>>>>> Von: Simon Eck<[email protected]>
>>>>> An: [email protected]
>>>>> Betreff: [mitk-users] QmitkPointListWidget / QmitkPointListView
>>>>> behavior when modifying points by key press
>>>>>
>>>>> Dear list,
>>>>>
>>>>> I recently tried to react to changes of a mitk::PointSet done by
>>>>> QmitkPointListWidget. While connecting to signal PointListChanged() of
>>>>> class QmitkPointListWidget works fine for changes performed by buttons
>>>>> of the widget (e.g. delete a point), it is currently not emitted by
>>>>> changes performed by key press events.
>>>>> I'm not sure if this behavior is desired, but for convenience i
>>> inserted
>>>>> an appropriate signal to QmitkPointListView and a slot to
>>>>> QmitkPointListWidget catching this signal.
>>>>>
>>>>> I attached the modifications based on revision 24408 if one wants to
>>>>> take a look.
>>>>>
>>>>>
>>>>> Another issue i noticed is that when changing the order of points with
>>>>> QmitkPointSetWidget by using F2 / F3 button, the point identifier
>>>>> remains at the former index of the pointset, exchanging only the
>>>>> coordinates. E.g. the pressing F3 on point with identifier 4 in the
>>>>> following constellation
>>>>>
>>>>> 0: (-9.592, -3.257, -1127.020)
>>>>> 4: (-52.914, -31.455, -1020.490)
>>>>> 11: (-41.563, 7.705, -1090.180)
>>>>>
>>>>> will result in
>>>>>
>>>>> 0: (-52.914, -31.455, -1020.490)
>>>>> 4: (-9.592, -3.257, -1127.020)
>>>>> 11: (-41.563, 7.705, -1090.180)
>>>>>
>>>>> While this may be desired, i expected the following:
>>>>> 4: (-52.914, -31.455, -1020.490)
>>>>> 0: (-9.592, -3.257, -1127.020)
>>>>> 11: (-41.563, 7.705, -1090.180)
>>>>>
>>>>>
>>>>> Best wishes,
>>>>> Simon
>>>>>
>>>>>
>>>>> --
>>>>> Simon Eck
>>>>>
>>>>> Biomedical Computer Vision Group
>>>>> Im Neuenheimer Feld 267
>>>>> 69120 Heidelberg
>>>>>
>>>>> [email protected]
>>>>
>>>>
>>>>
>>>> --
>>>> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
>>>> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
>>>>
>>>>
>>>>
>>>>
>>> ------------------------------------------------------------------------------
>>>> The Palm PDK Hot Apps Program offers developers who use the
>>>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>>>> of $1 Million in cash or HP Products. Visit us here for more details:
>>>> http://p.sf.net/sfu/dev2dev-palm
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> mitk-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>>
>>> ------------------------------------------------------------------------------
>>> The Palm PDK Hot Apps Program offers developers who use the
>>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>>> of $1 Million in cash or HP Products. Visit us here for more details:
>>> http://p.sf.net/sfu/dev2dev-palm
>>> _______________________________________________
>>> mitk-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>
>>
>>
>> --
>> Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
>> Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
>>
>>
>>
>> ------------------------------------------------------------------------------
>> The Palm PDK Hot Apps Program offers developers who use the
>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>> of $1 Million in cash or HP Products. Visit us here for more details:
>> http://p.sf.net/sfu/dev2dev-palm
>>
>>
>>
>> _______________________________________________
>> mitk-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users